TIP: Click on subject to list as thread! ANSI
echo: delphi
to: DAN UGRIN
from: BRYAN SMITH
date: 1996-05-18 13:08:00
subject: Dll speed

On 15 May 96 Dan Ugrin said to Justin Marquez...
 DU> Number**Power in Fortran translates to Exp(Ln(Number)*Power) in Pascal.
It might be better to put that expression within a function that can detect
and handle the pathological cases.  For example, -3.5 raised to the power 3
exists, but the above expression will crash trying to find the Ln of a
negative number.
The following untested prototype is based on my memories of high-school
math, check it out before you use it (I'm not sure if 0**0 is 0 or 1)  ...
If Power = 0.0 then result = 1.0 { anything to power 0 is one ? }
else if Number = 0.0 then result = 0.0
else if Number > 0.0 then result := Exp(Ln(Number)*Power)
else if (Frac(Power) = 0.0) then { Power is Integer }
begin
  result := 1.0 ;
  for j := 1 to Trunc(Abs(Power)) do result := result * Number ;
  if Power < 0.0 then result := 1.0/result ;
end
else { report failure } ;
--- PPoint 2.00
---------------
* Origin: Kingston, Canada (1:249/109.11)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.