This [expr] function returns the least floating point number with a zero fractional part that is no less than its argument (i.e., it rounds up). ---- The ceil command is a part of the [TclX] extension. TclX created command interfaces to a number of [Tcl] mathematical functions. So just read the [expr] documentation for ceil, and you will know what kind of arguments to pass to it. [RS]: Of course you can also write, if you wish ====== proc ceil x {expr {ceil($x)}} ====== so you don't have to require TclX... [LV] Certainly. However, the point was to document what the TclX ceil command does... [DKF]: Also available in Tcl 8.5 as '''[tcl::mathfunc]::ceil'''. ---- '''[MS] - 2014-05-13 07:04:24''' ([Miguel Sofer] is not the author of this comment, must be some other '''MS''') The ceil function fails if the difference to the number is smaller than 1e-15. expr ceil(34.000000000000001) = 34 by the interpreter. In most uses of ceil this will probably not be an issue but one has to keep it in mind so as to not lose information. I'm currently working on an elegant way to extend the ceil function and will post it once I've found something. ---- '''[MS] - 2014-05-13 12:31:02''' ([Miguel Sofer] is not the author of this comment, must be some other '''MS''') an elegant solution to the ceil problem (floor has the same bug and may be treated similar) is the following: ====== # the number is stored in req, e.g. req = 345.678, req 345 proc ceil {req args} { if {args != ""} { puts "To many arguments. Only one argument is allowed."}\ ;#checks the number of arguments elseif{[string length [expr int($req)]] != [string length $req]}\ ;#checks whether it is an integer to begin with { set i 0 set empt "" while {[string index $req $i] != "." } {set empt "$empt[string index $req $i]";incr i};#ignore all digits after the period incr empt return $empt } else {return $req};#empt = 346, req = 345 ====== I didn't know that there is already someone with the initials MS sorry about that. I'll look into changing that. <> Function | Mathematics | Package