==== execute-7.30 Wide int handling in function call FAILED
==== Contents of test case:
set x 0x12345687123456
incr x
expr {sin($x) == sin(double($x))}
---- Result was:
floating-point value too small to represent
---- Result should have been (exact matching):
1
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
==== execute-7.30 FAILED
There are several problems here.
First note that sin(x) == sin (x + 2*pi), so in order to
compute the sin() of a value you need to know its
precision at a scale considerably less than 2*pi.
For large numbers, differences of 2*pi can get lost
in the low order bits of the floating point rep, or not
represented at all. Taking the sin() of such imprecise
numbers is essentially meaningless.
For this reason, on the SGI platform, for any x > 2^50,
sin(x) returns 0, and errno is set to ERANGE.
In the test above, x > 2^50. If all that is needed for
this
test is a wide int argument, then replacing x with some
value less than 2^50, but greater than 2^31 (thus wide)
should fix the test.
It is unfortunate that the SGI sin() function raises ERANGE
in this circumstance, I think it would make more sense
to raise EDOM. Anyhow, the combination of ERANGE and
value == 0 gets interpreted by Tcl in TclExprFloatError()
as a floating point underflow ("floating-point value
too small
to represent"), but that's not accurate in this case.
Would
be nice to get a better error message for this.
|