in reply to Rounding a number using (s)printf
It don't think it has anything to do with how the numbers are represented in floating point. I think what you're seeing is a result of sprintf() following IEEE rounding semantics. It's something like even least significant digits round up at the half-way mark and odd round down at the half-way mark.
Search google for IEEE rounding semantics and I'm sure you'll find a better reference than I.
Update: doh! There's even a mention in perldoc -q round
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Rounding a number using (s)printf
by Anonymous Monk on Jan 20, 2005 at 09:55 UTC | |
|
Re^2: Rounding a number using (s)printf
by ysth (Canon) on Jan 20, 2005 at 22:45 UTC |