A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Floating Point Representation

Graduate Depth 84 in the knowledge graph I know this Set as goal
13topics build on this
340prerequisites beneath it
See this on the map →
Machine Epsilon and Unit RoundoffRounding Errors and Error Propagation
floating-point representation computer-arithmetic

Core Idea

Floating point numbers are represented in computers using a fixed number of bits: a sign bit, an exponent, and a mantissa (fractional part). The IEEE 754 standard defines how these are encoded and how arithmetic operations are performed. This limited precision representation allows computers to store a wide range of values but introduces systematic errors in computation.

Explainer

Computers must represent real numbers using a finite string of bits, which immediately poses a problem: there are uncountably many real numbers and only finitely many bit patterns. Floating point is the engineering solution — instead of trying to represent all numbers, it represents a carefully chosen finite set that covers a wide range of magnitudes while maintaining consistent *relative* precision. The key insight is that scientific computation usually cares about significant digits rather than absolute position of the decimal point. A measurement of 6.022 × 1023 has four significant digits whether expressed as a large integer or not.

IEEE 754 double precision (the default in most languages) uses 64 bits: 1 sign bit, 11 exponent bits, and 52 mantissa bits. The number stored is (−1)s × 1.f × 2e−1023, where s is the sign, e is the stored exponent, and 1.f is the mantissa with an implicit leading 1 bit (since every normalized binary number starts with 1, this bit is free). The 52 mantissa bits give about 15–16 significant decimal digits of precision. The 11 exponent bits allow a range from roughly 10^−308 to 10308. This is the same idea as scientific notation in base 2: the exponent controls the scale, the mantissa controls the significant digits.

The critical consequence is that most real numbers cannot be represented exactly. Consider the decimal 0.1: in binary it is a repeating fraction 0.0001100110011..., so it gets truncated. This means that `0.1 + 0.2 ≠ 0.3` in floating point arithmetic — a famous surprise for beginners. The gap between any representable number and the next representable one (relative to the number's magnitude) is bounded by machine epsilon ε ≈ 2.22 × 10^−16. Every arithmetic operation introduces a rounding error of at most ε/2 relative error. Individually tiny, these errors can accumulate dramatically over many operations — a phenomenon you will study when analyzing numerical algorithms.

Special values complete the system: IEEE 754 reserves patterns for ±infinity (for overflow, e.g., 1.0/0.0) and NaN (Not a Number, for undefined results like 0.0/0.0 or √(−1)). These allow computations to continue and propagate failure information rather than crashing. Recognizing a NaN in your output signals that something went wrong upstream — it is a diagnostic, not a valid result. Understanding how floating point works is prerequisite to understanding why numerical algorithms must be designed carefully: operations that are mathematically equivalent may behave very differently when computed in finite precision.

Practice Questions 5 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraBoolean Type and Truth ValuesComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsLogic Gates FundamentalsImplementing Boolean Functions with GatesKarnaugh Map SimplificationCombinational Circuit DesignFlip-Flops and LatchesBinary Counters: Design and AnalysisBinary ArithmeticFixed-Point Number RepresentationTwo's Complement RepresentationFloating-Point Representation (IEEE 754)Machine Epsilon and Unit RoundoffFloating Point Representation

Longest path: 85 steps · 340 total prerequisite topics

Prerequisites (1)

Leads To (1)