Box the compass: Difference between revisions

→‎{{header|Python}}: Modulo already handles the negatives.
(→‎{{header|Python}}: Modulo already handles the negatives.)
Line 29:
def degrees2compasspoint(d):
d = (d % 360) + 360/64
if d < 0:
d += 360
majorindex, minor = divmod(d, 90.)
majorindex = int(majorindex)
Anonymous user