[New-bugs-announce] [issue40030] Error with math.fsum() regarding float-point error

Mathias Talbo report at bugs.python.org
Sat Mar 21 04:43:29 EDT 2020


New submission from Mathias Talbo <mathiashoy at gmail.com>:

An issue occurs when running the following code. 

import math
math.fsum([0.1, 0.2]), math.fsum([0.1, 0.7])

This should output 0.3, 0.8 respectively.

Instead, it output 0.30000000000000004, 0.7999999999999999

The very floating-point error it is trying to stop from occurring.

Thank you for your time.

----------
components: Extension Modules
messages: 364730
nosy: Mathias Talbo
priority: normal
severity: normal
status: open
title: Error with math.fsum() regarding float-point error
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40030>
_______________________________________


More information about the New-bugs-announce mailing list