|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
Flat JSON representation used by the Glaze codec below. More...
#include <rational.hpp>
Public Member Functions | |
| constexpr bool | validate () const noexcept |
| Whether these raw values decode without being clamped. | |
Public Attributes | |
| std::int64_t | num {0} |
| Signed numerator as sent/received. | |
| std::int64_t | den {1} |
| Denominator as sent/received; may be non-canonical. | |
| std::uint32_t | dp {1} |
| Decimal-precision tag as sent/received. | |
Flat JSON representation used by the Glaze codec below.
Field names are the wire contract: {"num":..,"den":..,"dp":..}.
Definition at line 619 of file rational.hpp.
|
inlinenodiscardconstexprnoexcept |
Whether these raw values decode without being clamped.
Names the three clamps setWire would otherwise apply silently, so "was this value altered on the way in?" is answerable before the canonicalising constructor has already hidden the answer. A caller that has its own decoded Wire can ask directly; the wire codec asks on its behalf, and a WireClampScope around the decode acts on it.
Note that a non-canonical but representable denominator (4/8, or a negative den) is valid: reducing and sign-normalising it is canonicalisation, not clamping, and round-trips the same value.
Definition at line 637 of file rational.hpp.
| std::int64_t morph::math::Rational::Wire::num {0} |
Signed numerator as sent/received.
Definition at line 620 of file rational.hpp.
| std::int64_t morph::math::Rational::Wire::den {1} |
Denominator as sent/received; may be non-canonical.
Definition at line 621 of file rational.hpp.
| std::uint32_t morph::math::Rational::Wire::dp {1} |
Decimal-precision tag as sent/received.
Definition at line 622 of file rational.hpp.