|
Posted by Tim on 09/11/06 18:29
On 11 Sep 2006 01:33:07 -0700, wesley@ispace.co.za wrote...
>
>Hi all
>I have a floating point number stored in a variable. i want to round
>that number off to two places and store it in a variable. Does anyone
>know how to do that?
>I know that i can use the printf to display the number to 2 decimal
>places. but i want to store that number in a vaiable.
>Thanks Wes
>
You could use printf|sprintf and assign it to whatever variable you needed it
for. As an example, maybe...
$rounded_no = sprintf("%.2f", $fp_no);
Tim
--
Help a Community by Participating in Ours
We donate your subscription fees to the charity you choose
100% of your first month, 10% thereafter.
http://newsguy.com/charity.asp
Navigation:
[Reply to this message]
|