Hi all,

I ran into an odd edge-case with np.mod and was wondering if this is the 
expected behavior, and if so why. This is on a fresh install of python 3.10.14 
with numpy 1.26.4 from conda-forge.

>>> import numpy as np

# I have a hard time coming up with a rationale for why 2 of these produce 
non-inf values and the other 2 produce inf values.
>>> np.mod(1., np.inf)
1.0
>>> np.mod(1., -np.inf)
-inf
>>> np.mod(-1., -np.inf)
-1.0
>>> np.mod(-1., np.inf)
inf

# these are possibly sensible although the signed zero pattern is unexpected to 
me.
>>> np.mod(0., np.inf)
0.0
>>> np.mod(0., -np.inf)
-0.0
>>> np.mod(-0., -np.inf)
-0.0
>>> np.mod(-0., np.inf)
0.0

Any ideas why these are the return values? I had a hard time tracking down 
where in the numpy source np.mod was coming from.
Jesse
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to