[EMAIL PROTECTED] said:
> Can someone help me with retaining the precisions when they are zero?
>
> ie -
>
> $f = 9.00
> $z = $f;
> print $z; #result in 9 - bad I want 9.00
>
> $fx = 9.25
> $z = $fx;
> print $z; #result in 9.25 - good
>
> I can but don't want to use a sub like itoa.
Why not? Se
try the sprintf
print sprint("%.02f", $f);
if I'm not rong;
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 14, 2003 10:18 AM
To: [EMAIL PROTECTED]
Subject: help float to string
Can someone help me with retaining the preci
Can someone help me with retaining the precisions when they are zero?
ie -
$f = 9.00
$z = $f;
print $z; #result in 9 - bad I want 9.00
$fx = 9.25
$z = $fx;
print $z; #result in 9.25 - good
I can but don't want to use a sub like itoa. Is there a better way to
convert to string?
$z=itoa($f);
pri