Open jsvd opened 4 years ago
Adding a note here that fixing this will still allow wrong comparisons to happen, e.g.:
irb(main):003:0> 1.00000000000000001 > 1
=> false
But since using the mutate filter to coerce the int to float doesn’t fix this anyway:
irb(main):006:0> 1.00000000000000001 > 1.0
=> false
Labelling this as a bug, as fixing this will make a lot more comparisons be truthful, and won't break any existing truthful comparison.
Comparing floats is always a pain. A way to improve the correctness of these comparisons is to change the float1 == float2
test to a float1 - float2 < X
or similar.
This results in:
While in 6.8 (ruby execution) resulted in:
The current workaround is to rely on
mutate { convert { "field1" => "float" }}
to ensure both sides are floating point.