tcl::mathfunc nextafterTcl 9.1 only
Gives the next double after one number in the direction of another.
tcl::mathfunc::nextafter X Y
expr {nextafter(X, Y)}
Description
Gives the double next to X on the side of Y. When X equals Y it gives Y. From 0 it gives the smallest subnormal double, 5e-324, or its negative.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| X | number | required | The start. |
| Y | number | required | The direction. |
Returns
A float.
Examples
% expr {nextafter(1.0, 2)}
1.0000000000000002
% expr {nextafter(1, 0)}
0.9999999999999999
% expr {nextafter(0, 1)}
5e-324
% expr {nextafter(1, 1)}
1.0
Errors
% expr {nextafter(NaN, 1)}
floating point value is Not a Number
-errorcode TCL VALUE DOUBLE NAN
% expr {nextafter(1)}
not enough arguments for math function "nextafter"
-errorcode TCL WRONGARGS
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 only.
- Since
- ztcl 1.0.0-beta.1