Re: SAS/C error?
- From: mojaveg@xxxxxxxxxxxxxxxxxx (Everett M. Greene)
- Date: Wed, 30 Nov 2005 08:20:46 PST
Thomas Richter <thor@xxxxxxxxxxxxxxxxxxxxxxxxxx> writes:
> > Interesting point: What is pow(x,y) if x < 0? How does
> > one determine the sign of the result if y is not integral?
>
> Mathematically, several (up to infinity) depending on whether
> y is integer, fractional or real. These solutions are complex,
> in general, and all use the same idea:
>
> a^b = exp(log(a) * b + 2 pi i N) = cos(...) + i * sin(...)
>
> where log(a) = log(r * exp(i phi)) = log(r) + i phi
> using the polar coordinates of a. If a is real and negative, r = -a and
> phi = pi.
>
> That's of course not how the IEEE libs work. They check whether y is
> integer within the available precision, then compute x^y as (-x)^y * (+/-1)
> where the sign is -1 if y is odd, +1 otherwise. In all other cases,
> the result is a NAN.
Thanks for the info. You and Herr Stoecker seemed to have
been into the math more recently than me. I'd completely
forgotten about treating the operation as a vector. I
don't recall looking at that since I took my last EE
power class pow(2, n), n > 5, years ago.
.
- Next by Date: Looking to compile old Amiga 500 source code
- Next by thread: Looking to compile old Amiga 500 source code
- Index(es):
Relevant Pages
|