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 larger as a FLOAT. If you then assign the return value to a non-floating point variable, a rounding error might occur.
mathLib.max(
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.max(x,y);
writeStdOut(result);
// result = 5.123456, type is FLOAT
end // main()
end // program