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

nextdownd64函数


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

描述:

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

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

如果参数x为0,nextdownd64(x)是_Decimal64类型中绝对值最小的负数。

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


参数:
_Decimal64 x

参数为_Decimal64类型的浮点数。


返回值:

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


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

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

int main(void)
{
    #if __STDC_VERSION_MATH_H__ >= 202311L && defined(__STDC_IEC_60559_DFP__)
        _Decimal64 x = 3.00dd;
        printf("%.*Df\n", DEC64_MANT_DIG, nextdownd64(x));
    #else
        puts("The implementation does not support nextdownd64 function.");
    #endif

    return 0;
}

输出:

The implementation does not support nextdownd64 function.


相关内容:
nextdown 确定double类型的小于参数的下一个可表示值的函数。
nextdownf 确定float类型的小于参数的下一个可表示值的函数。
nextdownl 确定long double类型的小于参数的下一个可表示值的函数。
nextdownd32 确定_Decimal32类型的小于参数的下一个可表示值的函数。
nextdownd128 确定_Decimal128类型的小于参数的下一个可表示值的函数。


主要参考资料:

1、ISO/IEC 9899:2024