Xojo.Math.Floor

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Method

Xojo.Math.Floor() As Double

Supported for all project types and targets.

Returns the value rounded down to the nearest whole number.

Sample Code

The floor of a decimal number:

Using Xojo.Math

Dim d As Double
d = Floor(1.234) // d = 1

Because Floor will always return a whole number, to round a decimal value to a certain number of places, you must first multiple the number by 10^(the number of decimal places to which you wish to round) then take the value returned by Floor of that number and divide it by 10^(the number of decimal places to which you wish to round). In this example, the value 1.2345 is being rounded to two decimal places:

Dim d As Double
d = Xojo.Math.Floor(1.234 * 100) / 100