NextAfter - Maple Help

NextAfter

return the next representable number after x

 Calling Sequence NextAfter(x, y)

Parameters

 x - expression y - expression

Description

 • The NextAfter(x, y) function returns the next machine representable number after x in the direction toward y, where "machine" means either the software floating-point computation environment determined by Digits, or the hardware floating-point computation environment of the underlying physical hardware.
 • Which floating-point environment is used depends on the type of x. If x is a hardware floating-point value (see HFloat), the hardware floating-point environment is used. Otherwise the software floating-point environment is used.
 • If $x=y$ and x and y are real extended_numeric, then NextAfter(x, y) = x and no exception is signaled (this specifically includes the case when $x=0$, even when x and y are differently signed).
 • If either of x or y is undefined, the result is one of the input undefineds.
 • If x is the largest machine representable number and $x, then NextAfter(x, y) = infinity and the overflow event is signaled.
 • If x is the smallest positive machine representable number and $y, then NextAfter(x, y) = +0, and the underflow event is signaled. Similarly, NextAfter(-x, -y) = -0.
 • If y is unordered with x (i.e., Unordered(x, y) returns true), but neither is undefined, an invalid_operation is signaled.

 • The NextAfter command is thread-safe as of Maple 15.

Examples

 > $\mathrm{NextAfter}\left(0,0\right)$
 ${0}$ (1)
 > $\mathrm{NextAfter}\left(0,-1\right)$
 ${-1.}{×}{{10}}^{{-11}}$ (2)
 > $\mathrm{NextAfter}\left(0,1\right)$
 ${1.}{×}{{10}}^{{-11}}$ (3)
 > $\mathrm{NextAfter}\left(0.2,1\right)$
 ${0.2000000001}$ (4)
 > $\mathrm{NextAfter}\left(\mathrm{HFloat}\left(2.3\right),10\right)$
 ${2.30000000000000}$ (5)
 > $\mathrm{Digits}≔20$
 ${\mathrm{Digits}}{≔}{20}$ (6)
 > $\mathrm{NextAfter}\left(0.2,1\right)$
 ${0.20000000000000000001}$ (7)