Learn

Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Lesson 1 of 24

Model rounded arithmetic before trusting a calculation

Separate representable numbers, rounding error and exceptional range behavior.

Loading your saved responses…

Try the optional starting-point checks and targeted refreshers. You can continue directly into this lesson.

Try

A computer stores a finite set of numbers, not the whole real line. Consider a toy decimal system with three significant digits and rounding to nearest. It stores 1.23 and 1.24 but not 1.234 exactly. The stored result is 1.23, with absolute error 0.004 and relative error 0.004/1.234. State which value is the mathematical input and which is its representation. A printed decimal string can hide this distinction when software displays only a few digits.

Predict

Predict whether adding a positive quantity must increase the stored result. In the toy format, 1000+1 rounds back to 1000. The added unit has been absorbed because it is smaller than half the local spacing. This is not a violation of real arithmetic: the implemented operation is real addition followed by rounding. Similarly, subtraction can expose information lost in an earlier rounded sum. The order of operations is therefore part of the numerical algorithm.

Experiment

Trace every rounded operation rather than rounding only the final answer.

ExpressionExact intermediateStored intermediateFinal result
(1000+2)−1000100210000
1000+(2−1000)−998−9982

Repeat with an added quantity of 8 and explain why the first expression returns 10 rather than 8. This controlled decimal model is not ordinary JavaScript arithmetic.

Understand

For base β and precision p, normalized positive numbers between β^e and β^(e+1) have spacing β^(e−p+1). Nearest rounding gives absolute error at most half that spacing. Since magnitude is at least β^e, fl(x)=x(1+δ), with |δ|≤u=(1/2)β^(1−p), provided the result remains in the normal finite range. In binary precision p, spacing immediately above one is 2^(1−p), while unit roundoff is 2^(−p). These are different constants; a library name such as epsilon may mean spacing rather than unit roundoff. Ties need a stated rule, commonly choosing an even final significand digit.

Apply

For one correctly rounded basic operation, fl(a op b)=(a op b)(1+δ) under the same assumptions. This does not say that stored inputs equal their intended values. Track input representation errors separately. At overflow a finite real result may not fit; near underflow fixed subnormal spacing can defeat the relative bound. Division by zero and invalid operations require explicit handling. Design a log with intended inputs, stored inputs, each operation and its rounding, so a failure can be located rather than attributed vaguely to computer error. Exact zero deserves separate treatment because relative error at zero has no denominator.

Continue

This unit uses exact rational practice where possible and stated arithmetic models elsewhere. Actual binary browser arithmetic is a different experiment from the decimal table. Numerical analysis asks how local errors affect a complete computation, which requires conditioning and stability next. More digits can reduce roundoff, but they do not fix an ill-posed model or faulty algorithm. Written implementation tasks specify designs and tests; they are not executed programs. Always report the arithmetic assumptions when interpreting a numerical trace.

Review calculus and linear algebra when a prerequisite needs practice. Continue to Measure how much the mathematical answer can change.

Apply · explain · revise

Practice and reasoning

Drafts save locally as you type. Reveal worked solutions when useful; the site remembers that exposure. Automatic matches check the requested answer, while written arguments require review against the rubric.

In a normalized base-2 format with 4 significant bits, what is the spacing on [1,2)?

Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.

Round 1.375 to 3 significant binary bits using ties-to-even.

Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.

Derive unit roundoff u=(1/2)β^(1−p) for nearest rounding with p base-β digits away from range limits.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

In decimal arithmetic with 3 significant digits compare (1000+1)−1000 and 1000+(1−1000).

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Why must the relative-error model be qualified near zero?

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Design a toy rounding test with a tie, a carry and absorption.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Reflect and continue

Before marking this lesson complete, explain one key idea without the worked solution and identify a condition that matters. Marking complete records participation, not independent mastery.