tcl::mathfunc signbitTcl 9.1 only
Gives 1 when the sign bit of a number is set.
tcl::mathfunc::signbit NUMBER
expr {signbit(NUMBER)}
Description
Gives 1 for a negative number, also for -0.0 and for a NaN with the sign bit, and 0 otherwise.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| NUMBER | number | required | An integer of any size, a float, or NaN. |
Returns
1 or 0.
Examples
% expr {signbit(-0.0)}
1
% expr {signbit(-3)}
1
% expr {signbit(0)}
0
Errors
% expr {signbit("x")}
expected number but got "x"
-errorcode TCL VALUE NUMBER
% expr {signbit()}
not enough arguments for math function "signbit"
-errorcode TCL WRONGARGS
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 only.
- Since
- ztcl 1.0.0-beta.1