forked from mpusz/mp-units
We provide two new functions, `numerator(m)` and `denominator(m)`, for a Magnitude `m`. They fulfill the following conditions: 1. `numerator(m)` and `denominator(m)` are always integer Magnitudes. 2. If `m` is rational, then `m == numerator(m) / denominator(m)`. If `m` is _not_ rational, then the numerator and denominator are not especially meaningful (there is no uniquely defined "leftover irrational part"). However, we choose a convention that matches how humans would write a mixed number. For example, sqrt(27/16) would have a numerator of 3, denominator of 4, and a "leftover part" of sqrt(3), matching the "human" way of writing this as [(3 * sqrt(3)) / 4]. This has no use yet, but it may later be useful in printing the Magnitude of an anonymous Unit for end users. To further reduce friction for the upcoming migration, we provide an implicit conversion from a Magnitude to a `ratio`. We restrict this operation to rational Magnitudes, and guard this with a `static_assert`.