Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

So Python has positive and negative infinity:

float("inf"), float("-inf")

This just seems like the type of feature that has to have some caveat. Is there anything I should be aware of?

1 Answer

0 votes
by (106k points)

You can still get not-a-number (NaN) values from simple arithmetic involving inf:

>>> 0 * float("inf")

nan

Related questions

0 votes
1 answer
asked Sep 10, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
asked Oct 15, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...