Python cmath.nanj Constant



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.

Syntax

Following is the basic syntax of the cmath.nanj Constant −

cmath.nanj

Return Value

This Constant returns the complex NaN value.

Example 1

Below example illustrates the usage of the cmath.nanj constant.

import cmath
value = cmath.nanj
print(value)

Output

The output obtained is as follows −

nanj

Example 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)  #div

Output

When we run the above code, it produces the following result −

(2+nanj)
(-4+nanj)
(nan+nanj)
(nan+nanj)
python_modules.htm
Advertisements
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy