Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Check whether two numbers are within a range

by stevieb (Canon)
on Feb 26, 2021 at 16:56 UTC ( [id://11128848]=note: print w/replies, xml ) Need Help??


in reply to Re: Check whether two numbers are within a range
in thread Check whether two numbers are within a range

Thank you. This works well, regardless if the vehicle's actual location will be plus or minus the pre-determined coordinates I'll be comparing against.

Mock up:

use warnings; use strict; use feature 'say'; use constant { ACCURACY => 1e5, RANGE => 1.2, LON => -119.31665, }; my $lon_current = -119.31666; my $deviation = abs(ACCURACY * (LON - $lon_current)); say "Within range: $deviation" if $deviation < RANGE;

Replies are listed 'Best First'.
Re^3: Check whether two numbers are within a range
by LanX (Saint) on Feb 26, 2021 at 23:18 UTC
    I hope you are not only testing the longitude but also the latitude.

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-18 00:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found