|
2003-02-19
| ||
| 21:42 | • Closed ticket [664775ffff]: execute-7.30 fails on SGI plus 3 other changes artifact: b51bdccec0 user: msofer | |
| 21:11 | • Ticket [664775ffff]: 4 changes artifact: 350bcc7b8a user: dkf | |
|
2003-01-09
| ||
| 00:19 | • New ticket [664775ffff]. artifact: 7341c1a79e user: dgp | |
execute-7.30 fails on SGI
Closed / Fixed664775ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2003-01-09 00:19:05
==== 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.
dkfplain2003-02-19 21:11:19
Logged In: YES user_id=79902 Really, for the purposes of what the test is testing, we could (and, so it seems, should) use log() instead of sin(). The actual value returned doesn't matter in this case since it is just checking explicit vs. implicit wide-to-double conversions.
msofer Closed ticket [664775ffff].
[History diff]2003-02-19 21:42:42
Log in (anonymous is fine) to add a comment.