mirror of
https://github.com/patriciogonzalezvivo/thebookofshaders
synced 2024-11-09 19:10:24 +00:00
22 lines
507 B
Markdown
22 lines
507 B
Markdown
## Abs
|
|
Return the absolute value of the parameter.
|
|
|
|
### Declaration
|
|
```glsl
|
|
float abs(float x)
|
|
vec2 abs(vec2 x)
|
|
vec3 abs(vec3 x)
|
|
vec4 abs(vec4 x)
|
|
```
|
|
|
|
### Parameters
|
|
```x``` specify the value of which to return the absolute.
|
|
|
|
### Description
|
|
```abs()``` returns the absolute value of ```x```.
|
|
|
|
<div class="simpleFunction" data="y = abs(x); "></div>
|
|
|
|
### See Also
|
|
[sign()](/glossary/?search=sign), [min()](/glossary/?search=min), [max()](/glossary/?search=max), [Chapter 05: Shaping Functions](../05/)
|