... because floating point cannot exactly represent it.
At some point in my 40 years in IT I became aware that decimal fractions cannot all be represented exactly as binary fractions in floating point. But that there should be no problem with integers.
Which is why I thought that my "(...) Mod 360" should be OK because 360 is an integer.
I'm afraid I cannot now reproduce the problem. (I had already made it go away by tweaking the (...) expression.)
On the other hand my problem may, rather trivially, have been a result of rounding after the Mod 360. If the result was close to 360 within the representational limit (I only show bearings to one decimal digit, and that is really too fine) then it would be rounded up. Had I happened to see a value very close to 360 in the IDE then I might have twigged what was happening.
As it is, I should round to appropriate accuracy first, then test for rounding up to 360, and then just set the answer to zero! Testing for > 359.9 should give a similar effect, but could fall into the floating point problem that we have been discussing.
Mike.