From: Jeff Godfrey on
Using AS 8.6b1.1 on Win7 x64...

expr {1.0 - 1.0} --> 0.0
expr {abs(1.0 - 1.0)} --> -0.0

Why "-0.0" when using abs?

Jeff
From: Don Porter on
Jeff Godfrey wrote:
> Using AS 8.6b1.1 on Win7 x64...
>
> expr {1.0 - 1.0} --> 0.0
> expr {abs(1.0 - 1.0)} --> -0.0
>
> Why "-0.0" when using abs?

Tcl Bug 2954959. Fixed for Tcl 8.5.9.

--
| Don Porter Mathematical and Computational Sciences Division |
| donald.porter(a)nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
From: Bruce Stephens on
Jeff Godfrey <jeff_godfrey(a)pobox.com> writes:

> Using AS 8.6b1.1 on Win7 x64...
>
> expr {1.0 - 1.0} --> 0.0
> expr {abs(1.0 - 1.0)} --> -0.0
>
> Why "-0.0" when using abs?

Works with tclsh8.5, too (on GNU/Linux Debian 64-bit, FWIW). Not
tclsh8.4, though.

Worse than that: expr {abs(0.0)} --> -0.0
From: Bruce Stephens on
Don Porter <dgp(a)nist.gov> writes:

> Jeff Godfrey wrote:
>> Using AS 8.6b1.1 on Win7 x64...
>>
>> expr {1.0 - 1.0} --> 0.0
>> expr {abs(1.0 - 1.0)} --> -0.0
>>
>> Why "-0.0" when using abs?
>
> Tcl Bug 2954959. Fixed for Tcl 8.5.9.

Ah, that would explain it for me. I have 8.5.8.
From: Jeff Godfrey on
On 5/11/2010 2:09 PM, Don Porter wrote:
> Jeff Godfrey wrote:
>> Using AS 8.6b1.1 on Win7 x64...
>>
>> expr {1.0 - 1.0} --> 0.0
>> expr {abs(1.0 - 1.0)} --> -0.0
>>
>> Why "-0.0" when using abs?
>
> Tcl Bug 2954959. Fixed for Tcl 8.5.9.

Thanks Don.

Jeff