liveBook · Manning

Floating-point arithmetic

Floating-point arithmetic is numerical computation using finite-precision representations of real numbers, which can introduce rounding and range errors.

How 21 Manning books explain it

Modern C, Third Edition

A floating-point value is a finite-precision numerical value represented by a sign, an exponent, and a sequence of significand bits.

How it is used
Explains floating-point values and computation as C’s finite-precision approximations to real and complex numbers.
How deep it goes
Develops a simplified sign–exponent–significand model, type limits, literals, formatted output, and floating-point environment constraints.
Examples
Uses decimal and hexadecimal literals, a three-bit significand calculation, and a distance function calling `sqrt`.
What you can do after
Evaluate/understand floating-point limits and apply C literals, output formats, and environment constraints with attention to portability.

Read how Modern C, Third Edition explains floating-point arithmetic →

JavaScript in Depth

An arithmetic operation performed using floating-point numeric representations.

How it is used
Explains surprising JavaScript arithmetic results and guides precision-sensitive comparisons and numeric-type choices.
How deep it goes
Works through Binary64 fields, approximated decimal fractions, exponent alignment, and rounding, then distinguishes V8 storage optimizations.
Examples
Uses `0.1 + 0.2 === 0.3`, binary significand addition, tolerance functions, and V8-oriented price-array benchmarks.
What you can do after
Diagnose/debug with it when decimal-looking sums differ, select approximate comparisons, and recognize when large integers need `BigInt`.

Read how JavaScript in Depth explains floating-point arithmetic →

Get Programming: Learn to code with Python

A floating-point number is a Python object representing a decimal value using floating-point numeric representation.

How it is used
Uses floats to explain numeric types, arithmetic results, and a minutes-to-hours conversion.
How deep it goes
Works through conversions and arithmetic, then explains decimal approximation through its effect on a calculation without detailing storage internals.
Examples
Shows mixed-type arithmetic, conversion checks, and a 123-minute calculation whose decimal result needs rounding.
What you can do after
Practice/perform numeric conversions, predict arithmetic result types, and round a float-based minute calculation when needed.

Read how Get Programming: Learn to code with Python explains floating-point arithmetic →

Rust in Action: Systems programming concepts and techniques

A floating-point type represents real-number values using a finite-precision binary format with sign, exponent, and significand components.

How it is used
Connects Rust numeric operations to bit-level representation and compact storage for limited-range model values.
How deep it goes
Explains floating-point fields and comparison hazards, then extracts, decodes, and reconstructs an f32 value.
Examples
Uses 0.1 plus 0.2, NaN from a square root, and a field-by-field reconstruction of 42.42.
What you can do after
Evaluate floating-point comparison hazards and inspect an f32 value’s fields using Rust.

Read how Rust in Action: Systems programming concepts and techniques explains floating-point arithmetic →

Modern C

A floating-point value is a value represented approximately by a sign, a significand, and a power-of-two exponent.

How it is used
Introduces floating-point arithmetic as C's approximate counterpart to real and complex numbers.
How deep it goes
Explains a simplified sign, exponent, and mantissa model, its type-dependent limits, and the consequences of cutting off digits.
Examples
Works through −0.15625 from a sign, exponent, and mantissa bits, and illustrates output formatting with `%20.10g`.
What you can do after
Evaluate and understand representable values, implementation limits, and approximate floating-point results.

Read how Modern C explains floating-point arithmetic →

Python How-To

A floating-point number is a numeric representation for values that may contain a fractional component and use finite precision.

How it is used
Uses floats to convert, compare, and display numeric input in Python programs.
How deep it goes
Explains casting, conversion errors, and formatting through examples, without detailing floating-point representation or arithmetic internals.
Examples
Uses a temperature-input challenge and a casting function that reports invalid strings.
What you can do after
Apply it via Python's float constructor and f-strings to process and format numeric input.

Read how Python How-To explains floating-point arithmetic →

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

Floating-point arithmetic performs numerical calculations using finite-precision representations that can produce small rounding discrepancies.

How it is used
Diagnoses tiny discrepancies in pandas averages and guides decisions about rounding or greater numeric precision.
How deep it goes
Compares default 64-bit and 128-bit representations, including precision, memory, method compatibility, and portability trade-offs.
Examples
Uses taxi-fare averages, sorting-derived subsets, visible decimal discrepancies, and a 128-bit dtype experiment.
What you can do after
Diagnose small numerical differences, round readable results, and evaluate whether higher precision justifies its costs.

Read how Pandas Workout: 200 exercises to make you a stronger data analyst explains floating-point arithmetic →

The Quick Python Book, Fourth Edition

A floating-point number is a numeric value represented using a finite-precision floating-point format.

How it is used
Uses floats for Python arithmetic and for converting numeric input and spreadsheet cell strings.
How deep it goes
Explains literals, arithmetic, conversions, and errors with examples, while describing precision only in terms of the underlying machine.
Examples
Demonstrates division, scientific notation, numeric input, and spreadsheet cell conversion.
What you can do after
Apply it via Python’s float() and arithmetic operators to convert values and perform calculations.

