Hi folks...
I've been lurking around here for a while... reading and learning. I am getting my feet under me so to speak but I am a bit confused with some results I am seeing when using the REM function.
Example: an angle in the format DD.MMSSsss converted to decimal degrees.
(defun g (dms / tmp)
(setq tmp (rem dms 0.01))
(+
(fix dms)
(/ (- (rem dms 1.0) tmp) 0.6)
(/ tmp 0.36)
)
)
(g 1) gives 1.0 (good)
(g 31.01) gives 31.01666... (yeah!)
Now if I have a quadrant bearing in the format QDD.MMSSsss I figured I should be able to knock the quadrant Q off using REM:
(g (rem 131.01 100.0)) gives 31.02777... !!! this is not right !!!
this look to me like the (rem 131.01 100.0) must be returning 31.014, however,
(rtos (rem 131.01 100.0) 2 9) gives "31.01" which is what I expected.
Well, now I feel a bit dense. Am I doing something obvious wrong, like completely misusing REM?
Thanks.
Greg