rails/activemodel/test
Sean Griffin c7d3bd48df Apply scale before precision when coercing floats to decimal
Since precision is always larger than scale, it can actually change
rounding behavior. Given a precision of 5 and a scale of 3, when you
apply the precision of 5 to `1.25047`, the result is `1.2505`, which
when the scale is applied would be `1.251` instead of the expected
`1.250`.

This issue appears to only occur with floats, as scale doesn't apply to
other numeric types, and the bigdecimal constructor actually ignores
precision entirely when working with strings. There's no way we could
handle this for the "unknown object which responds to `to_d`" case, as
we can't assume an interface for applying the scale.

Fixes #24235
2016-03-24 16:09:19 -06:00
..
cases Apply scale before precision when coercing floats to decimal 2016-03-24 16:09:19 -06:00
models Remove XML Serialization from core. 2015-08-07 11:01:48 -04:00
validators This is not an executable file 2010-12-16 01:49:28 +05:30