tcl::mathfunc floor
Gives the largest whole number at or below a number, as a float.
tcl::mathfunc::floor NUMBER
expr {floor(NUMBER)}
Description
Rounds NUMBER down to a whole number and gives it as a float, also for an integer argument.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| NUMBER | number | required | Any number. |
Returns
A float with no fraction part.
Examples
% expr {floor(1.8)}
1.0
% expr {floor(-1.2)}
-2.0
% expr {floor(7)}
7.0
Errors
# Tcl 9.1 only
% expr {floor("x")}
cannot use non-numeric string "x" as operand of "floor"
-errorcode ARITH DOMAIN {non-numeric string}
# Tcl 8.6 only
% expr {floor("x")}
can't use non-numeric string as operand of "floor"
-errorcode ARITH DOMAIN {non-numeric string}
% expr {floor()}
not enough arguments for math function "floor"
-errorcode TCL WRONGARGS
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.1