You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.
This shows you the differences between two versions of the page.
functions:llfabs [2014-06-19 02:11 SLT] sei [Notes] Eep! llFabs(-0.0) is -0.0 |
functions:llfabs [2015-02-04 13:07 SLT] (current) sei remove extra bracket |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | $nav | ||
===== Function: llFabs ===== | ===== Function: llFabs ===== | ||
<code lsl2> | <code lsl2> | ||
- | float llFabs(float FloatVal) | + | float llFabs(float fval) |
</code> | </code> | ||
+ | |||
+ | Return the absolute value of the parameter (for floats). | ||
===== Parameters ===== | ===== Parameters ===== | ||
- | === FloatVal === | + | === fval === |
- | Any [[types/float]] value (can be negative) | + | Any $lty[float] value (can be negative) |
===== Return value ===== | ===== Return value ===== | ||
- | Returns a [[types/float]] that is the absolute value of FloatVal, that is, the value with any negative sign removed. | + | Returns a $lty[float] that is the absolute value of $prm[fval], that is, the value with any negative sign removed. |
- | More rigorously, the result will be the same as FloatVal if FloatVal is positive or zero, and -FloatVal if it was negative. | + | More rigorously, the result will be the same as $prm[fval] if $prm[fval] is positive or zero, and $prm[-fval] if it is negative. |
===== Notes ===== | ===== Notes ===== | ||
- | * To determine the absolute value of an [[types/integer]], use [[llAbs]]. | + | * To determine the absolute value of an $lty[integer], use $lfn[llAbs]. |
- | * "Minus zero" (-0.0) is a special case of a [[types/float]] that can rarely appear in some situations. The absolute value of Minus zero is returned by this function as -0.0. This should not be a concern anyway, as minus zero is mostly transparent to all calculations (e.g. minus zero is considered equal to zero, and doesn't err when taking its square root). | + | * "Minus zero" (-0.0) is a special case of a $ty[float] that can rarely appear in some situations. The absolute value of Minus zero is returned by this function unchanged (as -0.0). This should not be a concern anyway, as minus zero is mostly transparent to all calculations (e.g. minus zero is considered equal to zero, and doesn't err when taking its square root). |
- | * The absolute value of **NaN** is **NaN**. The absolute value of **Infinity** and **-Infinity** is **Infinity**. | + | * The absolute value of $nan is $nan. The absolute value of $pinf and $minf is $pinf. |
===== Short examples ===== | ===== Short examples ===== | ||
Line 35: | Line 38: | ||
===== See also ===== | ===== See also ===== | ||
- | * [[llAbs]] takes the absolute value of an [[types/integer]]. | + | * $lfn[llAbs] takes the absolute value of an $lty[integer]. |
- | * [[llVecMag]] takes the norm (magnitude) of a [[types/vector]]. | + | * $lfn[llVecMag] takes the norm (magnitude) of a $lty[vector]. |