liveBook · Manning

Nan

Also called not a number

NaN is a special floating-point value representing an undefined or unrepresentable numerical result.

How 10 Manning books explain it

Pandas Workout: 200 exercises to make you a stronger data analyst

NaN is a floating-point marker representing a missing or undefined numeric value in pandas and NumPy.

How it is used
Handles incomplete observations during pandas cleaning, counting, filtering, replacement, and interpolation.
How deep it goes
Defines NaN’s float behavior and works through counting, dropping, filling, interpolation, and dtype conversion without floating-point internals.
Examples
Uses product sales gaps, taxi records, parking violations, temperature outages, string extraction, and survey responses.
What you can do after
Apply it via pandas to count, remove, replace, interpolate, and type-convert missing data deliberately.

Read how Pandas Workout: 200 exercises to make you a stronger data analyst explains nan →

Rust in Action: Systems programming concepts and techniques

Not a number is a floating-point special value representing an undefined or unrepresentable numeric result.

How it is used
Uses NaN to explain unusual floating-point comparisons and defensive checks for invalid results.
How deep it goes
Explains propagation, self-comparison, and special exponent bits, but leaves special-value decoding out of the mantissa implementation.
Examples
Uses a negative square root, zero divided by zero, a failed self-comparison, and an infinity assertion.
What you can do after
Diagnose/debug with Rust’s is_nan() and is_finite() checks to stop near invalid or nonfinite results.

Read how Rust in Action: Systems programming concepts and techniques explains nan →

Clojure: The Essential Reference

NaN is a floating-point value representing an undefined or unrepresentable numeric result and having special comparison behavior.

How it is used
Flags undefined floating-point results and exposes edge cases in numeric extrema, equality, comparison, and sorting.
How deep it goes
Defines the value and works through arithmetic and comparison results, without descending into its bit representation.
Examples
Shows undefined arithmetic yielding NaN, self-comparison returning false, extrema propagating NaN, and differing sort results.
What you can do after
Diagnose/debug with it when NaN changes an extrema calculation or makes comparison-based sorting unreliable.

Read how Clojure: The Essential Reference explains nan →

100 Java Mistakes and How to Avoid Them

NaN is a special floating-point value representing an undefined or unrepresentable numeric result and that is unequal to every value, including itself.

How it is used
Explains how Java floating-point comparisons and ordering fail when NaN values are ignored.
How deep it goes
Defines NaN, demonstrates comparison failures, and prescribes validation and library-based ordering without deriving floating-point internals.
Examples
Uses self-comparison, three-way branching, manual Comparable ordering, Double.compare, assertions, and NaN-rejecting constructors.
What you can do after
Diagnose NaN comparison bugs, validate inputs, and implement floating-point ordering with standard library methods.

Read how 100 Java Mistakes and How to Avoid Them explains nan →

Essential TypeScript 5, Third Edition

NaN is the special JavaScript numeric value representing an undefined or unrepresentable numerical result.

How it is used
Identifies failed numeric results when function arguments are omitted or do not match a function’s numeric assumption.
How deep it goes
Explains NaN through function outputs and shows ways to prevent or filter it, without examining numeric internals.
Examples
Uses price summation in index.js and tax calculation in index.ts to contrast valid numbers, concatenated strings, and NaN.
What you can do after
Diagnose/debug NaN results from missing or nonnumeric arguments and apply default values or conversion checks where appropriate.

Read how Essential TypeScript 5, Third Edition explains nan →

Statistics Every Programmer Needs

NaN is a special floating-point value representing a numerical result that is undefined or cannot be represented as a valid number.

How it is used
Cleans numerical play-by-play data before analysis or model fitting.
How deep it goes
Defines NaN, demonstrates contextual replacement, and warns that imputation can distort predictions.
Examples
Uses NFL play-by-play yards, timeouts, zero-yard plays, and pandas fillna(0).
What you can do after
Apply it via pandas by imputing NaN values when the domain justifies the replacement.

Read how Statistics Every Programmer Needs explains nan →

JavaScript in Depth

A special JavaScript numeric value representing an undefined or unrepresentable floating-point result.

How it is used
Diagnoses silent sorting failures and arithmetic bugs caused by JavaScript’s implicit numeric coercion.
How deep it goes
Explains comparator behavior, conversion chains, and performance consequences through worked examples, without detailing numeric internals.
Examples
Uses timestamp sorting, ISO date-time strings, array conversion, and payment arithmetic to expose NaN-producing paths.
What you can do after
Diagnose NaN-producing coercions and prevent them with explicit type checks or a type-safe variant such as TypeScript.

Read how JavaScript in Depth explains nan →

100 Go Mistakes and How to Avoid Them

NaN is the IEEE-754 floating-point value representing an undefined or unrepresentable numerical result.

How it is used
Diagnoses undefined or unrepresentable results in floating-point calculations and supplies a predicate for detecting them.
How deep it goes
Defines NaN, demonstrates its construction, and gives its IEEE-754 comparison property and math.IsNaN detection.
Examples
Uses zero-valued float64 division to produce positive infinity, negative infinity, and NaN.
What you can do after
Diagnose floating-point results with math.IsNaN and recognize why equality testing cannot identify NaN.

Read how 100 Go Mistakes and How to Avoid Them explains nan →

Machine Learning System Design

NaN is a floating-point value representing an undefined or unrepresentable numerical result.

How it is used
Uses NaN as a warning signal when interpreting loss curves and debugging unstable training.
How deep it goes
Explains diagnostic causes and practical remedies, but does not derive floating-point behavior or implementation details.
Examples
Illustrates NaN through loss explosions, division by zero, invalid logarithms, and NaNs already present in data.
What you can do after
Diagnose unstable training by checking gradients, numerical operations, learning rate, initialization, and preprocessing.

Read how Machine Learning System Design explains nan →

Grokking Machine Learning

NaN is a special marker representing a value that is missing, undefined, or not representable as a numeric value.

How it is used
Uses NaN detection to prepare messy tabular data before fitting machine-learning models.
How deep it goes
Defines NaN, counts missing entries, and demonstrates dropping columns or filling values, without discussing numeric representation internals.
Examples
Uses Titanic Cabin, Age, and Embarked columns to demonstrate inspection, removal, median filling, and categorical filling.
What you can do after
Diagnose missing entries with isna() and choose whether to drop a feature or replace its NaN values.

Read how Grokking Machine Learning explains nan →

Also covered in

What to know first

Related concepts

Questions about nan

What is nan?

NaN is a special floating-point value representing an undefined or unrepresentable numerical result.

Which Manning books explain nan?

Pandas Workout: 200 exercises to make you a stronger data analyst, Rust in Action: Systems programming concepts and techniques, Clojure: The Essential Reference, 100 Java Mistakes and How to Avoid Them, Essential TypeScript 5, Third Edition, Statistics Every Programmer Needs, JavaScript in Depth, 100 Go Mistakes and How to Avoid Them and 2 more.

What should I know before learning nan?

Manning books that teach nan usually introduce floating-point arithmetic, data frame, float64 and gradient first.

What is the difference between nan and 8-bit signed integer?

NaN is a special floating-point value representing an undefined or unrepresentable numerical result. An 8-bit signed integer is a fixed-width integer representation of whole numbers from −128 through 127.

What is nan also called?

Nan is also called not a number.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.