Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5088f15e8141a35325a927d8e7866f367f1facf0
Ticket: 1340260fffffffffffffffffffffffffffffffff
Simplify round() implementation in expr cmd
User & Date: kennykb on 2005-11-02 02:13:36
Changes

  1. icomment:
    Logged In: YES 
    user_id=99768
    
    Don is correct - because of the double rounding step.
    
    Converting a wide to a double has to round to 53 significant
    bits, so converting 0x7fffffffffffffff rounds up:
    
    % expr 0x7fffffffffffffff
    9223372036854775807
    % expr entier(double(0x7fffffffffffffff))
    9223372036854775808
    
    Rounding the double then yields an integer that overflows
    when reconverted to 64-bits, so winds up being negative
    rather than positive.
    
    
  2. login: "kennykb"
  3. mimetype: "text/plain"
  4. username: "kennykb"