Re: Automatically rounding numbers?

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

 



On Wed, October 18, 2006 9:58 am, Tijnema ! wrote:
> How can i disable the automatically rounding of numbers, as i work
> with
> large numbers and when i make them small again, it seems that the last
> digits are gone.
> example:
> 12345678901234567890
> becomes:
> 1.2345678901234E+19 = 12345678901234000000
>
> Is there a way to disable this??

Sort of.

You have not just one, but TWO options:
http://php.net/gmp (newer, sexier, nicer)
http://php.net/bc  (older, bound to be installed everywhere)

You have to change all your code to use the functions instead of your
normal operators + - * / etc.

These are going to be slower than the normal operators.  GMP is
"smart" and uses normal math for "small" numbers, if I'm reading the
docs correctly.

I would presume that in some cases, with large sets of data already
using specialized database types, it would make more sense to just do
ALL the arithmetic, no matter how trivial, in the DB.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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