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

compoundnd64函数


概要:
#include <math.h>
#ifdef __STDC_IEC_60559_DFP__
    _Decimal64 compoundnd64(_Decimal64 x,long long int n);
#endif 

描述:

该函数计算(1+x)n的值。

如果x<-1,会发生域错误。取决于n的值,如果正有限的x值太大,或者x非常接近但不等于-1时,会发生范围错误。如果x=-1,并且n<0,可能发生极点错误。


参数:
_Decimal64 x

参数为_Decimal64类型的浮点数。

long long int n

参数为long long int类型的整数。


返回值:

函数返回(1+x)n。


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

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

int main(void)
{
    #if __STDC_VERSION_MATH_H__ >= 202311L && defined(__STDC_IEC_60559_DFP__)
        _Decimal64 x = 5.0dd,y;
        long long int n = 2LL;

        y = compoundnd64(x,n);
        printf("compoundnd64(%.6Df,%lld) = %.6Df\n", x,n,y);
    #else
        puts("The implementation does not support compoundnd64 function.");
    #endif

    return 0;
}

输出:

The implementation does not support compoundnd64 function.


相关内容:
compoundn double类型的返回(1+x)n的函数。
compoundnl long double类型的返回(1+x)n的函数。
compoundnf float类型的返回(1+x)n的函数。
compoundnd32 _Decimal32类型的返回(1+x)n的函数。
compoundnd128 _Decimal128类型的返回(1+x)n的函数。


主要参考资料:

1、ISO/IEC 9899:2024