Article # 554, added by Geoworks, historical record
| first | previous | index | next | last |

Testing for floating point math errors.



To test the validity of floating point math results in GEOS,
compare the exponent part of the result to FP_NAN to determine
if an error has occured.

Example:

    word CheckForFloatError( void ) {
        FloatNum num;
        word     err = 0;  /* zero signifies no error */

        FloatPopNumber( &num );
        if ( FLOAT_EXPONENT( num ) == FP_NAN ) {
            err = -1; /* error occured */
        }

          /*
           * Put the number back on the FP stack.
           */
        FloatPushNumber( &num );
        return( err );
    }