From Xojo Documentation

Revision as of 18:23, 26 July 2017 by PLefebvre (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Floor(value as Double) As Double

Supported for all project types and targets.

Returns the value specified rounded down to the nearest whole number.


result = Floor (value)

Part Type Description
result Double The floor of value.
value Double The value you want the floor of.


The result of this function is a Double, but it will always contain a whole number.


This example uses the Floor function to return floor of a number.

Dim d As Double
d = Floor(1.234) // returns 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 = Floor(1.234 * 100) / 100

See Also

Ceil, Round functions.