Unofficial LSL Reference

[[functions:llsqrt]]


Unofficial LSL reference

User Tools

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

Forgotten your password? Get a new one: Set new password

This is an old revision of the document!


Function: llSqrt

float llSqrt(float fval)

Return the square root of the argument, that is, the number that multiplied by itself gives the argument.

Parameters

fval

The float value to take the square root of.

Result

The square root of the given float.

Notes

  • If you need the square root of 2, using SQRT2 instead of calling this function will save code and processing time.
  • Any value less than zero will return NaN under Mono and crash with a math error under LSO.

Short examples

float f;
f = llSqrt(4); // sets f to 2.0 because 2*2=4
f = llSqrt(25); // sets f to 5.0 because 5*5=25
f = llSqrt(-1); // sets f to NaN (Not a Number) under Mono; crashes under LSO

See also

  • llPow raises a number to any power.
  • SQRT2 is a constant with the square root of 2.