Skip to content

Commit 4ab84fc

Browse files
authored
Change quantity_bounds to use wrap_to_range
Reoslves #783
1 parent a89b93b commit 4ab84fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/blog/posts/quantity-point-bounds.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,16 @@ the enforcement from its nearest ancestor that has bounds:
209209
```cpp
210210
// Absolute origin with physical bounds:
211211
template<>
212-
inline constexpr auto mp_units::quantity_bounds<prime_meridian> = mp_units::clamp_to_range{-180.0 * deg, 180.0 * deg};
212+
inline constexpr auto mp_units::quantity_bounds<prime_meridian> = wrap_to_range{-180.0 * deg, 180.0 * deg};
213213
214214
// Relative origin — no own bounds; inherits from prime_meridian.
215215
// The +21° offset is transparent to the enforcement.
216216
inline constexpr struct warsaw_meridian final : mp_units::relative_point_origin<prime_meridian + 21.0 * deg> {
217217
} warsaw_meridian;
218218
219-
// A value of +200° east of Warsaw = +221° from prime → clamped to +180° → +159° from Warsaw.
219+
// A value of +200° east of Warsaw = +221° from prime → wraps to -139° from prime → -160° from Warsaw.
220220
quantity_point qp = warsaw_meridian + 200.0 * deg;
221-
assert(qp.quantity_from(warsaw_meridian) == 159.0 * deg);
221+
assert(qp.quantity_from(warsaw_meridian) == -160.0 * deg);
222222
```
223223

224224
When a `relative_point_origin` defines **its own** bounds, those bounds are

0 commit comments

Comments
 (0)