MathLib.min returns the lesser of two numeric values.
eglx.lang
static function min(val1 smallint in, val2 smallint in) returns(smallint); static function min(val1 int in, val2 int in) returns(int); static function min(val1 bigint in, val2 bigint in) returns(bigint); static function min(val1 float in, val2 float in) returns(float); static function min(val1 smallfloat in, val2 smallfloat in) returns(smallfloat); static function min(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 smaller 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 1.111111 and the type is FLOAT:
x DECIMAL(9,6) = 1.111111; y FLOAT = 5.123456; result ANY = mathLib.min(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. |