---
title: "floor"
description: "The value rounded down to a whole number."
group: "space"
groupTitle: "Shapes, frames & warps"
categoryId: "math"
categorySlug: "math"
categoryTitle: "Math"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/math.ts#L117"
---

# floor

The value rounded down to a whole number.

```ts
floor(x: Val): Expr
```

Import `math` from `shaders/std` and use `math.floor`.

Gives the cell index when you tile a coordinate.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `x` | `Val` |  |

## Example

```ts
const column = floor(mul(uv.member('x'), params.uniforms.columns))
```

## See also

- [`fract`](/docs/primitives/math/fract) — The fractional part of a value, 0..1.
- [`ceil`](/docs/primitives/math/ceil) — The value rounded up to a whole number.

## Used by

[CarbonFiber](/docs/components/carbonfiber), [CompressionArtifacts](/docs/components/compressionartifacts), [Crystal](/docs/components/crystal), [Waveform](/docs/components/waveform)