Associate
- Joined
- 18 Oct 2002
- Posts
- 231
Whats the deal with PHP rounding?
I've tried 4.3.2 on a win2k IIS box and 4.4.2 on a win2k apache box, and seem to have strange results using round($x , 2):
27.115 goes to 27.12
27.125 goes to 27.13
125.245 goes to 125.25
125.244 goes to 125.24
37.535 goes to 37.53 <----- Errrr why?
It's not using bankers rounding, 5 is being treated as go up, but that last one is being odd.....bug?
Different version of PHP?
I've tried 4.3.2 on a win2k IIS box and 4.4.2 on a win2k apache box, and seem to have strange results using round($x , 2):
27.115 goes to 27.12
27.125 goes to 27.13
125.245 goes to 125.25
125.244 goes to 125.24
37.535 goes to 37.53 <----- Errrr why?
It's not using bankers rounding, 5 is being treated as go up, but that last one is being odd.....bug?
Different version of PHP?