Gambas Documentation - /comp/gb.gsl/gsl/fcmp

/comp/gb.gsl/gsl/fcmp

# GSL.Fcmp (gb.gsl)

Static Function Fcmp ( X As Float, Y As Float, E As Float ) As Integer

This function determines whether X and Y are approximately equal to a relative accuracy epsilon E.

The relative accuracy is measured using an interval of size 2D, where `D = (2 ^ K) E` and `K` is the maximum base-2 exponent of X and Y as computed by the C function `frexp`.

- If X and Y lie within this interval, they are considered approximately equal and the function returns `0`.

- If X < Y, the function returns `-1`.

- If X > Y, the function returns `+1`.

Note that X and Y are compared to relative accuracy, so this function is not suitable for testing whether a value is approximately zero.