Establishing precision of a number..
Posted: Sun Feb 26, 2006 1:33 pm
I'm not sure how to tackle this and i've searched through the php functions.
I'm trying to get a number displayed to the nearest 2 decial places so 0.01.
Now, most of the time the trailing digits are zeros, so i tried round($number,2) that didnt work...
and i also tried floor but that didnt do anything either. I tried casting the type to float, and still no effect,
and i also searched and tried round($number/0.01)*0.01 with no effect, i'm guessing the 0's are causing some issues here, is there a way to set the precision of a number? Thank you!
I'm trying to get a number displayed to the nearest 2 decial places so 0.01.
Now, most of the time the trailing digits are zeros, so i tried round($number,2) that didnt work...
and i also tried floor but that didnt do anything either. I tried casting the type to float, and still no effect,
and i also searched and tried round($number/0.01)*0.01 with no effect, i'm guessing the 0's are causing some issues here, is there a way to set the precision of a number? Thank you!