Read how The Quick Python Book, Fourth Edition explains floating-point arithmetic →

Deep Learning with PyTorch, Second Edition

Numeric values represented approximately in binary floating-point form, used here as the tensor element type for loaded data.

How it is used
Represents real-world inputs, learned intermediate features, and neural-network outputs as numeric tensor values.
How deep it goes
Defines floating-point representations and compares common precisions, but does not develop floating-point arithmetic internals.
Examples
Uses image pixels, learned edges and textures, image structures, and numerical table columns as concrete representations.
What you can do after
Understand how PyTorch encodes data and selects float32, float16, or float64 for neural-network computation.

Read how Deep Learning with PyTorch, Second Edition explains floating-point arithmetic →

The Well-Grounded Rubyist, Fourth Edition

Float is Ruby's built-in class for representing finite-precision floating-point numeric values.

How it is used
Uses Float values to obtain fractional arithmetic results and represent individual numeric measurements.
How deep it goes
Explains Float as an object, demonstrates arithmetic and rounding, and covers permissive versus strict conversion without detailing representation internals.
Examples
Demonstrates fractional arithmetic, rounding 99.6, string conversion, and Celsius-to-Fahrenheit temperature conversion.
What you can do after
Apply it via Ruby expressions that preserve fractional results, convert input, round values, and calculate temperatures.

Read how The Well-Grounded Rubyist, Fourth Edition explains floating-point arithmetic →

100 C++ Mistakes and How to Avoid Them

A floating-point value is a numeric representation that approximates a real number using a finite-precision significand and exponent.

How it is used
Explains approximate numeric values to show why equality comparisons can fail and how to compare them more safely.
How deep it goes
Explains limited precision and demonstrates delta-epsilon comparison, without developing floating-point representation internals.
Examples
Shows `100.0 / 3` compared with a decimal literal and a `Rational` value converted to `double`.
What you can do after
Apply the delta-epsilon method to compare floating-point values and make numeric conversions explicit.

Read how 100 C++ Mistakes and How to Avoid Them explains floating-point arithmetic →

Python Workout, Second Edition

float is Python's built-in constructor and conversion function for creating floating-point number objects.

How it is used
Deploys floats for fractional measurements, averages, rates, user input, and calculations integrated with other data types.
How deep it goes
Explains types, conversions, accumulation, and inexact representation, then defers exact decimal behavior to Decimal.
Examples
Uses running-time averages, fractional slicing, Decimal sums, and rainfall values entered through input.
What you can do after
Apply it via Python's float constructor to convert numeric input, accumulate fractional values, and calculate averages.

Read how Python Workout, Second Edition explains floating-point arithmetic →

Julia as a Second Language

A floating-point number is a finite-precision numerical representation that stores a sign, significant digits, and an exponent to approximate real values.

How it is used
Uses floating-point calculations to introduce Julia as a calculator and foundation for numerical computing.
How deep it goes
Explains type sizes, literals, conversions, division, and rounding through REPL examples, without detailing floating-point representation internals.
Examples
Demonstrates Float32 literals, mixed Float16 and Float32 addition, integer quotients, remainders, and rounding.
What you can do after
Apply it via Julia to choose floating-point types, perform division, and round results to floating-point or integer values.

Read how Julia as a Second Language explains floating-point arithmetic →

Python Workout: 50 ten-minute exercises

A floating-point value is a numeric value represented using a finite-precision significand and exponent, allowing fractional values and a wide magnitude range.

How it is used
Supports fractional measurements, averages, reports, indexes, counts, and financial-rate calculations in Python programs.
How deep it goes
Explains conversion, accumulation, formatting, and representation error, but stops short of floating-point internals.
Examples
Uses run-time averages, invalid-input handling, 0.1 plus 0.7, formatted output, integer cents, and Decimal sums.
What you can do after
Apply it via Python's float conversion, averaging, validation, and f-string formatting while recognizing when precision alternatives are needed.

Read how Python Workout: 50 ten-minute exercises explains floating-point arithmetic →

100 Java Mistakes and How to Avoid Them

A floating-point number is a numerical value represented with a significand and an exponent, allowing fractional values and a wide range of magnitudes with finite precision.

How it is used
Uses floating-point arithmetic to discuss Java numeric mistakes involving precision, signed zero, widening, and division.
How deep it goes
Explains concrete failure modes and prevention rules, but stops short of a general floating-point representation treatment.
Examples
Uses signed-zero multiplication, boxed equality, set contents, integer widening, and integer division snippets.
What you can do after
Diagnose precision loss and signed-zero surprises, then select explicit conversions, normalization, or higher-precision types.

Read how 100 Java Mistakes and How to Avoid Them explains floating-point arithmetic →

Clojure: The Essential Reference

Floating-point arithmetic is numerical computation using finite-precision representations with a significand and exponent.

