SetDenormAreZeros
启用或禁用刷零模式:
HmppResult HMPP_SetDenormAreZeros (int32_t value);
参数
参数名 |
描述 |
取值范围 |
输入/输出 |
---|---|---|---|
value |
|
int32_t值范围 |
输入 |
返回值
- 成功:返回HMPP_STS_NO_ERR。
- 失败:返回错误码。
错误码
错误码 |
描述 |
---|---|
HMPP_STS_NOT_SUPPORT |
当前系统不是aarch64架构,不支持此函数。 |
示例
#define LEN 4 void SetDenormAreZeros_Example() { HmppResult result = HMPP_SetDenormAreZeros(1); cout << HMPP_GetStatusString(result) << endl; const float a[LEN] = {0.99 * pow(2, -126), 1.0 * pow(2, -126), 1.5 * pow(2, -126), 1.5 * pow(2, -126)}; const float b[LEN] = {0.99 * pow(2, -126), 0.99 * pow(2, -126), 1.4 * pow(2, -126), -1.4 * pow(2, -126)}; for (int32_t i = 0; i < LEN; ++i) { cout << a[i] + b[i] << endl; } result = HMPP_SetDenormAreZeros(0); cout << HMPP_GetStatusString(result) << endl; for (int32_t i = 0; i < LEN; ++i) { cout << a[i] + b[i] << endl; } }
运行结果:
No Error 0 1.17549e-38 3.40893e-38 0 No Error 2.32748e-38 2.33923e-38 3.40893e-38 1.17549e-39
父主题: 基础函数