Everything

nextafter / nextafterf / nextafterl


Calculates the next floating-point representation following d1 in the direction to d2 on the real axis.

[Format]

#include <math.h>

double nextafter(double d1, double d2);

float nextafterf(float d1, float d2);

long double nextafterl(long double d1, long double d2);

[Parameters]

d1 Floating-point value on the real axis

d2 Value indicating the direction viewed from d1, in which a representable floating-point value is to be found

[Return values]

Normal: Representable floating-point value

Abnormal: Range error: Returns HUGE_VAL, HUGE_VALF, or HUGE_VALL with the mathematically correct sign depending on the function.

[Remarks]

A range error may occur if d1 is the maximum finite value that can be represented in its type and the return value is an infinity or cannot be represented in its type.

The nextafter function group returns d2 when d1 is equal to d2.