Method

# Floor

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

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

## Usage

``` xojo
result = Floor(value)
```

| Part   | Type                             | Description                                          |
|--------|----------------------------------|------------------------------------------------------|
| result | `Double</api/data_types/double>` | The <span class="title-ref">floor</span> of *value*. |
| value  | `Double</api/data_types/double>` | The value you want the floor of.                     |

## Notes

The result of this function is a `Double</api/data_types/double>`, but it will always contain a whole number.

## Sample code

This example uses the <span class="title-ref">Floor</span> function to return <span class="title-ref">Floor</span> of a number.

``` xojo
Var d As Double
d = Floor(1.234) ' returns 1
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Because <span class="title-ref">Floor</span> 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 <span class="title-ref">Floor</span> 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:

``` xojo
Var d As Double
d = Floor(1.234 * 100) / 100
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Ceiling</api/math/ceiling>`, `Round</api/math/round>` functions.

</div>
