Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2a16c826c20764a4dac20f4e5ac8bbf3dc3318fb
Ticket: 3564821fffffffffffffffffffffffffffffffff
math rounding function with arbitrary decimal precision
User & Date: sebres on 2012-09-05 16:16:48
Changes

  1. icomment:
    Why can you not use "format" like this?
    % format %.2f 2.125
    2.13
    
    And if you really need a mathematical function, you can simple create it self, something like this:
    % proc ::tcl::mathfunc::roundup {n e} {double [format %.${e}f $n]}
    % puts [expr roundup( 2.555, 2 )]
    2.56
    
    
    
  2. login: "sebres"
  3. mimetype: "text/plain"
  4. username: "sebres"