Skip to content
Tcl Source Code View Ticket
Login

View Ticket

expr-46.13-18 fail on 64-bit systems

Closed / Fixed1341368fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-10-29 06:43:44
==== expr-46.13 round() boundary case - largest int FAILED
==== Contents of test case:

    set imax [expr {((1<<31) + 1) * -1}]
    expr {round($imax - 0.51)}

---- Result was:
-2147483650
---- Result should have been (exact matching):
2147483646
==== expr-46.13 FAILED


==== expr-46.14 round() boundary case - largest int FAILED
==== Contents of test case:

    set imax [expr {((1<<31) + 1) * -1}]
    expr {round($imax - 0.50)}

---- Result was:
-2147483650
---- Result should have been (exact matching):
2147483647
==== expr-46.14 FAILED

==== expr-46.15 round() boundary case - becomes wide
int FAILED
==== Contents of test case:

    set imax [expr {((1<<31) + 1) * -1}]
    expr {round($imax + 0.50)}

---- Result was:
-2147483649
---- Result should have been (exact matching):
2147483648
==== expr-46.15 FAILED


==== expr-46.16 round() boundary case - smallest int FAILED
==== Contents of test case:

    set imin [expr {1<<31}]
    expr {round($imin + 0.51)}

---- Result was:
2147483649
---- Result should have been (exact matching):
-2147483647
==== expr-46.16 FAILED

==== expr-46.17 round() boundary case - smallest int FAILED
==== Contents of test case:

    set imin [expr {1<<31}]
    expr {round($imin + 0.50)}

---- Result was:
2147483649
---- Result should have been (exact matching):
-2147483648
==== expr-46.17 FAILED


==== expr-46.18 round() boundary case - becomes wide
int FAILED
==== Contents of test case:

    set imin [expr {1<<31}]
    expr {round($imin - 0.50)}

---- Result was:
2147483648
---- Result should have been (exact matching):
-2147483649
==== expr-46.18 FAILED




Perhaps it's just missing test constraints;
the tests appear suitable only for systems
on which the C long type is 32-bit.

Still the point of the tests elude me.
Just more stuff that's changing in 8.5,
right?  If we haven't tested it before,
why start now?
mdejongplain2005-10-30 03:00:03
Logged In: YES 
user_id=90858

Fixed problem by adding 32bit vs 64 bit logic. As far as the
8.5 bit, it needs to behave like the expr impl in 8.4 for
numbers
that fit inside longs anyway.
mdejong Ticket [1341368fff]: 2 changes [History diff]2005-10-30 03:00:04
dgpplain2005-11-01 00:10:52
Logged In: YES 
user_id=80530


Now instead of failing, the tests
throw the error "integer value
too large to represent".
dgp Closed ticket [1341368fff]. [History diff]2005-11-09 03:22:23
dgpplain2005-11-09 03:22:24
Logged In: YES 
user_id=80530


portable version of these tests
committed to both branches.
dgp Ticket [1341368fff]: 2 changes [History diff]2005-11-09 03:22:25
Log in (anonymous is fine) to add a comment.