modf()

The mathLib.modf() system function splits a number into an integer and a fraction, both with the same sign as the original number. The fraction is returned in result and the integer is returned in numericVariable2.

Syntax

  mathLib.modf(
    numericVariable1 FLOAT in,
    numericVariable2 SMALLINT | INT | BIGINT out)
  returns (result FLOAT) 
numericVariable1
Input can be any variable or expression that is assignment compatible with the FLOAT type (see "Assignment compatibility in EGL").
numericVariable2
The integer part of numericVariable1 (everything to the left of the decimal point) is placed in numericVariable2, which is one of the integer variable types.
result
The fractional part of numericVariable1 (the decimal point and everything to the right of it) is returned as a FLOAT value.

Example

  y INT;
  x, result SMALLFLOAT;
  x = 23.5678;
  result = mathLib.modf(x,y);
  writeStdOut(result);
  writeStdOut(y);
  // result = .5678, y=23

Feedback