# llFabs

*LSL function*

```lsl
float float llFabs(float val);
```

- `float val`: Number to convert.

- Returns: `float`
- Energy: 10

Returns a [float](https://wiki.secondlife.com/wiki/float) that is the positive version of **val**.

```lsl title="How to use" frame="terminal"
float result = llFabs(0.0);
```

## Examples

<details open>
<summary>Example 1</summary>

```lsl
default
{
    state_entry()
    {
        llSay(0,"The (Float)absolute value of -4.5 is: "+(string)llFabs(-4.5) );
    }
}
// returns :
// The (Float)absolute value of -4.5 is: 4.500000
```

</details>

## Notes

- Using `val-2*val*(val<0)` is roughly 60% faster than `llFabs` as it avoids a function call, though it produces NaN if given an infinite value and (correctly) returns 0.0 instead of -0.0 when taking the absolute value of negative zero.

## Known issues

From the issue templates included by the wiki article:

- SCR-439 (bug): **Mono only:** llFabs of Negative Zero is negative, should be positive.

## See also

### Functions

- [llAbs](/functions/llAbs/) — [integer](https://wiki.secondlife.com/wiki/integer) version of `llFabs`

### Articles

- [Absolute value](https://en.wikipedia.org/wiki/Absolute_value)

---

*Source: [LlFabs](https://wiki.secondlife.com/wiki/LlFabs) on the Second Life Wiki. Content from the Second Life Wiki articles LlFabs (revision 1215185, 2023-10-28) and Template:Issues/SCR-439 (revision 1173257, 2012-10-08), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llFabs/
