Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 1df76aeb53c781eccdbb1bd87a99646426bed858
Ticket: 3530004fffffffffffffffffffffffffffffffff
New function in "expr": sgn()
User & Date: dkf on 2012-05-28 17:31:12
Changes

  1. icomment:
    Here's a complete workaround (modulo ensuring that $x is numeric and handling NaN):
    
      proc tcl::mathfunc::sgn {x} {
          expr {$x < 0 ? -1 : $x > 0 ? 1 : 0}
      }
    
    The only question is whether Tcl should provide such a thing by default.
    
    
  2. login: "dkf"
  3. mimetype: "text/plain"
  4. title changed to: "New function in "expr": sgn()"
  5. username: "dkf"