Articles tagged Floating point

2 articles tagged Floating point, newest first, on technology, money and the internet.

  1. Engineering4 min read

    Crypto amounts are integers: 1 ETH is 1000000000000000000 wei

    A balance of 1 ETH is not 1.0 — it is 1000000000000000000 wei, an exact whole number. Every protocol that matters works this way, and the bugs appear the moment a decimal point gets involved. Why the integer representation exists and what breaks without it.

  2. Engineering7 min read

    Why 0.1 + 0.2 is not 0.3, and what to do about it

    Every mainstream language gives 0.30000000000000004 for 0.1 + 0.2. The reason is not a bug, it is base two, and it has consequences for anything that adds money in a loop. Here is the exact arithmetic, the four places it bites, and the rules that keep it harmless.