Apama Documentation : 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.
The following operations return NaN:
*0.0/0.0
*x.sqrt() (where x < 0)
*x.ln() (where x < 0)
*x.log10() (where 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 (where x > 0)
*x/-0.0 (where x < 0)
*Infinity.sqrt()
The following operations return negative infinity:
*x/0.0 (where x < 0)
*x/-0.0 (where x > 0)
*(0.0).ln()
The following table lists the available constants. These are provided to ensure consistent values, and a few have been provided for convenience.
Constant
Value
decimal.E
float.E
Euler's number, e.
decimal.PI
float.PI
The ratio of a circle's circumference to its diameter (3.14159265).
decimal.MIN
float.MIN
The smallest, positive, normalized floating point number (~2e-308).
decimal.MAX
float.MAX
The largest, finite, positive floating point number (~2e+308).
decimal.EPSILON
float.EPSILON
The smallest x where (1+x) > 1. Note that decimal.EPSILON and float.EPSILON are not the same value. The value is dependent on whether the type is decimal or float.
decimal.NAN
float.NAN
IEEE 754 Not-a-Number.
decimal.INFINITY
float.INFINITY
IEEE 754 positive infinity.
integer.MAX
Largest positive value an integer can take (263 - 1).
integer.MIN
Largest negative value an integer can take (-263).
Special cases of pow()
In the normal case, x.pow(y) yields exactly what you might expect, so 3.0.pow(3.0) = 27.0 and 2.0.pow(0.5) = 1.41421. But there are a very large number of special cases. The documentation for fdlibm, which is the mathematics library used by the EPL interpreter for float types lists the special cases shown below. Although EPL uses a different math library for decimal types, the behavior is the same for float and decimal types.
*(anything)0 = 1
*(x)1 = x, for any x
*(anything)NaN = NaN
*NaN(anything except 0) = NaN
*x+∞ = +∞, if |x| > 1
*x-∞ = +0, if |x| > 1
*x+∞ = +0, if |x| < 1
*x-∞ = +∞, if |x| < 1
*±1±∞ = NaN
*+0(+anything except 0 and NaN) = +0
*-0(+anything except 0, NaN and odd integer) = +0
*+0(-anything except 0 and NaN) = +∞
*-0(-anything except 0, NaN and odd integer) = +∞
*-0(odd integer) = -( +0(odd integer) )
*+∞(+anything except 0 and NaN) = +∞
*+∞(-anything except 0 and NaN) = +0
*-∞(anything) = -0(-anything)
*(-anything)(integer) = (-1)(integer)*(+anything(integer))
*(-anything except 0 and ∞)(non-integer) = NaN
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback