forked from mpusz/mp-units
For each Magnitude `m`, we now support: - `is_rational(m)` tells whether it represents a rational number. - `is_integral(m)` tells whether it represents an integer (and `is_integral(m)` implies `is_rational(m)`). - `m.value<T>` represents the value of `m` in the type `T`. If `T` is integral, we only support `m.value<T>` when `is_integral(m)`. We also perform all intermediate computations in the widest type of the same category (floating point, signed, or unsigned). This means we can, for example, give first-class support to embedded users who may have hardware support only for `float`: we can ensure they get the most accurate `float` value we can compute, without burdening them with a dependency on `long double` in their runtime code. We are not yet ready to replace `ratio` as the definition of unit magnitudes, but we're a step closer. The next step will be to decompose a Magnitude into numerator, denominator, and irrational parts, giving us full bidirectional convertibility with existing `ratio` instances. Then we can migrate over in a controlled fashion.