HackerTube

Floating Point Numbers - Computerphile

Computerphile2 HN recommenders · recommended in 2 months, 2015–2023
YouTube
explainer · intro · evergreen · 2015–2023 on HN

Tom Scott explains for Computerphile how floating point numbers work, why moving the binary point is fast, and why it handles money badly.

Recommended as a simple, fun explanation of why floating point gives odd errors like 0.1 + 0.2.

3 comments from Hacker News

@microwavecamera2017-06 · in “Why do programming languages suck at math?”

Short answer, no decimal in binary and math is hard. :) Here's a couple handy videos explaining it: ▶ this video link

Recommends View on HN
@felipesabino2015-11 · in “0.30000000000000004”

Recommended: Floating Point Numbers - Computerphile ▶ this video Tom Scott's fun and simple take on Floating Points is a good video explaining why such weird errors happen

Recommends View on HN
@mercxry2023-10 · in “Why you should probably be using SQLite”

You should still not use MONEY in Postgres, even their own website says so [1]. I still wouldn't use floats/numerics/decimals to store currency either in any db generally, as said by others you're going to end up with inaccurate numbers [2]. Therefore using integers is in fact very good for this use-case, especially if you are in accounting or book-keeping! Source: I work for a Fintech company that processes millions of payments. [1] link [2] ▶ this video