Phil Carmody on Wed, 05 Oct 2005 15:23:10 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Fwd: Incorrect conversion of unnormalized IEEE doubles


--- kynn@panix.com wrote:
> >   print Math::Pari::PARI( POSIX::DBL_MIN()/2 )
> >   1.668805393880401037E-308
> > 
> > ...which is actually POSIX::DBL_MIN*(3/4).  This represents a relative
> > error of 50%, which is far from negligible.
> > 
> > It appears that Math::Pari::PARI is converting numbers of the form
> > 
> >   POSIX::DBL_MIN()/2**$n
> > 
> > (where $n is a positive integer) into numbers of the form
> > 
> >   POSIX::DBL_MIN()*((2**$n)-1)/(2**(-$n-1))

Is division by 2 handled as a special case involving shifts, 
as it sounds like a signed shift preserving a top bit where 
an unsigned shift should be performed.

Phil

()  ASCII ribbon campaign      ()    Hopeless ribbon campaign
/\    against HTML mail        /\  against gratuitous bloodshed

[stolen with permission from Daniel B. Cristofani]


		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com