Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 8f6be2c87a3d76bf067a80d0b98e338a7b5297e6bda64e797dae5406a3ede4d5
Ticket: b8e9a9a97f0d8be15bd549239ec89aa58c11f3f4
expr 52 * 0.001 = 0.052000000000000005
User & Date: anonymous on 2019-03-08 23:34:41
Changes

  1. comment changed to:
    It seems tcl needs to consider how to handle math correctly. See the math example below. It will mess up the results in most of the cases, as long as the user does some simple math.
    
    We know it is a floating point number problem for computer and many computer languages. But it is still good to have a better solution.
    
    52 * 0.001 = 0.052000000000000005
    0.52 * 0.01 = 0.005200000000000001
    0.1 + 0.2 = 0.30000000000000004
    
    I can reproduce this issue in Tcl 8.6.8 for Windows and Tcl 8.5.9 for Windows.
    
    (bin) 1 % expr 1 + 3
    4
    (bin) 2 % expr 52 + 3
    55
    (bin) 3 % expr 52 * 0.01
    0.52
    (bin) 4 % expr 52 * 0.001
    0.052000000000000005
    (bin) 5 % expr 0.52 * 0.01
    0.005200000000000001
    
    
    (bin) 8 % expr 0.1 + 0.2
    0.30000000000000004
    
  2. login: "anonymous"
  3. mimetype: "text/plain"