Programming Search⌘K

Conceptcore

NaN and infinity

Also called NaN, not a number, infinity, inf, quiet NaN, signaling NaN, signalling NaN, negative zero, signed zero.

IEEE 754 floats have values that are not ordinary numbers: two infinities, two zeros and many NaNs. A NaN is not equal to itself, which breaks equality tests, sorting and lookups.

Applies to
core-languages

Idea

Some float operations have no number as their result. 0/0 has no value, and 1e308 * 10 is too large for a double. A program could stop at such a step. IEEE 754 instead gives the result a special value, and the computation goes on.1

import math

big = 1e308
print("1e308 * 10:", big * 10)
print("inf - inf:", math.inf - math.inf)
print("inf * 0:", math.inf * 0)

nan = float("nan")
print("nan == nan:", nan == nan)
print("nan != nan:", nan != nan)
print("3 < nan or nan < 3:", 3 < nan or nan < 3)
print("-0.0 == 0.0:", -0.0 == 0.0)
print("copysign(1, -0.0):", math.copysign(1, -0.0))
Output
1e308 * 10: inf
inf - inf: nan
inf * 0: nan
nan == nan: False
nan != nan: True
3 < nan or nan < 3: False
-0.0 == 0.0: True
copysign(1, -0.0): -1.0

There are three kinds of special values.

  • Infinity. A result too large for the format becomes plus or minus infinity. Infinity takes part in arithmetic: 1/inf is 0.1
  • NaN. NaN, short for not a number, is the result of an operation with no defined value. Every comparison with a NaN is false, except !=.2
  • Signed zero. There are two zeros, +0 and -0. They compare equal, but they can give different results in some operations.3

How it works

The bits

In a binary format, an exponent field of all ones marks the special values. A fraction of zero means infinity, and any other fraction means NaN.4 So there is one positive infinity, one negative infinity, and many NaNs. In most processors, the top bit of the fraction tells a quiet NaN from a signaling NaN, and "The remaining bits encode a payload".4 Zero has an exponent field and a fraction of all zeros, and "Negative zero has the sign bit set to one."3

Operations that give NaN

The NaN article lists three kinds of operations that return NaN: most operations with a NaN operand, the indeterminate forms, and real operations with complex results.4 The indeterminate forms include 0/0, inf/inf, 0 * inf, inf - inf, and the remainder x mod y when x is infinite or y is zero.4 A quiet NaN goes through each later step, which "allows errors to be detected at the end of a sequence of operations without extensive testing during intermediate stages".4

Quiet and signaling NaN

"Quiet NaNs are used to propagate errors resulting from invalid operations or values."4 A signaling NaN raises the invalid operation exception when most operations use it, and then becomes a quiet NaN.4 One proposed use is to fill memory that is not yet initialized with signaling NaNs, so that a read of it raises the exception.4

Comparisons

The relations <, <=, ==, >= and > "return false on an unordered relation", that is, when one operand is a NaN.4 So NOT(x < y) and x >= y differ when x or y is a NaN.4 A NaN is not equal to itself. Python's reference: "A counter-intuitive implication is that not-a-number values are not equal to themselves."2 The usual test for NaN is therefore x != x, though each language also has a named function such as isnan.

Signed zero and infinity

IEEE 754 "requires both +0 and −0".3 The two zeros compare equal, but 1/+0 is +inf and 1/-0 is -inf.3 The sign of zero keeps the direction from which a value reached zero, for example when a negative number underflows.3 Goldberg shows that infinity arithmetic can remove a test: 1/(x + 1/x) gives the correct value 0 at x = 0 because 1/0 is infinity.1

In languages

