## LSL Wiki : llPow

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl836.us.archive.org
float llPow(float base, float exp)

Returns base raised to the exp.

Example:
```llSay(0,(string)llPow(3.0, 2.0)); // returns 9 (3*3)
llSay(0,(string)llPow(4.0, 5.0)); // returns 1024 (4*4*4*4*4)```

Remember, roots can be expressed as powers. For example,
```llSqrt(4.0);        //Using the math library's square root function
llPow(4.0, 1.0/2.0);    //Using a power to return a square root```

This means that one can manage a cube root, or any other root. A cube root would be expressed as
`llPow(27.0, 1.0/3.0);`

This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Math
llPow(10000,3) = 999999995904.000000
llPow(100000,3) = 999999986991104.000000
And I checked if 10000.0 * 10000.0 * 10000.0 might do something different, and it doesn't. Is there some way I can get accurate math?
-- HotTempura (2005-12-28 14:17:24)
Im afraid not, short of making your own floating-point manipulation functions using strings or lists (talk to JeffreyGomez about something like thsi). LSL floats are notorious for being nasty concerning precise small and extremely large values.
-- ChristopherOmega (2005-12-28 20:01:10)
^^' i might be the person to talk to...
lsl uses single persision ieee floats; http://stevehollasch.com/cgindex/coding/ieeefloat.html (my favorite IEEE float site)
if they gave us doubles life would be wonderful.

Any functions you write will be slow. If you want somewhere to start, take a look at "fui" and "iuf" on my user page, they mathamaticaly convert a float to an integer and vice versa in such a way that the integer is treated as the memory representation of the float. The functions *could* be expanded to support doubles.
-- BlindWanderer (2005-12-29 16:26:07)
Psst, math works JUST fine with out ".0" all over the place--and it's a LOT easier to read and follow...
-- EepQuirk (2006-03-07 02:27:15)
Well that is stupid then, and you'll want to mention that when doing integer vs. float calculations.
-- EepQuirk (2006-03-08 05:19:37)
Note that XXXX. is equivalent to XXXX.0
-- SimonRaven (2007-06-04 16:28:03)