鲲鹏社区首页
中文
注册
我要评分
文档获取效率
文档正确性
内容完整性
文档易理解
在线提单
论坛求助

选项 -DAARCH64_QUADMATH

说明

此选项使能128位四精度浮点数库,请在使用四精度浮点数库的时候加上这个宏定义选项进行编译。

使用方法

用例:test.c

编译命令:

gcc test.c -o test.out -lquadmath -DAARCH64_QUADMATH
./test.out

test.c用例:

#include <stdio.h>
#include <math.h>
#include <quadmath.h>
 
#define USE_FLOAT128 1
 
int main()
{
#ifdef  USE_FLOAT128
    typedef __float128  long_double_t;
#else
    typedef long double long_double_t;
#endif
 
long_double_t ld=0.1;
long_double_t res;
 
int* i = (int*) &res;
i[0] = i[1] = i[2] = i[3] = 0xdeadbeef;
 
for(ld = 0.0000000000000001; ld < __LDBL_MAX__; ld += 0.0000000000000001){
    res = tanq(ld);
    printf("%08x-%08x-%08x-%08x\r", i[0], i[1], i[2], i[3]);
}
return 0;
}

结果

执行编译结果可见全部128位输出在变化,可证明128位计算已使能。