How it is used
Supports mixed-type numeric comparison and warns when approximate arithmetic is unsuitable for currency.
How deep it goes
Explains binary precision, visible rounding propagation, and representation choices, but does not derive floating-point internals.
Examples
Uses 0.1, repeated addition, mixed numeric equality, and cross-market order prices.
What you can do after
Apply it via Clojure’s == and choose BigDecimal when computations require explicit precision.

Read how Clojure: The Essential Reference explains floating-point arithmetic →

Learn Go with Pocket-Sized Projects

A floating-point number is a numeric value represented using a finite significand and an exponent, allowing a wide range of magnitudes with limited precision.

How it is used
Uses floating-point arithmetic for numeric computations while warning against treating results as exact values.
How deep it goes
Explains IEEE-754 representation, decimal precision, rounding examples, magnitude loss, tolerance comparisons, and bounded-value validation.
Examples
Demonstrates float32 rounding, lost currency subtraction, sin(π), tolerance checking, and bounded currency amounts.
What you can do after
Diagnose precision loss in Go and compare computed values with tolerances instead of exact equality.

Read how Learn Go with Pocket-Sized Projects explains floating-point arithmetic →

Math for Web Design

A floating-point number is a finite-precision numerical value represented with a significand and an exponent, allowing fractional quantities and a wide range of magnitudes.

How it is used
Explains numerical behavior behind JavaScript calculations used for layout, animation, alignment, snapping, and pricing interfaces.
How deep it goes
Explains IEEE 754 storage, repeating binary fractions, rounding, safe integer limits, and tolerance checks without pursuing floating-point internals further.
Examples
Uses 0.1 + 0.2, unsafe integer increments, EPSILON comparisons, UI alignment, animation timing, and visual snapping.
What you can do after
Diagnose precision-sensitive UI calculations and apply rounding, formatting, safe-integer checks, or EPSILON-based comparisons.

Read how Math for Web Design explains floating-point arithmetic →

100 Go Mistakes and How to Avoid Them

A floating-point number is a finite-precision representation of a real value that uses a significand and exponent and may approximate real arithmetic.

How it is used
Diagnoses surprising results when Go programs perform fractional calculations with finite-precision numeric types.
How deep it goes
Explains approximation, IEEE-754 fields, and accumulation effects, but stops short of fully explaining decimal conversion.
Examples
Uses 1.0001 multiplication, float32 representation, and differently ordered accumulation loops.
What you can do after
Evaluate floating-point results while accounting for approximation, representation limits, and operation order.

Read how 100 Go Mistakes and How to Avoid Them explains floating-point arithmetic →

Functional Design and Architecture: Examples in Haskell

A floating-point data type represents approximate real-number values using a finite-precision fractional representation.

How it is used
Warns against using floating-point fields as relational database primary keys.
How deep it goes
Explains rounding-related equality pitfalls with a comparison, but does not detail representation internals.
Examples
Compares 0.1 + 0.1 with 0.2 and 0.1 + 0.2 with 0.3.
What you can do after
Evaluate whether floating-point fields suit primary keys, and consider a surrogate key when exact values are uncertain.

Read how Functional Design and Architecture: Examples in Haskell explains floating-point arithmetic →

PostgreSQL Mistakes and How to Avoid Them

A floating-point data type stores approximate real-number values using finite binary or decimal precision.

How it is used
Warns against using approximate numeric types for currency and against careless data-type mappings during migrations.
How deep it goes
Explains approximation and rounding consequences with SQL results, but stops short of floating-point representation internals.
Examples
Uses percentage multiplication, a money-column calculation, and cross-database type mappings to expose precision problems.
What you can do after
Evaluate monetary schemas and migration mappings, then choose NUMERIC or DECIMAL when exact amounts are required.

Read how PostgreSQL Mistakes and How to Avoid Them explains floating-point arithmetic →

Also covered in

What to know first

Related concepts

Questions about floating-point arithmetic

What is floating-point arithmetic?

Floating-point arithmetic is numerical computation using finite-precision representations of real numbers, which can introduce rounding and range errors.

Which Manning books explain floating-point arithmetic?

Modern C, Third Edition, JavaScript in Depth, Get Programming: Learn to code with Python, Rust in Action: Systems programming concepts and techniques, Modern C, Python How-To, Pandas Workout: 200 exercises to make you a stronger data analyst, The Quick Python Book, Fourth Edition and 13 more.

What should I know before learning floating-point arithmetic?

Manning books that teach floating-point arithmetic usually introduce float64, integer, Python and IEEE 754 first.

What is the difference between floating-point arithmetic and integer?

Floating-point arithmetic is numerical computation using finite-precision representations of real numbers, which can introduce rounding and range errors. An integer is a whole-number mathematical value, including negative numbers, zero, and positive numbers, with no fractional part.

What kinds of floating-point arithmetic are there?

Kinds of floating-point arithmetic include float64 and FP32.

What is floating-point arithmetic a kind of?

Floating-point arithmetic is a kind of number type. A numeric type is a type whose values represent numbers with a defined representation and support numerical operations.

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.