Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/sphstat/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,10 @@ def cot(x):
:return: Cotangent of the input
:rtype: float
"""
return 1/np.tan(x)

# By subtracting the smallest positive representable number (eps) from x,
# the expression ensures that x is not exactly a multiple of pi/2 and thus the tangent of x is defined.
return 1/np.tan(x - np.finfo(float).eps)


def poltoll(th: float, ph: float) -> tuple:
Expand Down