-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
Francisco Zarabozo
Sent: 04 February 2011 17:26
To: [email protected]
Subject: Please, someone explain this behavior in Perl

> Hello All,
>
> Right now I'm using Active Perl 5.10.1. I've been working with Perl
for more 
> than 10 years. Yet, today is the first time I notice this wierd thing.
Maybe 
> I ignore something about how Perl's math works, yet it's driving me
crazy. I 
> can't believe this is the first time I notice this and makes me wonder
how 
> many applications I've written in the past that are actually doing
this 
> without me knowing about it. I'm talking about this:
>
>
> print 1.1 - 1; # Gives 0.1
> print "\n";
>
> print 2.1 - 2; # Gives 0.1
> print "\n";
>
> print 3.1 - 3; # Gives 0.1
> print "\n";
>
> print 4.1 - 4; # Gives 0.0999999999999996 ???
> print "\n";
>
> print 6.2 - 6; # Gives 0.2
> print "\n";
>
> print 7.2 - 7; # Gives 0.2
> print "\n";
>
> print 8.2 - 8; # Gives 0.199999999999999 ???
> print "\n";
>
>
> Why is this? Thanks in advance.
>

Sounds like a FAQ. See 'perldoc -q numbers'.

HTH


-- 
Brian Raven 
 
Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient or have received this e-mail in error, please advise 
the sender immediately by reply e-mail and delete this message and any 
attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to