Why 0.1 + 0.2 != 0.3, or the mysterious world of floating-point numbers.

Avatar of Benoit Jacquemont Benoit Jacquemont

Yes, running the above expression in PHP, and in a lot of other languages, will confirm that 0.1 + 0.2 does not equal to 0.3.

But this weird behavior is explainable and even justified.

Floating point numbers can open you up a completely new universe.
Provided of course that they are properly used.

This talk will go through a bit of theory, and a lot of concrete examples.

From the Gulf War to the Quake graphics engine, via the Ariane 5 space rocket, we will see the benefits and the potential dangers of using floating-point numbers.

From these examples, we will extract some lessons we can translate into our day to day development practices.

And finally, the talk will cover when to use floating-point numbers, and when to avoid them, like when managing prices or billing, and what are the alternatives in those cases.

Delivered in English

This talk is delivered twice during the conference:

  • Friday, December 4, 2020 at 11:55 AM – 12:30 PM

  • Friday, December 4, 2020 at 19:50 PM – 20:25 PM

Introductory talk, no prior knowledge needed.