Subject: Re: Imagine All the Numbers, Living For...
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 04 Jul 2008 20:16:14 -0500
Newsgroups: comp.lang.lisp
Message-ID: <_fSdnRiLL4DDVvPVnZ2dnUVZ_oDinZ2d@speakeasy.net>
Vassil Nikolov  <vnikolov+usenet@pobox.com> wrote:
+---------------
| For example, the result of (PURE-IMAGINARY-P (EXPT -1 1/2)) is
| implementation-dependent.  We have to at least consider replacing
| ZEROP with a proximity-to-0 test...
+---------------

Indeed! On my favorite implementation, for example:

    > (sqrt -1d0)

    #C(0.0 1.0)
    > (* * *)

    #C(-1.0 0.0)
    > (pure-imaginary-p **)

    T
    > (expt -1d0 0.5d0)

    #C(6.123031769111886e-17 1.0)
    > (* * *)

    #C(-1.0 1.2246063538223773e-16)
    > (pure-imaginary-p **)

    NIL
    > 

Sure, it might be nice if EXPT special-cased the exponent 0.5 to
use SQRT, but I wouldn't necesarily call the above behavior "wrong".


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607