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

nextupd128函数


概要:
#include <math.h>
#ifdef __STDC_IEC_60559_DFP__
    _Decimal128 nextupd128(_Decimal128 x);
#endif 

描述:

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

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

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

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


参数:
_Decimal128 x

参数为_Decimal128类型的浮点数。


返回值:

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


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

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

int main(void)
{
    #if __STDC_VERSION_MATH_H__ >= 202311L && defined(__STDC_IEC_60559_DFP__)
        _Decimal128 x = 3.00dl;
        printf("%.*DDf\n", DEC128_MANT_DIG, nextupd128(x));
    #else
        puts("The implementation does not support nextupd128 function.");
    #endif

    return 0;
}

输出:

The implementation does not support nextupd128 function.


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


主要参考资料:

1、ISO/IEC 9899:2024