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 |
In Section
Seekers of Perl Wisdom