datafusion
datafusion copied to clipboard
math functions precision with f64 doesn't quite vibe on FreeBSD
Describe the bug
When running cargo test on FreeBSD
---- math::log::tests::test_log_f64 stdout ----
thread 'math::log::tests::test_log_f64' panicked at datafusion/functions/src/math/log.rs:259:17:
assertion `left == right` failed
left: 4.000000000000001
right: 4.0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
math::log::tests::test_log_f64
To Reproduce
FreeBSD jenkins-agent 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
rustc 1.77.2 (25ef9e3d8 2024-04-09)
Expected behavior
No response
Additional context
No response
Thanks @rtyler -- this sounds like we need to do some rounding in the tests when comparing floating point results
We do this in other places, for example:
https://github.com/apache/datafusion/blob/78055fe13b64cdfb4accd131e9a462770c21a934/datafusion/sqllogictest/test_files/scalar.slt#L104-L107
My personal suggestion is to rewrite the relevant test to sqllogictest if possible and then use round
Here are the instructions: https://github.com/apache/datafusion/tree/main/datafusion/sqllogictest