RE: RE: round()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux