×
A new build of Corona SDK is now available to subscribers. Not a subscriber? Subscribe now.
CoronaSDK 2014.2439 | Released: 19 Sep 2014, 1:36am | What's New | Download Now

math.modf()

Description:

Return the integral and fractional parts of a number.
Note: For the modulus (remainder), use the modulo operator % instead.

Syntax:

math.modf (x)

Example:

print (math.modf(5))     ---->  5       0
print (math.modf(5.3))   ---->  5       0.3
print (math.modf(-5.3))  ----> -5      -0.3

Parameters:

x
A number.

Returns:

Two numbers, the integer part and the fractional parts of x.
Each part has the same sign as x.

Remarks:
Supported on operating systems and platforms for build numbers shown:
  • Mac OS X:
    Corona SDK 1.0
  • Windows:
    Corona SDK 2.0
  • iOS:
    Corona SDK 1.0
  • Android:
    Corona SDK 2.0