The Python cmath.nanj Constant returns a complex NaN (Not a Number). This value has 0 as real part, and NaN as the imaginary part. The nanj constant is equivalent to complex (0.0, float("nan")).
NaN is a floating-point value represented by the float('nan') object in Python.
SyntaxFollowing is the basic syntax of the cmath.nanj Constant −
cmath.nanjReturn Value
This Constant returns the complex NaN value.
Example 1Below example illustrates the usage of the cmath.nanj constant.
import cmath value = cmath.nanj print(value)Output
The output obtained is as follows −
nanjExample 2
Here, we are calculating arithmetic operations using the cmath.nanj constant.
import cmath print(cmath.nanj + 2) #add print(cmath.nanj - 4) #sub print(cmath.nanj ** 9) #pow print(cmath.nanj / 1000) #divOutput
When we run the above code, it produces the following result −
(2+nanj) (-4+nanj) (nan+nanj) (nan+nanj)
python_modules.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4