Skip to content

Incorrect result of calculating the sum of two float values #94956

@IBelolipetskij

Description

@IBelolipetskij

Bug report

There is a couple of float type values which sum turns out to be incorrect. It is enough to execute the following code:
print(12.566370614359172 + 28.274333882308138)
The resualt is 40.840704496667314 instead of 40.840704496667310. Attention should be paid to the lower digit of the value (4 vs 0)

Additionally:
For the first time, this behavior was detected on Python 3.9.13 and 3.10.5 for windows.

Your environment

  • CPython versions tested on: 3.10.5+
  • Operating system and architecture: Ubuntu 20.04.4 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions