[Python-bugs-list] [ python-Bugs-721171 ] Tkinter precision loss for doubles
SourceForge.net
noreply@sourceforge.net
Mon, 14 Apr 2003 08:32:08 -0700
Bugs item #721171, was opened at 2003-04-14 11:32
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=721171&group_id=5470
Category: Tkinter
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Peters (tim_one)
Assigned to: Martin v. Löwis (loewis)
Summary: Tkinter precision loss for doubles
Initial Comment:
DoubleVar.set() (I think) goes thru PyObject_Str(),
causing precision loss for doubles:
>>> import Tkinter
>>> import math
>>> x = Tkinter.DoubleVar(Tkinter.Tk())
>>> x.set(math.pi)
>>> x.get()
3.1415926535900001 # not good
>>> math.pi
3.1415926535897931 # original precision
>>> eval(str(math.pi))
3.1415926535900001 # reproduces Tk result
>>>
Reported on c.l.py. Guido says you may know how to
create a "native" Tcl/Tk double in this case instead.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=721171&group_id=5470