function Power(const Base, Exponent: Extended): Extended;
begin
if Exponent = 0.0 then
Result := 1.0 { n**0 = 1 }
else if (Base = 0.0) and
(Exponent > 0.0) then
Result := 0.0 { 0**n = 0, n > 0 }
else if (Frac(Exponent) = 0.0)
and (Abs(Exponent) <= MaxInt) then
Result := IntPower(Base,
Integer(Trunc(Exponent)))
else
Result := Exp(Exponent *
Ln(Base))
end;
|