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
Is it parsing incorrectly or choosing a different representation when printing? 2.99 and 2.9899999999999998 have the same floating point representation. The floating to decimal logic was rewritten in #24612. cc @lifthrasiir
@sfackler No, they have different floating point representations:
2.989999999999999769073610877967439591884613037109375 = 0x4007 eb85 1eb8 51eb
2.9899999999999998 (rounds down, also the shortest repr of above)
2.99 (rounds up, also the shortest repr of below)
2.9900000000000002131628207280300557613372802734375 = 0x4007 eb85 1eb8 51ec
This is very slight, but 2.99 should round up (absolute error of 2.13e-16 for up vs. 2.31e-16 for down) while it doesn't seem so. I believe this is more like #24557. cc @rprichard
str::parse("2.99")
correctly parses to2.99
in stable branch, but less correctly to2.9899999999999998
on both beta and nightly.The text was updated successfully, but these errors were encountered: