## Day 1018

## Python `math.isclose()`

to check for “almost equal”

Had an issue with checking whether a sum of floats sums up to a number, remembering that python floats are ‘special’:

```
>>> 0.1 + 0.2
0.30000000000000004
```

Stack overflow^{1} told me about `math.isclose()`

, works as you’d expect:

```
assert math.isclose(sum(floats), needed_sum)
```