Closed dhable closed 1 week ago
Thanks @dhable, I will take a look. Need to think a bit about the breaking behavior of this change.
I think the proposed (breaking) change makes sense. See playground examples. We can make the check even stricter by using is_normal.
We ran into an issue where parsing a string with
to_float
exceeds the bounds off64::MAX
, which returns a non-error infinity value.Since
err
wasnull
, it's might seem like it's safe to perform operations on this value but subtraction causes vector to panic and crash. This is becausef64::INFINITY - f64::INFINITY == f64::NAN
in rust.I can't find anything in the VRL language, besides using
to_string
to compare with "inf", that would allow me to detect this situation and avoid operations on infinite values. IMHO, I would have expected an error result instead of infinity, similar to howto_int
behaves.