This is how I coded from examples on the Internet. Everything using floating point variables.
Data:
Latitude 1 (LATCPZ): 41.320612
Longitude 1 (LNGCPZ): -81.363520
Latitude 2 (LATCSE): 39.6263358
Longitude 2 (LNGCSE): -84.1956464
Code Example:
D ACos PR 8F ExtProc('acos')
D ACRadians 8F Const
D Cos PR 8F ExtProc('cos')
D CRadians 8F Const
D Sin PR 8F ExtProc('sin')
D SRadians 8F Const
D RLat1 S 8f
D RLat2 S 8f
D RLng1 S 8f
D RLng2 S 8f
D a S 8f
D b S 8f
D c S 8f
c Eval RLat1 = LatCpZ/57.2958
c Eval RLng1 = LngCpZ/57.2958
c Eval RLat2 = LatCSe/57.2958
c Eval RLng2 = LngCSe/57.2958
* Calculate distance between locations and convert to miles
c Eval a = ACos((Sin(RLat1)*Sin(RLat2
c (Cos(RLat1)*Cos(RLat2)*Cos
c Eval b = a * 6371.01
c Eval c = b * .62137
Expected Result: 188.9 miles
Actual Result: 3.1067 miles





by: Gary_The_IT_ProPosted on 2009-11-05 at 22:40:41ID: 25757073
Please post a code sample and actual and expected results.
- Gary Patterson