std::nextafter, std::nexttoward

From Cppreference

Jump to: navigation, search
Defined in header <cmath>

float       nextafter( float from, float to );
(C++11 feature)
double      nextafter( double from, double to );
(C++11 feature)
long double nextafter( long double from, long double to );
(C++11 feature)
float       nexttoward( float from, long double to );
(C++11 feature)
double      nexttoward( double from, long double to );
(C++11 feature)
long double nexttoward( long double from, long double to );
(C++11 feature)

Returns the next representable value of from in the direction of to. If from equals to to, to is returned.

[edit] Parameters

from, to - floating point values

[edit] Return value

the next representable value of from in the direction of to.

[edit] Example