The mathLib.min() system function returns the lesser of two numbers (or numeric expressions).
When the two numbers are different types, EGL promotes the smaller type (in terms of bytes) to the larger. For example, if you compare a BIGINT to a FLOAT, EGL compares the numbers as FLOATs, and returns the smaller as a FLOAT. If you then assign the return value to a non-floating point variable, a rounding error might occur.
mathLib.min(
numericVariable1 SMALLINT | INT | BIGINT |
DECIMAL | SMALLFLOAT | FLOAT in,
numericVariable2 SMALLINT | INT | BIGINT |
DECIMAL | SMALLFLOAT | FLOAT in)
returns (result SMALLINT | INT | BIGINT |
DECIMAL | SMALLFLOAT | FLOAT)
package com.companyb.customer;
Program calc2
Function main()
x DECIMAL(9,6) = 5.123456;
y FLOAT = 1.11111111111;
result ANY;
result = mathLib.min(x,y);
writeStdOut(result);
// result = 1.11111111111, type is FLOAT
end // main()
end // program