MathLib.max returns the greater of two numeric values.
eglx.lang
static function max(val1 smallint in, val2 smallint in) returns(smallint); static function max(val1 int in, val2 int in) returns(int); static function max(val1 bigint in, val2 bigint in) returns(bigint); static function max(val1 float in, val2 float in) returns(float); static function max(val1 smallfloat in, val2 smallfloat in) returns(smallfloat); static function max(val1 decimal in, val2 decimal in) returns(decimal);
When the two numbers are of different types, EGL promotes the one with fewer bytes to the larger. For example, if you compare a BIGINT to a FLOAT, EGL compares the numbers as FLOATs and returns the larger of the two as a FLOAT. A rounding error might occur if you assign the FLOAT to a variable of another type.
After the following code runs, the value of result is 5.123456 and the type is FLOAT:
x DECIMAL(9,6) = 5.123456; y FLOAT = 1.111111; result ANY = mathLib.max(x,y);
In the case of Java™, EGL uses methods in the Java StrictMath class that are equivalent to the EGL functions. This usage ensures that the runtime behavior is the same for every Java Virtual Machine.
| Target | Issue |
|---|---|
| Java | No issues. |
| JavaScript | No issues. |