Versions Compared

Key

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

...

The calling function should take alternative action if these bounds are violated.

Non-Compliant Example

The following code may produce a domain error if x is zero and y less than or equal to zero. A range error may also occur if x is zero and y is negative.

Code Block
float x, y, result;

result = pow(x,y);

Compliant Solution

The following code tests x and y to ensure that there will be no range or domain errors.

Code Block
float x, y, result;

if(x == 0 && y <=0){
     /* handle domain error condition */
}

result = pow(x, y);

...