LanguageVerdictNote
PythonNative
C++Native
JavaNative
CNative
C#Native
JavaScriptNative
TypeScriptNativeTypeScript numbers are JavaScript numbers, with NaN, Infinity and -0, and Number.isNaN. No example file exists.
GoNative
RustNative
KotlinNativeKotlin Double has Double.NaN, Double.POSITIVE_INFINITY and isNaN(), and the boxed Double follows the equals rules of the JVM. No example file exists because kotlinc is not installed.
SQLNativePostgreSQL accepts 'NaN', 'Infinity' and '-Infinity' in its float types and in numeric, and it sorts NaN above all other values. No example file exists.
BashAbsentBash arithmetic expansion has integers only, so there is no NaN and no infinity, and a division by zero is an error. No example file exists.
PowerShellNativePowerShell [double] is System.Double, with [double]::NaN, [double]::PositiveInfinity and [double]::IsNaN. No example file exists because pwsh is not installed.
HTMLDoes not applyHTML has no arithmetic.
CSSNativeCSS has the constants infinity, -infinity and NaN inside calc(), and calc() follows the IEEE 754 rules for them, so 0 / 0 gives NaN. No example file exists.
Regular expressionsDoes not applyA pattern matches text and does no arithmetic.
Language Verdict Form
Python native math.inf, math.nan, math.isnan, math.isinf, math.copysign
JavaScript native NaN, Infinity, Number.isNaN, Object.is
TypeScript native as JavaScript
Java native Double.NaN, Double.POSITIVE_INFINITY, Double.isNaN, Double.compare
C native NAN, INFINITY, isnan, isinf, signbit in <math.h>
C++ native std::numeric_limits<double>::quiet_NaN(), infinity(), std::isnan
C# native double.NaN, double.PositiveInfinity, double.IsNaN
Go native math.NaN(), math.Inf(1), math.IsNaN, math.Signbit
Rust native f64::NAN, f64::INFINITY, is_nan, total_cmp
Kotlin native Double.NaN, Double.POSITIVE_INFINITY, isNaN()
PowerShell native [double]::NaN, [double]::PositiveInfinity
Bash absent integer arithmetic only
SQL native PostgreSQL real, double precision and numeric accept 'NaN' and 'Infinity'; NULL marks a missing value
Regex n/a no arithmetic
HTML n/a no arithmetic
CSS native the constants infinity, -infinity and NaN inside calc()

The IEEE rules are the same in every language with floats. The differences are in the equality of the containers and the sort functions.

  • JavaScript has one NaN value in the language. With ==, !=, === and !==, NaN "compares unequal" to every value, "including to another NaN value".5 indexOf "cannot find NaN", but includes can.5 Object.is differs from === only "in their treatment of signed zeros and NaN values".6
  • Java keeps the IEEE rules for == and <. Double.equals and Double.compare define Double.NaN "to be equal to itself and greater than all other double values", and they put -0.0 below 0.0.7 This "allows NaN to be used as an element of a HashSet or as the key of a HashMap".7
  • Python tests membership in a list, a set or a dict as any(x is e or x == e for e in y).2 The same NaN object is found, because x is e is true. A different NaN object is not.
  • Rust gives f64 only PartialOrd. total_cmp gives "an ordering in accordance to the totalOrder predicate" of IEEE 754-2008.8
  • Go defines min and max on floats so that "if any argument is a NaN, the result is a NaN", and negative zero is smaller than zero.9
  • C and C++ give isnan, isinf and signbit. GCC's -ffinite-math-only allows optimizations that "assume that arguments and results are not NaNs or +-Infs", so a test for NaN may not work under it.10
  • CSS has the constants infinity, -infinity and NaN in calc(), and MDN says that the arguments follow "the IEEE-754 standard for floating point math". In CSS too, 0 / 0 and infinity - infinity give NaN.11
  • SQL in PostgreSQL has NaN and Infinity in its float types and in numeric. "In order to allow floating-point values to be sorted and used in tree-based indexes, PostgreSQL treats NaN values as equal, and greater than all non-NaN values."12
PythonGitHub
import json
import math

nan = float("nan")
other = float("nan")
print("isnan:", math.isnan(nan), "isinf:", math.isinf(-math.inf))

values = [3.0, nan, 1.0, 2.0]
print("sorted:", sorted(values))
print("max(1.0, nan):", max(1.0, nan), "max(nan, 1.0):", max(nan, 1.0))

print("same object in list:", nan in [nan], "new NaN in list:", other in [nan])
d = {nan: "a"}
d[other] = "b"
print("dict size after two NaN keys:", len(d))

print("json.dumps:", json.dumps([nan, math.inf]))
try:
    json.dumps(nan, allow_nan=False)
except ValueError as e:
    print("allow_nan=False:", e)
print("-0.0:", -0.0, "sign:", math.copysign(1.0, -0.0))
Output
isnan: True isinf: True
sorted: [3.0, nan, 1.0, 2.0]
max(1.0, nan): 1.0 max(nan, 1.0): nan
same object in list: True new NaN in list: False
dict size after two NaN keys: 2
json.dumps: [NaN, Infinity]
allow_nan=False: Out of range float values are not JSON compliant: nan
-0.0: -0.0 sign: -1.0
  • Verdict: native. Python float has inf, nan and -0.0, with tests in math.
  • sorted returns the list out of order, because every comparison with the NaN is false.
  • max keeps its first argument when the comparison is false, so the place of the NaN changes the result.
  • A dict finds a key by identity first, so the same NaN object is found, but a new NaN becomes a second key.
