You’ve been around javascript long enough to know there are some really strange quirks. Here is one I’ve not seen before. Consider very basic addition. If you want to try this just open your javascript console in Chrome or Firefox and simply enter:

```4.3 + 8.0 + 6.15
```

Think the answer is 18.45? Wrong, you’ll get 18.450000000000003.

Ok, now lets rearrange those numbers and try it again:

```4.3 + 6.15 + 8.0
```

Now you will get 18.45. After rearranging these some more and here are the results:

```8.0 + 4.3 + 6.15 // 18.450000000000003

8 + 6.15 + 4.3 // 18.45

8.0 + 6.15 + 4.3 // 18.45

4.3 + 1 + 6.15 // 11.45

4.3 + 4 + 6.15 // 14.450000000000001

100 - (4.3 + 4 + 6.15) // 85.55

100 - 14.450000000000001 // 85.55
```

It seems to differ depending on the position within the addition sequence and also the numbers being added. So far these all round down, but what happens when you encounter this?

```4.3 + 6.15 + 3.7 + 1.85 // 15.999999999999998

4.3 + 6.15 + 1.85 // 12.299999999999999
```

Ahh, now you run into some borderline issues. What if you are validating that you have \$16?

```16 == 4.3+6.15+3.7+1.85 // false

16 === 4.3+6.15+3.7+1.85 // false
```

So when do you know if you actually have 15.999999999999998 and when it is just a silly inconsistancy?
After some googling there are a few possible work arounds, like (8.0 + 4.3 + 6.15).toFixed(2) but you don’t always know how many decimal places you should need.

So you think this is just a silly client side validation issue? THINK AGAIN. This includes NodeJS as well, possibly others. This could be going into your database. Possibly over/under charging payments. Maybe you’re processing some type of precise calculations. If you know the number of decimal places you need you better ensure you’re rounding to that many decimal places.

Sure there is some fancy explanation (See http://floating-point-gui.de/), but is it broke? As far as I’m concerned, YES. Please, someone, prove me wrong!