当前位置: C语言 -- 标准库 -- <math.h> -- nextupl

nextupl函数


概要:
#include <math.h>
long double nextupl(long double x);

描述:

该函数确定long double类型的、大于参数x的下一个可表示值。

如果参数x是long double类型中绝对值最小的负数,并且实现支持有符号0,则nextupl(x)为–0;否则nextupl(x)为0。

如果参数x为0,nextupl(x)是long double类型中绝对值最小的正数。

如果参数x是long double类型中绝对值最大的正数(有限值或者无穷大。),nextupl(x)等于参数x。


参数:
long double x

参数为long double类型的浮点数。


返回值:

函数返回long double类型的、大于参数x的下一个可表示值。


范例:
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
/*函数nextupl范例*/

#include <float.h>
#include <math.h>
#include <stdio.h>

int main(void)
{
    #if __STDC_VERSION_MATH_H__ >= 202311L
        long double x = 3.00L;
        printf("%.*Lf\n", (LDBL_DECIMAL_DIG-1), nextupl(x));
    #else
        puts("The implementation does not support nextupl function.");
    #endif

    return 0;
}

输出:

The implementation does not support nextupl function.


相关内容:
nextup 确定double类型的大于参数的下一个可表示值的函数。
nextupf 确定float类型的大于参数的下一个可表示值的函数。
nextupd32 确定_Decimal32类型的大于参数的下一个可表示值的函数。
nextupd64 确定_Decimal64类型的大于参数的下一个可表示值的函数。
nextupd128 确定_Decimal128类型的大于参数的下一个可表示值的函数。


主要参考资料:

1、ISO/IEC 9899:2024