Issue 5589: Wrong dump of floats (original) (raw)

Issue5589

Created on 2009-03-28 18:58 by stein, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg84323 - (view) Author: Sebastian Billaudelle (stein) Date: 2009-03-28 18:58
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
msg84324 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2009-03-28 19:06
>>> .1 0.10000000000000001 Read http://docs.python.org/tutorial/floatingpoint.html
msg84327 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-03-28 19:16
As Ezio points out, this is correct Python behavior.
History
Date User Action Args
2022-04-11 14:56:47 admin set github: 49839
2009-06-25 13:33:22 amaury.forgeotdarc unlink issue6342 dependencies
2009-06-25 13:30:09 r.david.murray link issue6342 dependencies
2009-03-28 19🔞22 benjamin.peterson set status: open -> closed
2009-03-28 19:16:12 r.david.murray set nosy: + r.david.murraymessages: + components: + Interpreter Core, - Library (Lib)resolution: not a bugstage: resolved
2009-03-28 19:06:54 ezio.melotti set nosy: + ezio.melottimessages: +
2009-03-28 18:58:35 stein create