#include <algorithm>
#include <cmath>
#include <iostream>
#include <limits>
#include <set>
#include <vector>

int main() {
    const double nan = std::numeric_limits<double>::quiet_NaN();
    const double inf = std::numeric_limits<double>::infinity();
    std::cout << std::boolalpha;
    std::cout << "nan == nan: " << (nan == nan) << ", isnan: " << std::isnan(nan) << '\n';
    std::cout << "has signaling NaN: " << std::numeric_limits<double>::has_signaling_NaN << '\n';
    std::cout << "inf * 0: " << inf * 0 << '\n';

    std::vector<double> values{3.0, 1.0, 2.0};
    values.insert(values.begin() + 1, nan);
    auto max_it = std::max_element(values.begin(), values.end());
    std::cout << "max_element: " << *max_it << '\n';

    std::set<double> s{nan, 1.0, 2.0};
    std::cout << "set count(1.0): " << s.count(1.0) << ", size: " << s.size() << '\n';

    std::vector<double> no_nan;
    std::copy_if(values.begin(), values.end(), std::back_inserter(no_nan), [](double x) { return !std::isnan(x); });
    std::sort(no_nan.begin(), no_nan.end());
    std::cout << "sorted without NaN:";
    for (double x : no_nan) {
        std::cout << ' ' << x;
    }
    std::cout << '\n';
}
Output
nan == nan: false, isnan: true
has signaling NaN: true
inf * 0: -nan
max_element: 3
set count(1.0): 1, size: 1
sorted without NaN: 1 2 3
  • Verdict: native. C++ double has the IEEE special values through std::numeric_limits.
  • std::set orders with <. A NaN is "equivalent" to every value under <, so the set sees 1.0 and 2.0 as duplicates of the NaN and keeps one element, the NaN. For the same reason, count(1.0) returns 1, although 1.0 is not in the set.
  • The safe way is to remove the NaNs before a sort or a std::set.
JavaGitHub
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class Main {
  public static void main(String[] args) {
    double nan = Double.NaN;
    System.out.println("nan == nan: " + (nan == nan));
    System.out.println("Double.isNaN: " + Double.isNaN(0.0 / 0.0));
    System.out.println("1.0 / 0: " + (1.0 / 0) + ", 1.0 / -0.0: " + (1.0 / -0.0));
    System.out.println("Double.equals(NaN, NaN): " + Double.valueOf(nan).equals(nan));
    System.out.println("0.0 == -0.0: " + (0.0 == -0.0) + ", equals: " + Double.valueOf(0.0).equals(-0.0));

    Double[] boxed = {3.0, nan, 1.0, -0.0, 0.0};
    Arrays.sort(boxed);
    System.out.println("sorted Double[]: " + Arrays.toString(boxed));

    Set<Double> set = new HashSet<>();
    set.add(nan);
    set.add(0.0 / 0.0);
    System.out.println("set size: " + set.size() + ", contains NaN: " + set.contains(Double.NaN));
    System.out.println("Math.max(1.0, NaN): " + Math.max(1.0, nan));
    try {
      int i = 1 / 0;
      System.out.println(i);
    } catch (ArithmeticException e) {
      System.out.println("int 1 / 0: " + e.getMessage());
    }
  }
}
Output
nan == nan: false
Double.isNaN: true
1.0 / 0: Infinity, 1.0 / -0.0: -Infinity
Double.equals(NaN, NaN): true
0.0 == -0.0: true, equals: false
sorted Double[]: [-0.0, 0.0, 1.0, 3.0, NaN]
set size: 1, contains NaN: true
Math.max(1.0, NaN): NaN
int 1 / 0: / by zero
  • Verdict: native. Java double follows IEEE 754 for == and <.
  • Double.equals and Double.compare treat NaN as equal to itself and put -0.0 before 0.0, so a sort of Double[] puts NaN last and a HashSet finds it.
  • Integer division by zero throws ArithmeticException, because int has no infinity.
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

/* A total order for qsort: a NaN comes after every number. */
static int cmp_double(const void *a, const void *b) {
    double x = *(const double *)a;
    double y = *(const double *)b;
    if (isnan(x) || isnan(y)) {
        return (isnan(x) != 0) - (isnan(y) != 0);
    }
    return (x > y) - (x < y);
}

