Luc <
lucmove@gmail.com> wrote:
I must say I feel terribly blindsided by this. I've been using
tcl_precision for more than 10 years and never seemed to have
any problem with it. Now I see it's dangerous. I am genuinely
disappointed.
The reason, why it may not have hit you earlier could be,
that tcl_precision only affects "stringification" of reals,
that is: conversion of the internal numeric value to a decimal
string.
Well-written programs generally do not stringify numbers before
they're presented to the user, or written to a file, ... (and even
then use [format ...] to not affect the values themselves.
But things like [expr $x + $y] cause a stringification of both
summands, so it strikes differently than for [expr {$x + $y}].
Now you probably want to say: "but it gave a wrong answer also for
the braced version," but I think that is only because you wrote out
the summands (in the puts statements), which you likely only inserted
because the unbraced expr gave bogus results.
Retry your original code (with tcl_precision at 2) and comment out
the puts-lines for the summands, and use a braced expr... I think
it might have even worked despite the tcl_precision...
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)