On Mon, 2005-12-05 at 11:48 -0800, [EMAIL PROTECTED] wrote:

> I am performing some basic arithmetic on some variables and then using
> a numeric equality operator to see if it returns what I think it should
> by.
> I am printing out the results and sure enough it is as expected. My
> problem is when I use the numeric equality operator it returns false
> even though my print statement showed that it should be true. The
> string equality operator works(does return true) but I am curious what
> is going on that is preventing the numeric version to work.

>     my $var_1   = 596181.10112 ;
>     my $var_2   = 600;
>     my $var_3     = 715793.0585;
>     my $var_4  = -99.7375378599037;
>     my $var_5 = 200;
>     my $var_6 = 3;

Floating point math is difficult and fraught with peril:

        <http://www.petebecker.com/js200006.html>

How much accuracy do you need?  Test for that instead of complete
equality.

-- c

Reply via email to