int main(void) {
    double nan = NAN;
    double inf = INFINITY;
    printf("nan == nan: %s, isnan: %s\n", nan == nan ? "yes" : "no", isnan(nan) ? "yes" : "no");
    printf("inf - inf: %f, 1 / -inf: %f\n", inf - inf, 1.0 / -inf);
    printf("signbit(-0.0): %s, -0.0 == 0.0: %s\n", signbit(-0.0) ? "yes" : "no", -0.0 == 0.0 ? "yes" : "no");
    printf("fmax(1, NaN): %g\n", fmax(1.0, nan));

    double values[] = {3.0, nan, 1.0, 2.0, 0.5};
    qsort(values, 5, sizeof values[0], cmp_double);
    printf("qsort:");
    for (int i = 0; i < 5; i++) {
        printf(" %g", values[i]);
    }
    printf("\n");
    return 0;
}
Output
nan == nan: no, isnan: yes
inf - inf: -nan, 1 / -inf: -0.000000
signbit(-0.0): yes, -0.0 == 0.0: yes
fmax(1, NaN): 1
qsort: 0.5 1 2 3 nan
  • Verdict: native. C double has NAN, INFINITY and the tests isnan, isinf and signbit in <math.h>.
  • qsort needs a comparator that gives a total order. A comparator with only < and > returns 0 for every pair with a NaN, which says that the NaN equals each number. That is not a total order, and the result of the sort is then not defined. The comparator here tests for a NaN first and puts it last.
  • fmax returns the number when the other argument is a NaN.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Globalization;

CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
double nan = double.NaN;
Console.WriteLine($"nan == nan: {nan == nan}");
Console.WriteLine($"nan.Equals(nan): {nan.Equals(nan)}");
Console.WriteLine($"double.IsNaN(0.0 / 0.0): {double.IsNaN(0.0 / 0.0)}");
Console.WriteLine($"1.0 / 0.0: {1.0 / 0.0}, -1.0 / 0.0: {-1.0 / 0.0}");
Console.WriteLine($"IsNegative(-0.0): {double.IsNegative(-0.0)}");

double[] values = { 3.0, nan, 1.0, 2.0 };
Array.Sort(values);
Console.WriteLine($"Array.Sort: {string.Join(", ", values)}");

var set = new HashSet<double> { nan, 0.0 / 0.0 };
Console.WriteLine($"HashSet size: {set.Count}");
Console.WriteLine($"Math.Max(1.0, NaN): {Math.Max(1.0, nan)}");
Console.WriteLine($"Max of list: {new[] { 1.0, nan, 2.0 }.Max()}");
Output
nan == nan: False
nan.Equals(nan): True
double.IsNaN(0.0 / 0.0): True
1.0 / 0.0: Infinity, -1.0 / 0.0: -Infinity
IsNegative(-0.0): True
Array.Sort: NaN, 1, 2, 3
HashSet size: 1
Math.Max(1.0, NaN): NaN
Max of list: 2
  • Verdict: native. C# double follows IEEE 754 for ==.
  • Equals and CompareTo treat NaN as equal to itself and smaller than every number, so Array.Sort puts NaN first and a HashSet keeps one NaN.
  • Math.Max returns NaN, but the LINQ Max of a list skips it here, so two maximum functions give two answers.
JavaScriptGitHub
const values = [3, NaN, 1, 2];
console.log(`NaN === NaN: ${NaN === NaN}`);
console.log(`Number.isNaN(NaN): ${Number.isNaN(NaN)}`);
console.log(`isNaN("abc"): ${isNaN("abc")}, Number.isNaN("abc"): ${Number.isNaN("abc")}`);
console.log(`indexOf(NaN): ${values.indexOf(NaN)}, includes(NaN): ${values.includes(NaN)}`);

const set = new Set([NaN, NaN, 0, -0]);
console.log(`Set size: ${set.size}`);
console.log(`Object.is(NaN, NaN): ${Object.is(NaN, NaN)}, Object.is(0, -0): ${Object.is(0, -0)}`);
console.log(`1 / -0: ${1 / -0}`);
console.log(`Math.max(1, NaN): ${Math.max(1, NaN)}`);
console.log(`JSON: ${JSON.stringify([NaN, Infinity, -0])}`);
console.log(`sorted: ${[...values].sort((a, b) => a - b)}`);
Output
NaN === NaN: false
Number.isNaN(NaN): true
isNaN("abc"): true, Number.isNaN("abc"): false
indexOf(NaN): -1, includes(NaN): true
Set size: 2
Object.is(NaN, NaN): true, Object.is(0, -0): false
1 / -0: -Infinity
Math.max(1, NaN): NaN
JSON: [null,null,0]
sorted: 3,NaN,1,2
  • Verdict: native. JavaScript numbers are binary64, with NaN, Infinity and -0.
  • The global isNaN converts its argument first, so a string that is not a number gives true. Number.isNaN does not convert.
  • Set and includes use the SameValueZero rule, so they find NaN and treat 0 and -0 as one value.
  • The comparator a - b returns NaN for the NaN element, and the sort leaves the array out of order.
