NthRoot
The function NthRoot returns the result of aValue inversely raised to the power of aN.
In mathematical terms, aN is the exponent value known as the index shown as a below, and aValue is the radicand shown as b.

Using 100 as the sample radicand value, if the exponent value is 2 (10 x 10) -

If the exponent value is 3 ((10 x 10) x 10) -

If the exponent is 4 (((10 x 10) x 10) x 10) -

Using the NthRoot function, these all result in 10, and would be written as -
NthRoot(2, 100)
NthRoot(3,1000)
NthRoot(4, 10000)
If the result is a nonsense or imaginary number, the result will be the value NAN which is an acronym for Not A Number.
Please also refer to the function Power which has similar functionality.
Declaration: Function NthRoot(const aN : Integer; const aValue : Extended) : Extended;
Examples follow.
procedure
ScriptEvent (
var
Value : variant);
var
NewInt :
integer
;
NewExt, NextExt :
extended
;
begin
NewInt :=
3
;
//Looking for the cube root
NewExt :=
1000
;
NextExt := NthRoot(NewInt, NewExt);
LogInfo(
'Result = '
+FloatToStr(NextExt));
//Displays 'Result = 10'
LogInfo(
''
);
NewInt :=
2
;
NewExt := -
1
;
//Returns i (an imaginary number)
NextExt := NthRoot(NewInt, NewExt);
LogInfo(
'Result = '
+FloatToStr(NextExt));
//Displays 'Result = NAN'
LogInfo(
''
);
end
;