Click to See Complete Forum and Search --> : Precision numbers without bc


coppocks
12-16-2006, 09:08 PM
I've got an issue whereas a client server has an older version of PHP that does not have gmp or bc precision mathematics available.

I have a function that multiplies 2 values and returns the result to a read only text field.

Whereas I might need this result to be displayed: 7972.01

His server is displaying: 8

Normally I would do this...

$value = bcmul($amount, $rate, '10');

... to return necessary values like 7972.01 or 7972.012364 etc. However, his server is returning bcmul as an "undefined function" ... and this won't fly either:

$value = ($amount * $rate);

I have no code in there that performs any rounding operations what-so-ever. Any suggestion as to how to fix this?

bathurst_guy
12-17-2006, 12:36 AM
First things first, can you request the client to update PHP or upgrade server package?

coppocks
12-17-2006, 05:36 AM
I recommended it before I made this post. :)