Comment Comment by jph I have this floating-point problem at scale and will donate $100 to the author, or to anyone here, who can improve my code the most.The Rust code in the assert_f64_eq macro is: if (a >= b && a - b < f64::EPSILON) || (a <= b && b - a < f64::EPSILON) I'm the author of the Rust assertables crate. It provides floating-point assert macros much as described in the article.https://github.com/SixArm/assertables-rust-crate/blob/main/s...If there's a way to make it more precise and/or specific and/or faster, or create similar macros with better functionality and/or correctness, that's great.See the same directory for corresponding assert_* macros for less than, greater than, etc. parent jph 6 months ago
The Rust code in the assert_f64_eq macro is:
I'm the author of the Rust assertables crate. It provides floating-point assert macros much as described in the article.https://github.com/SixArm/assertables-rust-crate/blob/main/s...
If there's a way to make it more precise and/or specific and/or faster, or create similar macros with better functionality and/or correctness, that's great.
See the same directory for corresponding assert_* macros for less than, greater than, etc.