Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with float and "6" type #46038

Closed
pedrocpneto mannequin opened this issue Dec 25, 2007 · 2 comments
Closed

Problems with float and "6" type #46038

pedrocpneto mannequin opened this issue Dec 25, 2007 · 2 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@pedrocpneto
Copy link
Mannequin

pedrocpneto mannequin commented Dec 25, 2007

BPO 1697
Nosy @tiran

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2007-12-25.16:41:12.302>
created_at = <Date 2007-12-25.13:15:01.625>
labels = ['interpreter-core', 'invalid', 'performance']
title = 'Problems with float and "6" type'
updated_at = <Date 2007-12-25.16:41:12.292>
user = 'https://bugs.python.org/pedrocpneto'

bugs.python.org fields:

activity = <Date 2007-12-25.16:41:12.292>
actor = 'christian.heimes'
assignee = 'none'
closed = True
closed_date = <Date 2007-12-25.16:41:12.302>
closer = 'christian.heimes'
components = ['Interpreter Core']
creation = <Date 2007-12-25.13:15:01.625>
creator = 'pedrocpneto'
dependencies = []
files = []
hgrepos = []
issue_num = 1697
keywords = []
message_count = 2.0
messages = ['58989', '58992']
nosy_count = 2.0
nosy_names = ['christian.heimes', 'pedrocpneto']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = 'resource usage'
url = 'https://bugs.python.org/issue1697'
versions = ['Python 2.5']

@pedrocpneto
Copy link
Mannequin Author

pedrocpneto mannequin commented Dec 25, 2007

Problems with float and "6" type

Hi, I am having problems both in the Windows version on the Linux
version of Python as put some number with some 6 type that it always
returns a value me, following examples:

>>> 2.0
2.0
>>> 1.55
1.55
>>> 1.56
1.5600000000000001
>>> 1.6
1.6000000000000001
>>> 1.63
1.6299999999999999
>>> 1.64
1.6399999999999999
>>> 1.71
1.71
>>> 6.0
6.0

Recalling that the error happens only with the digit 6 in float.
Thanks for attention.

Pedro Clemente Pereira Neto
Brasil
pedrocpneto at gmail.com

@pedrocpneto pedrocpneto mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage labels Dec 25, 2007
@tiran
Copy link
Member

tiran commented Dec 25, 2007

Your results are correct and expected. You can find more information at:

http://effbot.org/pyfaq/why-are-floating-point-calculations-so-inaccurate.htm
http://en.wikipedia.org/wiki/IEEE_754

@tiran tiran closed this as completed Dec 25, 2007
@tiran tiran added the invalid label Dec 25, 2007
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage
Projects
None yet
Development

No branches or pull requests

1 participant