You should be able to do this with subtraction/addition. I would not use this as a drop dead accurate approach, but for a simple comparison this should be accurate enough.
The easiest is if you have the 'Signed degrees' format (41.2500) From here you have a range of -180 to 180 - but each is a decimal format value. It is a little trickier than just simple subtraction, but not as difficult as others may think.
Making the Calculation
Here’s where your math is put to test. If both
locations are on the same side of the equator, then you must deduct
the smaller figure from the larger. If they are on opposite sides of
the equator, then you must add the two figures together. Forget about
any minus signs that you may see -- they just signify that the figure
is the number of degrees to the south of the equator.
SET @Long = AttributeValue(yourLongitude)
SET @StoreLong = AttributeValue(yourStoreLong)
/* YOU MAY NEED TO CONVERT TO DECIMAL FORMAT IF STORED AS TEXT */
IF @Long > @StoreLong THEN
SET @First = @Long
SET @Second = @StoreLong
SET @First = @StoreLong
SET @Second = @Long
IF INDEXOF(@Long, "-") > 0 OR INDEXOF(@StoreLong, "-") > 0 THEN
SET @longDistance = ADD(@First, @Second)
SET @longDistance = SUBTRACT(@First, @Second)
The tricky part comes in if your Lat/Long is in any other format (something like: 41°25'01"N). You would then need to convert this into 'Signed degrees' format to utilize the above. (ref)
To convert the Latitude or Longitude to Map Coordinates (MC):
Step 1: Multiply (×) the "degrees" by 60
Step 2: Add (+) the "minutes"
Step 3: If the Latitude (Longitude) degrees are S (W) use a minus sign ("-") in front. This result is the Latitude (Longitude) converted to Minutes.
Latitude Map Coordinates:
Step 1: Degrees × 60 = 42 × 60 = 2520
Step 2: 2520 + 20.736 = 2540.736
Step 3: The Latitude is not "S" so the Latitude converted to Minutes
Longitude Map Coordinates:
Step 1: Degrees × 60 = 71 × 60 = 4260
Step 2: 4260 + 5.745 = 4265.745
Step 3: The Longitude is "W" so the answer is -4265.745