in reply to Rounding a number using (s)printf
This is a mathematical rule of rounding of numbers: if digit before last visible digit is greater than 5 last digit is increased by 1, otherwise the digit saves its value.
So, 0.256 ~ 0.26, 0.255 ~ 0.25, 0.254 ~ 0.25. This is correct results.
---
Michael Stepanov aka nite_man
It's only my opinion and it doesn't have pretensions of absoluteness!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Rounding a number using (s)printf
by Anonymous Monk on Jan 20, 2005 at 10:02 UTC |