0

From documentation of math.fsum:

fsum(seq, /) - Return an accurate floating point sum of values in the iterable seq.

But

>>> import math
>>> vals = [0.1, 0.1, 0.1]
>>> sum(vals)
0.30000000000000004
>>> math.fsum(vals)
0.30000000000000004

or I got it wrong?

(tested in both gnu/linux and windows, python 3.11.1)

DPColombotto
  • 159
  • 1
  • 3
  • 11

0 Answers0