---
title: "abs"
description: "The value without its sign."
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#L105"
---

# abs

The value without its sign.

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

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

Turns a signed distance into a distance from the line, so a stroke covers both sides.

## Parameters

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

## Example

```ts
const fromLine = abs(sub(uv.member('y'), 0.5))
```

## See also

- [`sign`](/docs/primitives/math/sign) — −1, 0 or 1 by the sign of the value.
- [`neg`](/docs/primitives/math/neg) — The value with its sign flipped.

## Used by

[CarbonFiber](/docs/components/carbonfiber), [Chrome](/docs/components/chrome), [Crystal](/docs/components/crystal), [FlowingGradient](/docs/components/flowinggradient), [Heatmap](/docs/components/heatmap), [Hologram](/docs/components/hologram), [Nebula](/docs/components/nebula), [Plastic](/docs/components/plastic), [Satin](/docs/components/satin), [Water](/docs/components/water), [Waveform](/docs/components/waveform)