Apama 10.7.2 | Developing Apama Applications | EPL Reference | Types | Support for IEEE 754 special values
 
Support for IEEE 754 special values
EPL supports the following IEEE 754 special float and decimal values:
*NaN — In EPL, these are quiet NaNs. The string representation is "NaN".
*+Infinity — The string representation is "Infinity".
*-Infinity — The string representation is "-Infinity".
The correlator returns one of these values as the result of an invalid computation. For example, dividing zero by zero or calculating the square root of a negative number. The correlator returns infinities as the result of computations that overflow, for example, taking a very large number and dividing it by a very small number.
The correlator can receive external events that contain these special values. You can send, route, emit, and enqueue events that contain these values. If the correlator receives an event that contains a floating point value that is too large to be represented as a 64-bit floating point number, the behavior is as if the value had overflowed and the correlator represents the value as infinity.
See the descriptions of decimal and float in the API Reference for EPL (ApamaDoc) for more information.
The following operations return NaN:
*0.0/0.0
*x.sqrt() (if x < 0)
*x.ln() (if x < 0)
*x.log10() (if x < 0)
*Infinity - Infinity
*0.0 * Infinity
In addition, most operations that accept NaN as a parameter return NaN. For example:
*NaN.exp() = NaN
*NaN + 3.0 = NaN
The NaN value behaves differently when compared to other floating point numbers. NaN does not compare equal to any other number, including itself. It is unordered with respect to all other floating point numbers, so NaN < x and NaN > x are both false.
The following operations return positive infinity (note that IEEE 754 has signed zeroes):
*x/0.0 (if x > 0)
*x/-0.0 (if x < 0)
*Infinity.sqrt()
The following operations return negative infinity:
*x/0.0 (if x < 0)
*x/-0.0 (if x > 0)
*(0.0).ln()
The constants that are supported by EPL ensure consistent values, and a few have been provided for convenience. For a list of all available constants, see the descriptions of decimal, float and integer in the API Reference for EPL (ApamaDoc) .
Operations where rounding is required use the IEEE standard approach of round half to even (also known as banker's rounding).