Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: My floating point comparison does not work. Why ?

by hanspr (Sexton)
on Mar 31, 2012 at 20:24 UTC ( [id://962795]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    227.20
    1176.00
    ...
    0.00
    0.00
    0.00
    
  2. or download this
    7566.85
    
  3. or download this
    open (X,"< x.txt");
    while ($n = <X>) {
    ...
    
        return sprintf("%.${dp}g",$A) eq sprintf("%.${dp}g",$B);
    }
    
  4. or download this
    t  = 7566.85
    st = 7566.85
    Different
    
  5. or download this
    sub equal {
        my ($A,$B,$dp) = @_;
    ...
        }
        return sprintf("%.${dp}g",$A) eq sprintf("%.${dp}g",$B);
    }
    
  6. or download this
    t  = 7566.85
    st = 7566.85
    Equal
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-19 17:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found