Has anyone found a method to take the cubed root of something? (root 3)
I see a square root function, but no other way to handle a larger root. Root 3 is really handy as it allows the kind of curve I want for a function I am running.
Anyone skilled enough in math to be able to help me cube root a number using a custom function?
NWScript Math. taking the cube root....
Débuté par
henesua
, juil. 26 2012 04:03
#1
Posté 26 juillet 2012 - 04:03
#2
Posté 26 juillet 2012 - 04:41
Use the Pow function:
// Maths operation: fValue is raised to the power of fExponent
// * Returns zero if fValue ==0 and fExponent <0
float pow(float fValue, float fExponent)
The Cube root of X is the same thing as X to the 1/3 Power. So to get the cube root of X you would use.
Pow ( x, 1.0/3.0);
// Maths operation: fValue is raised to the power of fExponent
// * Returns zero if fValue ==0 and fExponent <0
float pow(float fValue, float fExponent)
The Cube root of X is the same thing as X to the 1/3 Power. So to get the cube root of X you would use.
Pow ( x, 1.0/3.0);
Modifié par Lightfoot8, 26 juillet 2012 - 04:42 .
#3
Posté 26 juillet 2012 - 04:44
Ah.... I did not realize you could do that. Thats great, thanks.
#4
Posté 27 juillet 2012 - 03:55
Didn't realize nwscript had a pow function. Learn something new every day.





Retour en haut







