A Rational Constant is a class representing the ration of two values of a built-in integral type (bool
, int
, long
, etc.) in compile-time programs. A rational constant directly supports access to the numerator
and denominator. Other arithmetic operations are supported through the external metafunctions. A rational constant is always stored in simplified form.
Expression | Return type |
---|---|
typename n::integer_type | An integral type |
typename n::type | A model of Rational Constant |
typename n::numerator | A model of Integral Constant representing the numerator |
typename n::denominator | A model of Integral Constant representing the denominator |
n::value() | A run-time floating point approximation of n::type |
Expression | Complexity | Precondition | Semantics | Postcondition |
---|