modf(var x, var* p): var

Splits x in a fractional and integer part, each of which has the same sign as x.

Parameters:

x - any number.
p - var pointer, or 0 if the integer part is not needed.

Returns:

Fractional part of x. Integer part is stored in *p.

Speed:

Fast

Example:

var y;
var x = modf(123.456,&y); // x = 0.456 and y = 123.0 

See also:

floor, ceil, fmod, %

► latest version online