×
A new build of Corona SDK is now available to subscribers. Not a subscriber? Subscribe now.
CoronaSDK 2014.2260 | Released: 15 Apr 2014, 3:25pm | What's New | Download Now

math.fmod()

Description:

Returns the remainder of the division of the arguments that rounds the quotient towards zero.

The remainder of a division operation is the result of subtracting the integral quotient multiplied by the denominator from the numerator:

remainder = numerator - quotient * denominator

Syntax:

math.fmod (x, y)

Example:

print (math.fmod(5.3, 2))     ---> 1.3
print (math.fmod(1, 0))    ---> nan

Parameters:

x
The division numerator.

y
The division denominator.

Returns:

A number.

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