Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
This?

DB<54> $b=3.1565323 DB<55> $a=3.1566789 DB<56> p abs(1e5*($b-$a)) <1 DB<57> p abs(1e5*($b-$a)) 14.660000000033 DB<58>

of course you could avoid the multiplication by providing an accurate threshold smaller than 1.

It'll become more complicated with two coordinates, than I'd say Pythagoras is accurate enough°

edit

Pythagoras sqr( d_x ** 2 + d_y ** 2 ) with d_ for delta= abs(c0-c1)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

°) even for spherical coordinates of that size (but don't use this for the distance between New York and Seattle, you might fall off the edge of the world)


In reply to Re: Check whether two numbers are within a range by LanX
in thread Check whether two numbers are within a range by stevieb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-03-28 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found