This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 682bc2eff2 Improve log func stability (#11808)
682bc2eff2 is described below

commit 682bc2eff2a428482a83fba0f304facb458e4428
Author: 张林伟 <[email protected]>
AuthorDate: Mon Aug 5 19:00:31 2024 +0800

    Improve log func stability (#11808)
---
 datafusion/functions/src/math/log.rs | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/datafusion/functions/src/math/log.rs 
b/datafusion/functions/src/math/log.rs
index 0e181aa612..ad7cff1f71 100644
--- a/datafusion/functions/src/math/log.rs
+++ b/datafusion/functions/src/math/log.rs
@@ -261,10 +261,10 @@ mod tests {
                     .expect("failed to convert result to a Float64Array");
 
                 assert_eq!(floats.len(), 4);
-                assert_eq!(floats.value(0), 3.0);
-                assert_eq!(floats.value(1), 2.0);
-                assert_eq!(floats.value(2), 4.0);
-                assert_eq!(floats.value(3), 4.0);
+                assert!((floats.value(0) - 3.0).abs() < 1e-10);
+                assert!((floats.value(1) - 2.0).abs() < 1e-10);
+                assert!((floats.value(2) - 4.0).abs() < 1e-10);
+                assert!((floats.value(3) - 4.0).abs() < 1e-10);
             }
             ColumnarValue::Scalar(_) => {
                 panic!("Expected an array value")
@@ -291,10 +291,10 @@ mod tests {
                     .expect("failed to convert result to a Float32Array");
 
                 assert_eq!(floats.len(), 4);
-                assert_eq!(floats.value(0), 3.0);
-                assert_eq!(floats.value(1), 2.0);
-                assert_eq!(floats.value(2), 4.0);
-                assert_eq!(floats.value(3), 4.0);
+                assert!((floats.value(0) - 3.0).abs() < f32::EPSILON);
+                assert!((floats.value(1) - 2.0).abs() < f32::EPSILON);
+                assert!((floats.value(2) - 4.0).abs() < f32::EPSILON);
+                assert!((floats.value(3) - 4.0).abs() < f32::EPSILON);
             }
             ColumnarValue::Scalar(_) => {
                 panic!("Expected an array value")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to