Crate extended_rational [−] [src]
Provides implementations of high-accuracy projectively-extended rational numbers and macros for creating them
Projectively-extended rationals differ from normal rationals because they have
a single, signless infinity and a single, signless zero. This means that
can be defined as equal to
1/∞ equal to
For unsigned numbers,
∞ is greater than every number, whereas with signed numbers,
∞ is not comparable to any number but itself. This is because
-∞ so no
ordering can exist.
∞ + ∞,
∞ - ∞,
∞ * 0,
0 * ∞,
∞ / ∞, and
0 / 0 are all
A value of
NaN in any operation always returns
NaN is not ordered and
is not equal to any number, including itself.
No operation should ever panic. Operations that overflow round each input to a
simpler fraction until they can succeed. Any invalid operations should
NaN instead of panicking.
For use with the bit manager crate, add this to your
[features] default = ["extended-rational/bit_manager_enabled"]
A macro for creating a new signed rational using a given ratio or decimal
A macro for creating a new unsigned rational using a given ratio or decimal
A type representing a signed projectively-extended rational number
A type representing an unsigned projectively-extended rational number
Returns the greatest common divisor of two numbers.
Returns the least common multiple of two numbers