package main

import (
	"fmt"
	"math"
	"slices"
	"sort"
)

func main() {
	nan := math.NaN()
	fmt.Println("nan == nan:", nan == nan, "IsNaN:", math.IsNaN(nan))
	zero := 0.0
	fmt.Println("1/0:", 1/zero, "-1/0:", -1/zero, "0/0:", zero/zero)
	negZero := math.Copysign(0, -1)
	fmt.Println("-0 == 0:", negZero == 0, "Signbit:", math.Signbit(negZero))

	m := map[float64]string{}
	m[nan] = "a"
	m[nan] = "b"
	_, found := m[nan]
	fmt.Println("map size:", len(m), "found:", found)
	delete(m, nan)
	fmt.Println("after delete:", len(m))
	clear(m)
	fmt.Println("after clear:", len(m))

	values := []float64{3, nan, 1, 2}
	sort.Float64s(values)
	fmt.Println("sort.Float64s:", values)
	fmt.Println("min(1, NaN):", min(1.0, nan), "slices.Max:", slices.Max([]float64{1, nan, 2}))
}
Output
nan == nan: false IsNaN: true
1/0: +Inf -1/0: -Inf 0/0: NaN
-0 == 0: true Signbit: true
map size: 2 found: false
after delete: 2
after clear: 0
sort.Float64s: [NaN 1 2 3]
min(1, NaN): NaN slices.Max: NaN
  • Verdict: native. Go float64 follows IEEE 754.
  • Each NaN key is a new entry in a map, and no lookup finds it. delete with a NaN key removes nothing, but clear removes all entries.
  • sort.Float64s puts NaN values first. The built-in min and slices.Max return NaN when a NaN is present.
RustGitHub
use std::collections::HashSet;

fn main() {
    let nan = f64::NAN;
    println!("nan == nan: {}, is_nan: {}", nan == nan, nan.is_nan());
    println!("1/0: {}, -1/0: {}", 1.0_f64 / 0.0, -1.0_f64 / 0.0);
    println!("-0.0 == 0.0: {}, is_sign_negative: {}", -0.0_f64 == 0.0, (-0.0_f64).is_sign_negative());

    let mut values = vec![3.0, nan, 1.0, -0.0, 0.0];
    values.sort_by(|a, b| a.total_cmp(b));
    println!("total_cmp sort: {:?}", values);
    println!("max(1, NaN): {}", 1.0_f64.max(nan));

    let zero: f64 = "0".parse().unwrap();
    let computed = zero / zero;
    let bits: HashSet<u64> = [nan, computed].iter().map(|x| x.to_bits()).collect();
    println!("f64::NAN bits: {:016x}, 0/0 bits: {:016x}", nan.to_bits(), computed.to_bits());
    println!("distinct NaN bit patterns: {}", bits.len());
    let n: i32 = "0".parse().unwrap();
    println!("checked 1 / 0: {:?}", 1_i32.checked_div(n));
}
Output
nan == nan: false, is_nan: true
1/0: inf, -1/0: -inf
-0.0 == 0.0: true, is_sign_negative: true
total_cmp sort: [-0.0, 0.0, 1.0, 3.0, NaN]
max(1, NaN): 1
f64::NAN bits: 7ff8000000000000, 0/0 bits: fff8000000000000
distinct NaN bit patterns: 2
checked 1 / 0: None
  • Verdict: native. Rust f64 has NAN, INFINITY and -0.0, and PartialOrd but not Ord.
  • Vec<f64> has no sort, because f64 is not Ord. sort_by with total_cmp gives the IEEE total order.
  • f64::max returns the other argument when one argument is a NaN.
  • f64 is not Hash, so the set holds the bit patterns from to_bits. The NaN that the processor computes can have a different sign bit from the constant.
  • NaN-boxing. A NaN has many unused payload bits. Some systems keep other data in them, a trick called NaN-boxing.4
  • Canonical NaN. Some systems produce one NaN value only. JavaScript treats all NaNs as the same value.4
  • Integer division by zero. Integers have no infinity and no NaN. An integer 1/0 is an error, an exception or undefined behaviour (Integer division and modulo).
  • Signed zero in integers. Ones' complement and sign-magnitude integers also have a negative zero (Ones' complement and sign-magnitude).3

