Re: Power arithmetic function to C#
- From: "Maarten Wiltink" <maarten@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 29 Mar 2006 17:58:18 +0200
"Hanford Carr @lmcinvestments.com>" <"hwcarr<nospam> wrote in message
news:442AA500.1B176517@xxxxxxxxxxxxxxxxxxxxx
Tom de Neef wrote:
"SunYour" <sunyour@xxxxxxxxxxx> schreef in bericht
news:1143584822.163480.194610@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Does anyone know how the Power arithmetic function works? I need to
define my own Power function in c# and need to know how to implement
it.
z = x ** y
ln(z) = y * ln(x)
z = exp(ln(z)) = exp(y * ln(x))
function Power(const Base, Exponent: Extended): Extended;
// base ** exponent for base >0
begin
if base>0
then result:=exp(exponent*ln(base))
//if x = 0 then z = 0, no need to have an error for that.
If y = 0 then z=1 first.
else if base = 0
then result := 0
else error
end;
Groetjes,
Maarten Wiltink
.
- Follow-Ups:
- Re: Power arithmetic function to C#
- From: SunYour
- Re: Power arithmetic function to C#
- References:
- Power arithmetic function to C#
- From: SunYour
- Re: Power arithmetic function to C#
- From: Tom de Neef
- Re: Power arithmetic function to C#
- From: Hanford Carr
- Power arithmetic function to C#
- Prev by Date: Re: Help for actionmanager and actionmainmenubar component.
- Next by Date: Re: Fast Track towards using an existing application on the Internet
- Previous by thread: Re: Power arithmetic function to C#
- Next by thread: Re: Power arithmetic function to C#
- Index(es):