micropython-samples icon indicating copy to clipboard operation
micropython-samples copied to clipboard

SUN_MOON - NORTH POLE

Open sgbmzm opened this issue 11 months ago • 1 comments

When the geographic location is latitude 90, i.e. the North Pole, I usually get an error:

line 57, in quad
ZeroDivisionError: divide by zero

The problem is in this line:

xe = -b / (2 * a)

In the file

sun_moon.py

This problem occurs in the MicroPython controller and does not occur on a regular computer

sgbmzm avatar Feb 16 '25 20:02 sgbmzm

Solved by adding the code:

if a == 0:  
      return 0, 0, 0, 0

Before the line:

xe = -b / (2 * a)

in quad function in sun_moon

But I'm not sure this is the right solution.

sgbmzm avatar Feb 24 '25 19:02 sgbmzm