Home » Julia

NaN Constant in Julia

Julia | NaN/Nan64 Constant: In this tutorial, we are going to learn about the NaN and Nan64 constants with examples in Julia programming language.
Submitted by IncludeHelp, on April 02, 2020

Julia | NaN/Nan64 Constant

Nan / Nan64 is a constant of the Float64 type in Julia programming language, it represents "not-a-number" value.

Syntax:

    NaN
    NaN64

Example:

In this example, we are taking two variables x and y and assigning them with NaN and NaN64. We are printing the values and types of x and y using println() function and typeof() function. We are also comparing the NaN and NaN64.

# Julia example of NaN and NaN64 x = NaN y = NaN64 println("x: ", x) println("y: ", y) println("typeof(x): ", typeof(x)) println("typeof(y): ", typeof(y)) # checking whether NaN and NaN64 are same println("NaN==NaN: ", NaN==NaN64)

Output

x: NaN
y: NaN
typeof(x): Float64
typeof(y): Float64
NaN==NaN: false

Reference: Julia constants

Advertisement
Advertisement


Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.