SetDenormAreZeros
Enable or disable the flush-to-zero (FTZ) mode:
HmppResult HMPP_SetDenormAreZeros (int32_t value);
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
value |
|
int32_t |
Input |
Return Value
- Success: HMPP_STS_NO_ERR
- Failure: An error code is returned.
Error Codes
Error Code |
Description |
|---|---|
HMPP_STS_NOT_SUPPORT |
The current system does not use the AArch64 architecture and does not support this function. |
Example
#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;
}
}
Output:
No Error 0 1.17549e-38 3.40893e-38 0 No Error 2.32748e-38 2.33923e-38 3.40893e-38 1.17549e-39
Parent topic: Basic Functions