in reply to Math::round not rounding correctly
When the number is actually 3461.49999999999999382 it should be rounded to 3461 but might be displayed as simply "3461.5".
Edit 1 in response to at least the second "edit" labeled "Edit 2" above (for sanity's sake, please stop changing the root of this conversation):
perl -e 'print sprintf("%.20f",(3010*1.15))."\n"' # Outputs 3461.49999 +999999950000000
QED. (Now, maybe you'll go read and try to understand the stuff about floating point that was linked to quite a while ago?)
- tye
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Math::round not rounding correctly (simple)
by bulrush (Scribe) on Dec 23, 2014 at 20:17 UTC | |
by tye (Sage) on Dec 23, 2014 at 20:33 UTC |