Bug 15641 - Catastrophic cancellation in pbeta
Catastrophic cancellation in pbeta
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Accuracy
R 3.0.2
Other Linux
: P5 normal
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-01-16 02:05 UTC by M Welinder
Modified: 2014-05-22 10:07 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description M Welinder 2014-01-16 02:05:13 UTC
> pbeta(0.5,2^-112,2^-60,,1,1)
-2.22044604925e-16
> pbeta(0.5,2^-113,2^-60,,1,1)
0                                         <--- wrong
> log1p(-pbeta(0.5,2^-113,2^-60,,0,0))
-1.110223024625e-16

i.e., total loss of accuracy where the log-of-right-tail was supposed to
help.
Comment 1 Martin Maechler 2014-01-17 17:39:19 UTC
(In reply to M Welinder from comment #0)
> > pbeta(0.5,2^-112,2^-60,,1,1)
> -2.22044604925e-16

I already get 0 here ...

> > pbeta(0.5,2^-113,2^-60,,1,1)
> 0                                         <--- wrong
> > log1p(-pbeta(0.5,2^-113,2^-60,,0,0))
> -1.110223024625e-16
> 
> i.e., total loss of accuracy where the log-of-right-tail was supposed to
> help.

Indeed, embarrassingly.  Fix committed to R-devel (rev 64820)
and R-patched.