mathnextafter Method (Double, Double) |
Gets the floating-point number that is next after fromNumber in the direction of towardNumber.
Namespace:
C
Assembly:
C.math (in C.math.dll) Version: 1.0.0.0 (1.0.0.0)
Syntaxpublic static double nextafter(
double fromNumber,
double towardNumber
)
Public Shared Function nextafter (
fromNumber As Double,
towardNumber As Double
) As Double
public:
static double nextafter(
double fromNumber,
double towardNumber
)
static member nextafter :
fromNumber : float *
towardNumber : float -> float
Parameters
- fromNumber
- Type: SystemDouble
A floating-point number. - towardNumber
- Type: SystemDouble
A floating-point number.
Return Value
Type:
DoubleThe floating-point number that is next after
fromNumber in the direction of
towardNumber.
Remarks
IEC 60559 recommends that fromNumber be returned whenever fromNumber == towardNumber.
These functions return towardNumber instead, which makes the behavior around zero consistent: nextafter(-0.0, +0.0)
returns +0.0 and nextafter(+0.0, -0.0) returns –0.0.
See nextafter in the C standard documentation.
ExamplesAssert.IsTrue(math.nextafter(0D, 0D) == 0D);
Assert.IsTrue(math.nextafter(-0D, 0D) == 0D;
Assert.IsTrue(math.nextafter(0D, -0D) == -0D);
Assert.IsTrue(math.nextafter(math.DBL_MIN, 0D) == math.DBL_DENORM_MAX);
Assert.IsTrue(math.nextafter(math.DBL_DENORM_MIN, 0D) == 0D);
Assert.IsTrue(math.nextafter(math.DBL_MIN, -0D) == math.DBL_DENORM_MAX);
Assert.IsTrue(math.nextafter(math.DBL_DENORM_MIN, -0D) == 0D);
Assert.IsTrue(math.nextafter(0D, System.Double.PositiveInfinity) == math.DBL_DENORM_MIN);
Assert.IsTrue(math.nextafter(-0D, System.Double.NegativeInfinity) == -math.DBL_DENORM_MIN);
Assert.IsTrue(math.nextafter(0D, 0D) = 0D);
Assert.IsTrue(math.nextafter(-0D, 0D) = 0D);
Assert.IsTrue(math.nextafter(0D, -0D) = -0D);
Assert.IsTrue(math.nextafter(math.DBL_MIN, 0D) = math.DBL_DENORM_MAX);
Assert.IsTrue(math.nextafter(math.DBL_DENORM_MIN, 0D) = 0D);
Assert.IsTrue(math.nextafter(math.DBL_MIN, -0D) = math.DBL_DENORM_MAX);
Assert.IsTrue(math.nextafter(math.DBL_DENORM_MIN, -0D) = 0D);
Assert.IsTrue(math.nextafter(0D, System.Double.PositiveInfinity) = math.DBL_DENORM_MIN);
Assert.IsTrue(math.nextafter(-0D, System.Double.NegativeInfinity) = -math.DBL_DENORM_MIN);
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also