[gnumeric] R.PBETA: Improve accuracy in certain cases.



commit c2bfccc756547cc16607ca59b7167267d64fb448
Author: Morten Welinder <terra gnome org>
Date:   Sat Apr 13 14:26:50 2013 -0400

    R.PBETA: Improve accuracy in certain cases.
    
    Specifically R.PBETA(0.9,10,0.5)

 ChangeLog      | 2 ++
 NEWS           | 1 +
 src/mathfunc.c | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/ChangeLog b/ChangeLog
index 80dbd02..41275e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 2013-04-13  Morten Welinder  <terra gnome org>
 
        * src/mathfunc.c (pochhammer): Improve precision a bit.
+       (binomialcf): Lower cfSmall by 10^3.  This helps
+       pbeta(0.9,10,0.5).
 
        * configure.ac (GETTEXT_PACKAGE): Add version number so that
        doesn't prevent multiple versions from co-existing.
diff --git a/NEWS b/NEWS
index ba2cade..03a7a87 100644
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,7 @@ Morten:
        * Improve FACT and GAMMA accuracy.
        * Fix dirty/undo tracking issue.  [#697927]
        * Add version number to translation files.
+       * Improve precision of R.PBETA slightly.  [#697850]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.1
diff --git a/src/mathfunc.c b/src/mathfunc.c
index a14e1ab..308fabb 100644
--- a/src/mathfunc.c
+++ b/src/mathfunc.c
@@ -5646,7 +5646,7 @@ binomialcf (gnm_float ii, gnm_float jj, gnm_float pp, gnm_float qq,
 {
        const gnm_float sumAlways = 0;
        const gnm_float sumFactor = 6;
-       const gnm_float cfSmall = 1.0e-12;
+       const gnm_float cfSmall = 1.0e-15;
 
        gnm_float prob,p,q,a1,a2,b1,b2,c1,c2,c3,c4,n1,q1,dfm;
        gnm_float i,j,ni,nj,numb,ip1;


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