Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 762a0e6e92814da130cfa8842e1a4dc6d1d7e4df
Ticket: 1003145fffffffffffffffffffffffffffffffff
expr int operation giving different results for same values
User & Date: s_a_white on 2004-08-04 09:55:09
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Perhaps related to bug 866469?  Preferred after int
    conversion a consistant output on all operations,
    preferrably giving the same results as C for a similar
    double to int conversion.
    
    Test:
    
    proc test { val } {
        set scaling 100
        puts "\t$val"
        set out [expr { $val * $scaling }]
        puts "\t$out"
        set out [expr { int($out) }]
        puts "\t$out"
        return $out
    }
    
    puts "test1:"
    set a "999996.0"
    puts "\t$a"
    puts "\t[expr { int($a) }]"
    puts "test2:"
    set a 9999.96
    puts "\t$a"
    set a [expr { $a * 100.0 }]
    puts "\t$a"
    puts "\t[expr { int($a) }]"
    puts "test3:"
    set a 9999.96
    puts "\t$a"
    set a [expr { $a * 100 }]
    puts "\t$a"
    puts "\t[expr { int($a) }]"
    puts "test4:"
    puts "\t[test 9999.96]"
    
    
    Results:
    
    test1:
            999996.0
            999996
    test2:
            9999.96
            999996.0
            999995
    test3:
            9999.96
            999996.0
            999995
    test4:
            9999.96
            999996.0
            999995
            999995
    
    C result is always 999996 for the provided double value.
    
    
  4. foundin changed to: "obsolete: 8.4.5"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "s_a_white"
  9. subsystem changed to: "None"
  10. title changed to:
    expr int operation giving different results for same values
    
  11. type changed to: "Bug"