A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/python/python_cmath_nanj_constant.htm below:

Python cmath.nanj Constant

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


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