#C 语言标准库函数 totalordermagd64
#define __STDC_WANT_IEC_60559_EXT__ 1
#include <math.h>
int totalordermagd64(const _Decimal64 *a, const _Decimal64 *b);
说明
按 IEC 60559 幅度全序比较两个浮点对象。排序规则覆盖带符号零、无穷与 NaN。
全序比较可用于排序,遇到 NaN 时也有确定的排序规则。
自 C23 起提供。需要实现支持相应的 IEC 60559 浮点扩展,并在包含头文件前定义 __STDC_WANT_IEC_60559_EXT__。十进制版本还需要实现定义 __STDC_IEC_60559_DFP__。
参数
a- 指向第一个浮点操作数的指针。b- 指向第二个浮点操作数的指针。
返回值
- 若第一个值排在第二个值之前或与它等价,返回非零,否则返回零。
#示例
使用 GCC 时,在链接命令末尾添加 -lm。
#define __STDC_WANT_IEC_60559_EXT__ 1
#include <math.h>
#include <stdio.h>
int main(void)
{
_Decimal64 first = 1.0dd;
_Decimal64 second = 2.0dd;
int computed = totalordermagd64(&first, &second);
printf("%d\n", computed);
return !(computed != 0);
}
#相关接口
- 接口变体 totalordermag、totalordermagf、totalordermagl、totalordermagd32、totalordermagd128
- 相关操作 totalorderd64