Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: Strange (rounding?) problem

by Eureka_sg (Monk)
on May 02, 2001 at 14:30 UTC ( [id://77281]=note: print w/replies, xml ) Need Help??


in reply to Re: Strange (rounding?) problem
in thread Strange (rounding?) problem

I believe what you are trying to say is:

print "The numbers $foo and $bar are significant different!" if (abs($foo - $bar) >= (10**-10));

Note the difference in the equality sign. : )

Replies are listed 'Best First'.
Re: Re: Re: Strange (rounding?) problem
by iakobski (Pilgrim) on May 02, 2001 at 14:48 UTC
    The problem with this is that you have to know a priori what the range of your numbers is.

    suppose $foo = 1e-11 and $bar = 2e-11 your method will say they are not significantly different.

    Suppose $foo = 1.1e54 and $bar = 1.1e54 then you would want to say that they are not different, but it is quite possible that a stray bit would cause your method to say that they are different.

    iakobski

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://77281]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 14:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found