Version 3 of SYStems

Updated 2005-03-10 08:40:50

The Egyptian wannabe developer/sys-admin


 # Allow spaces and underscores in long number for easy reading
 proc norm {num} {
     if {[regexp {^(\s|\d|_)*(\.)?(\s|_)*(\d)+(\s|\d|_)*$} $num]} {
         string map {_ {} \  {}} $num
     } else {
         error "Number: $num is not in normal form"
     }
 }

 Example:
 expr [norm 10_000_000] + [norm 100._10_100]
 => 10000100.101




Category Person