How can I calculate the square root of a number in Inno Setup?
-
Inno Setup is for installing software. Why would you need to calculate square root using it? It supports things that are done during software installation, and allows some extension with its scripting support. I see no reason it would calculate SQR, because there's no reason (at least that I can see) to do that with a software installer.– Ken WhiteMay 25, 2013 at 21:30
-
I have a simple serial check that uses Sqrt validation. I need to implement in Inno Setup routine validation.– user2421145May 26, 2013 at 0:44
-
Resolvido: recorre := 144; for I := 0 to 9 do begin recorre := recorre / 2 + 144 / (2 * recorre); end;– user2421145May 26, 2013 at 1:15
-
1You should add more information (the rest of the scripting code) and post it as an answer to the question. That's allowed here. :-) You can even accept it as the correct solution after a period of time.– Ken WhiteMay 26, 2013 at 1:23
Add a comment
|
1 Answer
After studying a bit the field of mathematics, could do the calculation.
//Sqtr calc
Function SqtrCalc(n : Single) : Single;
Var
I: Integer;
y: Single;
Begin
y := n;
for I := 0 to 9 do
begin
y := y / 2 + n / (2 * y);
end;
Result := y;
End;