Pitfalls

A test with == for NaN

x == float("nan") is always false. Use the named test, such as math.isnan(x) or Number.isNaN(x).

Sorting a list with NaN

A sort assumes that the comparison is a total order. With a NaN, a < b and b < a are both false for every b, so the sort can stop with the list out of order. Remove the NaNs first, or sort with a total order such as Java's Double.compare or Rust's total_cmp. The Python example shows a sorted list that is not in order.

NaN keys in maps and sets

A hash table finds a key with ==. A NaN key is not equal to itself, so a lookup with a new NaN finds nothing, and each NaN can be a new key. Python finds the same NaN object through its identity test, but not an equal-looking new one.2

min and max with NaN

The result depends on the function. Go's min gives NaN.9 The Python example shows that max can give a different result when the NaN moves. The IEEE 754-2008 functions minNum and maxNum return the number when only one operand is NaN, and IEEE 754-2019 replaced them because they "are not associative" when a signaling NaN appears.4

NaN and infinity in JSON

JSON has no NaN and no infinity. RFC 8259: "Numeric values that cannot be represented in the grammar below (such as Infinity and NaN) are not permitted."13 Python's json.dump writes NaN and Infinity by default, unless allow_nan is false, and then it raises ValueError "in strict compliance with the JSON specification".14 JavaScript's JSON.stringify writes null for them.15 A NaN can therefore leave one program and fail in the next one.

A lost minus sign

A negative number that underflows or rounds to zero can become -0.0, and a report can then show -0.00. x == 0 is true for both zeros, so a test for the sign needs signbit or copysign.3

Cost

  • Checks. A program that must not output NaN needs a check at its boundary, because a NaN does not stop the computation.
  • Fast-math. GCC does not turn on -ffinite-math-only at any -O level except -Ofast, because it "can result in incorrect output for programs that depend on an exact implementation of IEEE or ISO rules".10

History

  • Before 1985. The CDC 6600 had bit patterns for the special quantities INDEFINITE and INFINITY. Goldberg traces the idea of the IEEE special values to it.1
  • 1985. "Systematic use of NaNs was introduced by the IEEE 754 floating-point standard in 1985", together with the infinities.4
  • 2008. IEEE 754-2008 defined the totalOrder predicate, which Rust's total_cmp follows.8
  • 2019. IEEE 754-2019 replaced minNum and maxNum, and it reserved the top bit of the fraction to tell quiet NaN from signaling NaN.4

References

  1. David Goldberg, What Every Computer Scientist Should Know About Floating-Point Arithmetic, ACM Computing Surveys 23(1), March 1991 (edited reprint by Sun Microsystems), the section Special Quantities, and Infinity
  2. The Python Language Reference, 6. Expressions, Python Software Foundation, 6.10.1 Value comparisons, and 6.10.2 Membership test operations
  3. Signed zero, Wikipedia, the lead, and Representations
  4. NaN, Wikipedia, the lead, Floating point, Comparison with NaN, Operations generating NaN, Signaling NaN, Encoding, and Canonical NaN
  5. NaN, MDN Web Docs, Description, and Examples (Testing against NaN)
  6. Object.is(), MDN Web Docs, Description
  7. Double (Java SE 27 and JDK 27), Oracle, the class description (Floating-point Equality, Equivalence, and Comparison), and Double.compare
  8. Primitive Type f64, The Rust Project, the method total_cmp
  9. The Go Programming Language Specification, The Go Authors, Min and max
  10. GCC Manual, Options That Control Optimization, Free Software Foundation, -ffinite-math-only
  11. <calc-keyword>, MDN Web Docs, Values, and Notes
  12. PostgreSQL Documentation, 8.1. Numeric Types, The PostgreSQL Global Development Group, 8.1.2 Arbitrary Precision Numbers, and 8.1.3 Floating-Point Types
  13. RFC 8259, The JavaScript Object Notation (JSON) Data Interchange Format, IETF, section 6, Numbers
  14. json, JSON encoder and decoder, Python Software Foundation, json.dump, the parameter allow_nan
  15. JSON.stringify(), MDN Web Docs, Description

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/Z584G7/text.yaml