0

In general, 1/a = b ⟺ 1/b = a, so if we're letting the reciprocal of infinity be 0, the reciprocal of 0 should be infinity.

It seems strange for Python to use the limit for 1/inf but not for 1/0. What is the rationale behind this decision?

Zaz
  • 46,476
  • 14
  • 84
  • 101

2 Answers2

2

Because 1/0 can be either +inf (positive) or -inf (negative). 1/inf can only be 0.

shx2
  • 61,779
  • 13
  • 130
  • 153
0

Ahh, just after I posted this, I answered my own question:

It's because there's no way of knowing if the result should be +inf or -inf.

As an aside, the IEEE floating point standard does support positive and negative 0.

Zaz
  • 46,476
  • 14
  • 84
  • 101