This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: bug float to int
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, wlodek
Priority: normal Keywords:

Created on 2021-01-11 10:26 by wlodek, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg384807 - (view) Author: Wlodek (wlodek) Date: 2021-01-11 10:26
Python 3.8.5 (default, Jul 28 2020, 12:59:40) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> f=0.1234/100
>>> f2= f*10**8
>>> i2= int(f2)
>>> print("float=%f, float_2=%f, int(float_2)=%d" % (f, f2, int(f2)))
float=0.001234, float_2=123400.000000, int(float_2)=123399
msg384809 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-01-11 12:09
Rounding errors are to be expected. Python uses IEEE-754 double precision floats. See
Date User Action Args
2022-04-11 14:59:40adminsetgithub: 87056
2021-01-11 12:09:08christian.heimessetstatus: open -> closed

type: behavior

nosy: + christian.heimes
messages: + msg384809
resolution: not a bug
stage: resolved
2021-01-11 10:26:19wlodekcreate