Fraction type¶
-
class
fraction¶ A fraction type to support the
Numeric_ValueUnicode property. This is merely a numerator/denominator pair and does not perform any reduction nor provides any arithmetic functionality.-
constexpr
fraction() noexcept¶ Creates a new fraction representing 0/1.
-
constexpr
fraction(long numerator, long denominator) noexcept¶ Creates a new fraction representing
numerator/denominator.Parameters: - numerator – the fraction’s numerator
- denominator – the fraction’s denominator
Requires: denominatoris not zero
-
constexpr long
numerator() const noexcept¶ Returns: the numerator of this fraction
-
constexpr long
denominator() const noexcept¶ Returns: the denominator of this fraction
-
constexpr double
as_double() const noexcept¶ Returns: the result of dividing the numerator by the denominator of this fraction, as a double.
Note
This feature is only available if the
OGONEK_USE_BOOSTmacro is set.-
constexpr
fraction(boost::rational<long> r) noexcept¶ Creates a new fraction from a
boost::rational<long>.
-
constexpr
operator boost::rational<long>() const noexcept¶ Returns: a boost::rational<long>equivalent to this fraction.
-
constexpr