On 1/3/06, David Newman [EMAIL PROTECTED] wrote:
One quick fix here is to use printf instead:
printf \n\%02f = %02f, $result, $result;
I believe you were doing this to round off money numbers: numbers
with exactly two digits after the decimal point. To do that, you need
a slightly different
Hello,
Here's my problem. I have the following lines coded in my perl program:
$result = 1.00 - 9991.05;
print \n\$result = $result;
The result that is being printed is 8.950073 instead of 8.95.
Can someone please tell me why perl acts this way. I am beginning to doubt
[EMAIL PROTECTED] schreef:
printed is 8.950073
instead of 8.95.
perldoc -q numbers
--
Affijn, Ruud
Gewoon is een tijger.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
Also check out 'perldoc perlnumber'.
-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Dr.Ruud
Sent: Tuesday, January 03, 2006 5:30 PM
To: beginners@perl.org
Subject: Re: Basic Math Problem
[EMAIL PROTECTED] schreef:
printed is 8.950073
instead of 8.95
03, 2006 5:47 PM
To: 'Dr.Ruud'; beginners@perl.org
Subject: RE: Re: Basic Math Problem
Also check out 'perldoc perlnumber'.
-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Dr.Ruud
Sent: Tuesday, January 03, 2006 5:30 PM
To: beginners@perl.org
Subject: Re: Basic Math
On Tue, 3 Jan 2006, [EMAIL PROTECTED] wrote:
$result = 1.00 - 9991.05;
print \n\$result = $result;
The result that is being printed is 8.950073 instead of 8.95.
Can someone please tell me why perl acts this way. I am beginning to doubt
perl's basic math capabilities.
perl
On Tue, 3 Jan 2006, Tom Phoenix wrote:
On 1/3/06, David Newman [EMAIL PROTECTED] wrote:
One quick fix here is to use printf instead:
printf \n\%02f = %02f, $result, $result;
I believe you were doing this to round off money numbers: numbers
with exactly two digits after the decimal point.