liveBook · Manning

Precision

As explained in The Art of Code

Numerical precision is the degree of exactness with which a numeric value is represented or calculated.

Numerical precision is the degree of exactness preserved when values are represented or calculated. Choosing the right numeric type matters because a seemingly small mismatch can create later problems in correctness, performance, or memory use. section 2.4

Representing monetary values

Represent a price with BigDecimal rather than float when manipulating monetary values requires precision. The practical rule is simple: choose a numeric type whose behavior matches the exactness the domain demands. section 2.4

How The Art of Code covers it

How deep it goes
Defines precision through a type-choice example but does not explain floating-point representation or numerical error mechanics.
Examples
Contrasts representing a price with BigDecimal rather than float.
What you can do after
Evaluate numeric type choices against the precision requirements of a value’s domain.
How it connects
Connects precision to numeric types, BigDecimal, float, performance, memory usage, and concurrency.

Also explained in

Compare how 9 books explain precision →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Art of Code. The section links point to the parts of the book it draws on.