Versions Compared

Key

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

...

Function

Bounds-checking

acos(error)( x ), asin(error) ( x )

-1 <= x && x <= 1

atan2

x != 0 || y != 0

log, log10

x >= 0

pow( x, y )

x != 0 || y > 0

sqrt(error) ( x )

x >= 0

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

acos

...

( x ), asin

...

( x )

Non-Compliant Code Example

...

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 Code Example

...

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 Code Example

...