...
Code Block |
---|
float x, y, result; if( fpclassify(x) == FP_ZERO && fpclassify(y) == FP_ZERO){ /* handle domain error */ } result = atan2(y, x); |
log
...
(x), log10
...
(x)
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 x, y, result; if(fpclassify(x) == FP_ZERO && islessequal(y, 0)){ /* handle domain error condition */ } result = pow(x, y); |
Sqrt
...
(x)
Non-Compliant Solution
The following code may produce a domain error if x is negative.
...