Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

...

(error), log10

...

(error)

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

...

(error)

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);

...