Floating-Point Precision in C | EP 021

Floating-point numbers are approximations, and small errors can grow. We add 0.1 a million times and miss the answer by almost a thousand, measure the precision of float and double with epsilon, watch a large number swallow a small one, and see why money is counted in integer cents.

In this lesson:
– How rounding errors accumulate, and how much double improves on float
– FLT_EPSILON and DBL_EPSILON: the gap just above 1.0
– Absorption: why (big + 1.0) – big is zero
– Why the order of floating-point operations changes the result
– Keeping exact quantities such as money in integers

C Programming ยท Lesson 021.

Chapters:
00: 00 A million small errors
01: 15 Epsilon: measuring precision
02: 06 A big number swallows a small one
02: 50 Money belongs in integers
03: 43 Four habits for floating point
04: 00 Recap

Source files typed in this video: absorb.c, cents.c, eps.c, sum.c

Return Zero: programming, explained like an engineer.
Subscribe so you do not miss the next lesson.

#CProgramming #FloatingPoint #Precision