Trusted answers to developer questions

Harris Amjad

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

The ** math.isinf() function** in Python returns

`True`

if the value is `infinite`

; otherwise, it returns `False`

. In other words, this function is used to check if the number is infinite or not.Figure 1 shows the visual representation of the `math.isinf()`

function.

The

`math`

module is required to use this function.

```
math.isinf(number)
```

This function requires the number as a parameter.

This function returns `True`

if the value is `infinite`

; otherwise, it returns `False`

.

The following example shows how to use `math.isinf()`

in Python.

import math#numberprint ("math.isinf(4):", math.isinf(4))print ("math.isinf(3.5):", math.isinf(3.5))print ("math.isinf(-2.6):", math.isinf(-2.6))print ("math.isinf(0):", math.isinf(0))#nanprint ("math.isinf(nan):", math.isinf(float("nan")))#infinityprint ("math.isinf(inf):", math.isinf(float("inf")))print ("math.isinf(-inf):", math.isinf(float("-inf")))

RELATED TAGS

python

math

infinity

communitycreator

CONTRIBUTOR

Harris Amjad

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring

Related Courses