beetlebug▾
/

tcl::mathfunc isnormalTcl 9.1 only

Gives 1 when a number is a normal float.

tcl::mathfunc::isnormal NUMBER
expr {isnormal(NUMBER)}

Description

Gives 1 when NUMBER as a double is finite and nonzero and is not subnormal. Zero, a subnormal number such as 1e-310, Inf, and NaN give 0.

Arguments

ArgumentTypeDefaultDescription
NUMBERnumberrequiredAn integer of any size, a float, or NaN.

Returns

1 or 0.

Examples

% expr {isnormal(1.0)}
1

% expr {isnormal(0)}
0

% expr {isnormal(1e-310)}
0

Errors

% expr {isnormal("x")}
expected number but got "x"
-errorcode TCL VALUE NUMBER

% expr {isnormal()}
not enough arguments for math function "isnormal"
-errorcode TCL WRONGARGS

Facts

Capability
None.
Tcl release
Tcl 9.1 only.
Since
ztcl 1.0.0-beta.1

See also