pierce314159
pierce314159

Reputation: 21

Why does numpy floor_divide with infinity differ from true_divide

numpy's floor division seems counterintuitive when dealing with np.inf. I feel like the answer should be same as true division in these examples

>>> -7 // np.inf
-1.0

>>> -7 / np.inf
-0.0

>>> np.inf // 7
nan

>>> np.inf / 7
inf

In my head, an integer divided by infinity should approach 0 and infinity divided by any integer should remain +/- infinity. Can anyone provide some insight here? Thanks!

I am running version 1.22.2 in case that's relevant

Upvotes: 2

Views: 111

Answers (0)

Related Questions