3.9e3 is equivalent to 3900 in the same way that 3,900 is equivalent to 3900.
So, Ruby’s number parsing is garbage I guess. Hopefully it at least does this properly for floats?
So, Ruby’s number parsing is garbage I guess. Hopefully it at least does this properly for floats?
"3.9e3".to_f => 3900.0
Something happens when submitting web based params. I'd be curious to see what other back end languages and frameworks do.
"3.9e3".to_i => 3
and
Integer("3.9e3")
raises "invalid value for Integer()". Really, nothing to see here. Ruby just doesn't treat "3.9e3" as a valid string for an integer (which arguably is correct IMHO)