#rational-numbers #numbers #rational #infinity #extended #fraction

extended-rational

Provides implementations of high-accuracy projectively-extended rational numbers and macros for creating them

14 stable releases

Uses old Rust 2015

1.3.3 Nov 5, 2017
1.3.2 Oct 8, 2017
1.0.1 Sep 30, 2017

#1514 in Data structures

MIT license

42KB
780 lines

This crate provides implementations of high-accuracy projectively-extended rational numbers and macros for creating them.

Differences

Projectively-extended rationals differ from normal rationals because they have a single, signless infinity and a single, signless zero. This means that 1/0 can be defined as equal to and 1/ equal to 0.


lib.rs:

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 1/0 can be defined as equal to and 1/ equal to 0.

Infinity

For unsigned numbers, is greater than every number, whereas with signed numbers, is not comparable to any number but itself. This is because equals - so no ordering can exist.

NaN

+, -, * 0, 0 *, /, and 0 / 0 are all NaN

A value of NaN in any operation always returns NaN. NaN is not ordered and is not equal to any number, including itself.

Panics

No operation should ever panic. Operations that overflow round each input to a simpler fraction until they can succeed. Any invalid operations should return NaN instead of panicking.

Additional Features

For use with the bit manager crate, add this to your Cargo.toml:

[features]
default = ["extended-rational/bit_manager_enabled"]

Dependencies

~0–265KB