Bill Allombert on Thu, 12 May 2005 21:34:40 +0200


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

Re: erfc() behavior change


On Thu, May 12, 2005 at 11:49:27AM -0400, Igor Schein wrote:
> On Thu, May 12, 2005 at 12:13:15PM +0200, Bill Allombert wrote:
> 
> > Someone should check whether exp() given the same precision in 2.2.9 and
> > 2.2.10. I am afraid the use of Newton iterations for large precisions
> > might break that...
> 
> \\ 2.2.9
> ? precision(exp(-2^10))
> 462
> \\ 2.2.10
> ? precision(exp(-2^10))
> 38

You hit bug 2.2.10/F40:

   40- [library:] precision() output "wrong" value for small non-zero t_REAL
       (depended on exponent, not the bit accuracy of the input). Change so
       that true bit accuracy is used unless input is 0 (then use exponent).

Use myprec below as a work-around...

myprec(x)=floor((sizebyte(x)-sizebyte(0))*log(2^8)/log(10))

? myprec(exp(-2^10))
%3 = 28
? precision(exp(-2^10))
%4 = 452
? exp(-2^10)
%5 = 1.916242777947979989883594191 E-445
? \x
[&=080fce1c] REAL(lg=5,CLONE):05000005  (+,expo=-1478):5ffffa3a  cd1d0997  7435cc77  7a9a997b

Here lg=5, so the precision is 28 digits (or 96 bits).

Cheers,
Bill.