You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to add tests for the overflow behaviour of from_str and discovered a problem:
assert_eq!(Decimal::from_str("99999_99999_99999_99999_99999_99999.99999"),// it returns Ok(100000_00000_00000_00000_00000_000) nowErr(Error::from("Invalid decimal: overflow from too many digits")));
chris-cantor
changed the title
from_str round integer when overflow before the decimal pointfrom_str rounding issues when overflow from too many digits
Dec 30, 2021
I am trying to add tests for the overflow behaviour of
from_str
and discovered a problem:https://github.com/cantortrading/rust-decimal/runs/4657432688?check_suite_focus=true#step:9:87
It seems that the function is trying to round the input, such that 999,000 could be rounded to 1000,000 which is off by a lot.
What is the intended behaviour here? May be we should not attempt rounding before the decimal point?
The text was updated successfully, but these errors were encountered: