[vtkusers] Floating point numerical truncation

David Cole dlrdave at aol.com
Thu May 9 13:20:02 EDT 2013


(sorry for the html email, Marcus...)


The comment in the code says:


+     * Set the default precision of tcl to match the legacy vtk default
+     * precsion.  Wrapped code will use the tcl_precision variable to
+     * define the output resolution for converting doubles to strings


I am only guessing here, because I do not remember making this commit... (it’s possible somebody else did the grunt work and passed it off to me, and I was just the committer)


... but here’s the guess:


We probably observed that updating to a newer version of tcl caused many tests to “fail” because they suddenly got different (more precise than before, with more ascii character content than before) strings back for some operations. I am guessing this line to set the tcl precision was simply to cause the test suite to have identical results when moving between tcl versions. (Was there a tcl release around that time that would have changed the precision from 6 to 12...?)


It would be easy enough to verify this. Somebody who has tcl wrapping turned on could try to change the 6 to a 12 and then run the test suite. If a bunch of stuff suddenly “fails” then we would probably have to do a bunch of work to be able to make a change like this for real. And if we did, it would potentially not work with older (ancient? 😊) versions of tcl.


I’m sure the 6 is not strictly necessary, but it may be quite some effort to change that one digit to those two.


Good luck, tclers...



D




From: Bill Lorensen
Sent: ‎Thursday‎, ‎May‎ ‎9‎, ‎2013 ‎12‎:‎28‎ ‎PM
To: Patrick Lowry
Cc: vtkusers at public.kitware.com; David Cole


I see that Dave Cole added this statement in 2008. It overrides the default of 12.




Dave, Do you recall why you added this?

Here is the commit:

http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=9fa6152eeaf8042715ff98858f511dfe71b180c5





Bill





On Thu, May 9, 2013 at 12:15 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:



The precision is set in:

Wrapping/Tools/vtkWrapTclInit.c:            "  Tcl_SetVar2(interp, \"tcl_precision\", (char *) NULL, \"6\", TCL_GLOBAL_ONLY);\n");





Try changing the 6 to 12 and see if that works.






On Wed, May 8, 2013 at 3:50 PM, Patrick Lowry <plowry.tx at verizon.net> wrote:







Dear VTK User,

 

I am using the pre-compiled binary executable for VTK 5.10 and the Tcl/Tk scripting language.  I also have a number of pure Tcl/Tk scripts that do not have VTK method calls and I had notice some time ago that VTK.exe is rounding floating point numbers to six significant digits.  This has happened since the early VTK 5.x releases and on multiple PC platforms.  It did not happened with the 4.x releases.  When I run the same Tcl/Tk script using wish85.exe no rounding occurs.  The image below shows the run window of the same script using VTK.exe and wish85.exe.  Both show the raw data line and the puts of the second two variables.  The one using VTK.exe has rounding and the one using wish85.exe, no rounding. Tcl/Tk has a floating point resolution setting that defaults to 12 significant digits.  Clearly VTK.exe is defaulting to 6.

 

Can anyone direct me to a setting that will change VTK.exe to work correctly.

 

Thanks,

Patrick




_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers










-- 
Unpaid intern in BillsBasement at noware dot com












-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130509/786f1ed4/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 78995 bytes
Desc: image001.jpg
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130509/786f1ed4/attachment.jpg>


More information about the vtkusers mailing list