#3282 expr-46.13-18 fail on 64-bit systems

obsolete: 8.4.11
closed-fixed
5
2005-11-08
2005-10-29
Don Porter
No

==== 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?

Discussion

  • Mo DeJong

    Mo DeJong - 2005-10-29

    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.

     
  • Mo DeJong

    Mo DeJong - 2005-10-29
    • status: open --> closed-fixed
     
  • Don Porter

    Don Porter - 2005-10-31
    • status: closed-fixed --> open-remind
     
  • Don Porter

    Don Porter - 2005-10-31

    Logged In: YES
    user_id=80530

    Now instead of failing, the tests
    throw the error "integer value
    too large to represent".

     
  • Don Porter

    Don Porter - 2005-11-08
    • assigned_to: mdejong --> dgp
    • status: open-remind --> closed-fixed
     
  • Don Porter

    Don Porter - 2005-11-08

    Logged In: YES
    user_id=80530

    portable version of these tests
    committed to both branches.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks