#float #NaN #finite #infinite

fin

finite, NaN-free floiting point numbers. Not ready to be used yet!

2 releases

0.0.2 Nov 4, 2017
0.0.1 Nov 2, 2017

#69 in Value formatting

MIT license

15KB
345 lines

fin - finite, NaN-free floiting point numbers for rust

Working with floats can be a bit of a pain in the backside, since floats can carry errors conditions that are not handled by the type system. In addition, rust does not implement the Ord trait for f3 and f64. Which is correct since a total ordering makes no sense in the face of NaN-values.

fin aims to improve on that situation as a zero-cost abstraction (in the sense that the performance hit is not greater than manually checking conditions where its nessesary)

Usage

Add this to your Cargo.toml (since the fin project is very much in flux, getting this package from github is the preferred way for now):

[dependencies]
fin = { git = "https://github.com/madmalik/fin.git" }

and this to your crate root:

extern crate fin;

Principle

Fin uses session types to track invariants on floating point numbers.

License

MIT


lib.rs:

Working with floats can be a bit of a pain in the backside, since floats can carry errors conditions (not a number and ininity from an overflow) and rust does the correct thing and doesn't implement Ord.

...

Dependencies

~185KB