...
Code Block |
---|
float x, result; if( x <= islessequal(x,-1) || isgreaterequal(x, >=1) 1){ /* handle domain error */ } result = acos(x); |
...
Code Block |
---|
float x, y, result; if( fpclassify(x) == 0FP_ZERO && fpclassify(y) == 0FP_ZERO){ /* handle domain error */ } result = atan2(y, x); |
log
...
, log10
...
Non-Compliant Example
The following code may produce a domain error if x is negative and a range error if x is zero.
...
Code Block |
---|
float result, x; if(islessequal(x, <=0)){ /* handle domain and range errors */ } result = log(x); |
...
Code Block |
---|
float x, y, result; if(fpclassify(x) == 0FP_ZERO && islessequal(y, <=0)){ /* handle domain error condition */ } result = pow(x, y); |
Sqrt
...
Non-Compliant Solution
The following code may produce a domain error if x is negative.
...
Code Block |
---|
float x, result; if(isless(x <, 0)){ /* handle domain error */ } result = sqrt(x); |
...