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

Wrong dump of floats #49839

Closed
stein mannequin opened this issue Mar 28, 2009 · 3 comments
Closed

Wrong dump of floats #49839

stein mannequin opened this issue Mar 28, 2009 · 3 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@stein
Copy link
Mannequin

stein mannequin commented Mar 28, 2009

BPO 5589
Nosy @ezio-melotti, @bitdancer

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 2009-03-28.19:18:22.579>
created_at = <Date 2009-03-28.18:58:35.207>
labels = ['interpreter-core', 'type-bug', 'invalid']
title = 'Wrong dump of floats'
updated_at = <Date 2009-03-28.19:18:22.578>
user = 'https://bugs.python.org/stein'

bugs.python.org fields:

activity = <Date 2009-03-28.19:18:22.578>
actor = 'benjamin.peterson'
assignee = 'none'
closed = True
closed_date = <Date 2009-03-28.19:18:22.579>
closer = 'benjamin.peterson'
components = ['Interpreter Core']
creation = <Date 2009-03-28.18:58:35.207>
creator = 'stein'
dependencies = []
files = []
hgrepos = []
issue_num = 5589
keywords = []
message_count = 3.0
messages = ['84323', '84324', '84327']
nosy_count = 3.0
nosy_names = ['ezio.melotti', 'r.david.murray', 'stein']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue5589'
versions = ['Python 2.6']

@stein
Copy link
Mannequin Author

stein mannequin commented Mar 28, 2009

Hi there,

I just recognized a weird behaviour of the json module...

Dumpig a float like 0.1 I get some crazy output.

Here is an example:

>>> import json
>>> json.dumps([.1])
'[0.10000000000000001]'

Very simple to reproduce;)

  • Sebastian

@stein stein mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Mar 28, 2009
@ezio-melotti
Copy link
Member

>>> .1
0.10000000000000001

Read http://docs.python.org/tutorial/floatingpoint.html

@bitdancer
Copy link
Member

As Ezio points out, this is correct Python behavior.

@bitdancer bitdancer added interpreter-core (Objects, Python, Grammar, and Parser dirs) invalid and removed stdlib Python modules in the Lib dir labels Mar 28, 2009
@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) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants