Re: [pure-lang-users] math.pure
Status: Beta
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2008-08-22 13:54:19
|
Eddie Rucker wrote: > Oh shame shame. No sweat. With all that administrative crap on your schedule right now, I wonder how you can still think at all. ;-) > Still mortified over that last one but mzscheme gives the following: > For x < 0, > > (expt -4.0 -inf.0) > 0.0 > > (expt -4.0 +inf.0) > +inf.0 Yes, in fact that's what the C pow() function gives you (or c_pow in Pure). The first result actually makes sense, but not the second. :) However, Pure's (^) operator deals with negative bases by returning a complex result (nan+:nan in this case); other function like sqrt work analogously. > For complex x, > > (expt 1+2i -inf.0) > +nan.0+nan.0i > > (expt 1+2i +inf.0) > +nan.0+nan.0i Pure behaviour is the same here. I'm beginning to think that Scheme makes more sense in that it returns complex results for complex inputs, and real results (possibly nan for undefined cases) for real inputs. The necessary changes to do it the Scheme way in Pure should in fact be straightforward. Is that what everybody wants? I also have to do something about (0+:0)^0; it returns nan+:nan now, which isn't appropriate. Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |