RE: [PHP] RE: round()
| From: | Instruct ICC | Date: | Fri, 12 Oct 2007 02:30:16 +0000 |
| Subject: | RE: [PHP] RE: round() | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263129@lists.php.net to get a copy of this message | ||
> well,
> seems to be OS dependent:
>
> PHP_OS:Linux (Suse 9.x 32bit) | PHP_VERSION:5.0.3
> $t=1.255;
> round($t,2):1.26
> $t += .00000001;
> round($t,2):1.26
> ____
>
> PHP_OS:WINNT (2000) | PHP_VERSION:5.2.4
> $t=1.255;
> round($t,2):1.25
>
> $t += .00000001;
> round($t,2):1.26
>
> --
> View this message in context:
> http://www.nabble.com/round%28%29-tf4602528..html#a13164737
> Sent from the PHP - General mailing list archive at Nabble.com.
First, you may have to be aware of floating point precision on your platform.
http://php.he.net/manual/en/language.types.float.php
"The size of a float is platform-dependent"
What is $t after $t += .00000001; ?
Now I see why BCMath was mentioned.
_________________________________________________________________
Windows Live Hotmail and Microsoft Office Outlook – together at last. Get it now.
http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033