You are here : python_3mathmathfsum

math.fsum() - math

Return an accurate floating point sum of values in the iterable.  Avoids
loss of precision by tracking multiple intermediate partial sums:


Syntax

math.fsum(iterable)


Example

>>> sum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1])
0.9999999999999999
>>> fsum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1])
1.0


Output / Return Value


Limitations


Alternatives / See Also


Reference