MyChat Scripts Engine: Exp
Computing an exponent from a specified number.
Syntax
function Exp(x: extended): extended;
Parameters and return values
Parameter |
Type |
Value |
x |
extended |
number from which you need to compute an exponent. |
Function result
Exponent value.
Example
function Power(y, x: integer): int64;
begin
result := round(Exp(x * Ln(y)));
end;
var
i: integer;
begin
for i := 1 to 16 do
mLogScript(inttostr(Power(2, i)), '2^' + inttostr(i));
end.
Script work result
[21:47:02] (Log "Exp"): [2^1] 2
[21:47:02] (Log "Exp"): [2^2] 4
[21:47:02] (Log "Exp"): [2^3] 8
[21:47:02] (Log "Exp"): [2^4] 16
[21:47:02] (Log "Exp"): [2^5] 32
[21:47:02] (Log "Exp"): [2^6] 64
[21:47:02] (Log "Exp"): [2^7] 128
[21:47:02] (Log "Exp"): [2^8] 256
[21:47:02] (Log "Exp"): [2^9] 512
[21:47:02] (Log "Exp"): [2^10] 1024
[21:47:02] (Log "Exp"): [2^11] 2048
[21:47:02] (Log "Exp"): [2^12] 4096
[21:47:02] (Log "Exp"): [2^13] 8192
[21:47:02] (Log "Exp"): [2^14] 16384
[21:47:02] (Log "Exp"): [2^15] 32768
[21:47:02] (Log "Exp"): [2^16] 65536
[21:47:02] (Run "Exp"): Script operation time: 5 ms
[21:47:02] (Run "Exp"): Script done successfully.