Uses old Rust 2015
|0.3.1||Apr 8, 2021|
|0.3.0||Apr 1, 2021|
|0.2.0||Jan 30, 2018|
|0.1.2||Jul 7, 2017|
|0.1.1||Mar 24, 2017|
#44 in Rust patterns
25,135 downloads per month
Used in 97 crates (16 directly)
A wrapper for floats that uses this ordering:
NaN | -Infinity | x < 0 | -0 | +0 | x > 0 | +Infinity | NaN
There is an old family magic spell that allows one to compare floating-point values without any floating-point work. Simply interpret the fp value as an unsigned integer, flip its sign bit (if positive) or all bits (if negative), and do the comparison normally.
The trick was developed on
f64, but it should work on anything
structured like the IEEE floats. Even the IEEE decimal formats.
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.