On 2008-12-31 06:22+0100 Arjen Markus wrote: > Hi, > > I am working on the Tcl examples and found possible causes > for the rounding errors vis-a-vis the C examples, namely > not using braces around all expressions. (The lack of braces > means that the numbers are filled as strings before the > expression is evaluated, whereas with braces the [expr] > command can use the numerical value directly.) > > Example 13 contained some deviations from the C version, > but I noticed that the C version (and the Tcl version too) > uses a loop with a floating-point variable. This in > general is asking for rounding trouble. It did not happen > in the C case, because effectively the numbers used are > integer (they did happen in the Tcl case, as there a > fraction 2pi/500 was used).
I would change the Tcl version to match the C logic (and the logic for the other languages as well) which (as you noted) does use integers for the theta-related variables for exactly the rounding reasons you mentioned. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ ------------------------------------------------------------------------------ _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel