Checks if T has the basic properties of a rational type, i.e. it has a numerator and a denominator.
Returns the smallest integer greater than or equal to r.
Returns the largest integer less than or equal to r.
Find the Greatest Common Factor (GCF), aka Greatest Common Divisor (GCD), of m and n.
Find the Least Common Multiple (LCM) of a and b.
Implements rational numbers on top of whatever integer type is specified by the user. The integer type used may be any type that behaves as an integer. Specifically, isIntegerLike must return true, the integer type must have value semantics, and the semantics of all integer operations must follow the normal rules of integer arithmetic.
Round r to the nearest integer. If the fractional part is exactly 1/2, r will be rounded such that the absolute value is increased by rounding.
Convert a floating point number to a Rational based on integer type SomeIntegral. Allows an error tolerance of epsilon. (Default epsilon = 1e-8.)
The struct that implements rational numbers. All relevant operators (addition, subtraction, multiplication, division, exponentiation by a non-negative integer, equality and comparison) are overloaded. The second operand for all binary operators except exponentiation may be either another Rational or another integer type.
Checks whether T is structurally an integer, i.e. whether it supports all of the operations an integer type should support. Does not check the nominal type of T. In particular, for a mutable type T the following must compile:
This module contains an implementation of rational numbers that is templated on the underlying integer type. It can be used with either builtin fixed width integers or arbitrary precision integers. All relevant operators are overloaded for both rational-rational and rational-integer operations.
Synopsis: