Jump to content

Why 0.01 shows as 0? help


ivytony

Recommended Posts

You might want to through the bc manuals on the php.net website, i think it might be like bcmul() or something.

 

should work something like this:

<?php

echo bcmul('100', '0.01', 3); // should return 1, the three will let it go to 3 decimal places

?>

thanks for the replies.

 

When I use $rate = 0.01 for an if statement, I got false results. For example

 

$rate = 0.01;

 

if ($rate > 0) {

do A;

}

else {

do B

}

 

The running result for this if statement is: do B. But my $rate is 0.01 which is greater than 0, right??

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.