Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: da17f6ab4bd42faa4c1d8a35a6dcadef28346939
Ticket: 1767293fffffffffffffffffffffffffffffffff
Bad performance using ** operator with integer operands
User & Date: dgp on 2007-09-10 08:14:45
Changes

  1. icomment:
    Logged In: YES 
    user_id=80530
    Originator: NO
    
    
    failing test on Mac OS X 10.3:
    
    ==== expr-23.52 INST_EXPON: small integer powers with 64-bit results FAILED
    ==== Contents of test case:
    
        set trouble {test small int powers with 64-bit results}
        for {set exp 2} {$exp <= 16} {incr exp} {
            set base [expr {entier(pow(double(0x7fffffffffffffff),(1.0/$exp)))}]
            set sb 1
            set sbm 1
            for {set i 0} {$i < $exp} {incr i} {
                set sb [expr {$sb * $base}]
                set sbm [expr {$sbm * -$base}]
            }
            set is [expr {$base ** $exp}]
            set ism [expr {-$base ** $exp}]
            if {$sb != $is} {
                append trouble \n $base ** $exp " is " $is " should be " $sb
            }
            if {$sbm != $ism} {
                append trouble \n - $base ** $exp " is " $ism " should be " $sbm
            }
            incr base
            set sb 1
            set sbm 1
            for {set i 0} {$i < $exp} {incr i} {
                set sb [expr {$sb * $base}]
                set sbm [expr {$sbm * -$base}]
            }
            set is [expr {$base ** $exp}]
            set ism [expr {-$base ** $exp}]
            if {$sb != $is} {
                append trouble \n $base ** $exp " is " $is " should be " $sb
            }
            if {$sbm != $ism} {
                append trouble \n - $base ** $exp " is " $ism " should be " $sbm
            }
        }
        set trouble
    
    ---- Result was:
    test small int powers with 64-bit results
    2097152**3 is -9223372036854775808 should be 9223372036854775808
    512**7 is -9223372036854775808 should be 9223372036854775808
    128**9 is -9223372036854775808 should be 9223372036854775808
    ---- Result should have been (exact matching):
    test small int powers with 64-bit results
    ==== expr-23.52 FAILED
    
    
    
  2. login: "dgp"
  3. mimetype: "text/plain"
  4. username: "dgp"