Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: perl numeric expressions

by monkey_boy (Priest)
on Nov 28, 2005 at 13:23 UTC ( #512165=note: print w/ replies, xml ) Need Help??


in reply to perl numeric expressions

Use a fixed number of decimal places on your comparrison

if (sprintf("%.1f", $x1) == sprintf("%.1f",$x2)) { print "SAME\n"; } else { print "NOT SAME\n"; }

for more help see this tutorial



This is not a Signature...


Comment on Re: perl numeric expressions
Select or Download Code
Replies are listed 'Best First'.
Re^2: perl numeric expressions
by deckard (Initiate) on Nov 28, 2005 at 13:34 UTC
    Thanks!

    I, of course, knew, about FAQ mentioned by merlyn. I just thought it does not apply in this situation.

    Anyway thanks for example and tutorial.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2015-07-31 06:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (274 votes), past polls