Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: fastest way to compare numerical strings?

by grep (Monsignor)
on Jun 30, 2008 at 18:12 UTC ( #694797=note: print w/ replies, xml ) Need Help??


in reply to fastest way to compare numerical strings?

Just a quick note:

The take the abs value of the difference between the 2 numbers, check if that is greater than .01. That should read cleaner and get rid of most of those checks.

Also as a favor for the people trying to read your code - pick a style of indenting.

#untested for ($n=0;$n<=$#lat;$n++) { for ($v=0;$v<=$#lat;$v++) { if ( abs( $lat[$n] - $lat[$v] ) < .01 and abs( $long[$n] - $l +ong[$v] ) < .01 ) { ##OTHER CODE } } }
Update: fixed typo and minor edit
grep
One dead unjugged rabbit fish later...


Comment on Re: fastest way to compare numerical strings?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2014-12-22 09:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (113 votes), past polls