From: "Telemachus" <[email protected]>
On Fri Jul 17 2009 @ 3:18, Octavian Rasnita wrote:
From: "Shawn H. Corey" <[email protected]>
Octavian Rasnita wrote:
Well, in PHP that calculation is made well, so I think there is a bug
in perl.
No, it's not. PHP rounds off the number before printing. In Perl:
printf "%.2f", $x;
or
$x = sprintf "%.2f", $x;
Ok, thank you all for your help.
I think that this is the politest blow-off I've ever seen. Well done.
:-)
Well, it is not a blow-off, but just a way to thank the responders because I
found the answer to my issue by using sprintf() or by doing the
multiplication then the division, and to also think in the future if it
would be a good idea to store the numbers multiplied as integers.
Octavian
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/