[gnumeric] Add Excel 2010's BETA.DIST.



commit 2f65b1637fb67a0e2dc16217b74de23455dff3ab
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Thu Jun 27 12:47:23 2013 -0600

    Add Excel 2010's BETA.DIST.
    
    2013-06-27  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * functions.c (help_beta_dist): new
        (gnumeric_beta_dist): new
        (stat_functions): add BETA.DIST
        (plugin.xml.in): add BETA.DIST
    
    2013-06-27  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * xlsx-utils.c (xlsx_func_betadist_handler): delete again
        (xlsx_func_dist_handler): remove density scaling argument,
        change all callers
        (xlsx_conventions_new): disconnect xlsx_func_betadist_handler
    
    2013-06-27  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * func.defs: update
        * functions.xml: update

 NEWS                          |    1 +
 doc/C/ChangeLog               |    5 ++
 doc/C/func.defs               |   90 +++++++++++++++++---------------
 doc/C/functions.xml           |  114 ++++++++++++++++++++++++++---------------
 plugins/excel/ChangeLog       |    7 +++
 plugins/excel/xlsx-utils.c    |   89 ++++---------------------------
 plugins/fn-stat/ChangeLog     |    7 +++
 plugins/fn-stat/functions.c   |   48 ++++++++++++++++-
 plugins/fn-stat/plugin.xml.in |    1 +
 9 files changed, 201 insertions(+), 161 deletions(-)
---
diff --git a/NEWS b/NEWS
index 4401d4c..68c1201 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ Andreas:
        * Improve xlsx export of Gnumeric functions.
        * Improve xlsx import of Excel 2010 functions.
        * Fix documentation of r.q*.
+       * Add Excel 2010's BETA.DIST.
 
 Jean:
        * Don't attempt to add a path item when there is no path objecte. [#703052]
diff --git a/doc/C/ChangeLog b/doc/C/ChangeLog
index f0e9d2a..a460585 100644
--- a/doc/C/ChangeLog
+++ b/doc/C/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-27  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * func.defs: update
+       * functions.xml: update
+
 2013-06-25  Morten Welinder <terra gnome org>
 
        * Release 1.12.3
diff --git a/doc/C/func.defs b/doc/C/func.defs
index c6a1ef2..88f25e6 100644
--- a/doc/C/func.defs
+++ b/doc/C/func.defs
@@ -1402,6 +1402,14 @@ The depreciation coefficient used is:
 @SEEALSO=AMORDEGRC
 
 @CATEGORY=Finance
+ FUNCTION=ATL_LAST
+ SHORTDESC=sample real-time data source
+ SYNTAX=ATL_LAST(tag)
+ ARGUMENTDESCRIPTION=@{tag}: tag to watch
+ DESCRIPTION=ATL_LAST is a sample implementation of a real time data source.  It takes a string tag and 
monitors the named pipe ~/atl for changes to the value of that tag.
+ NOTE=This is not intended to be generally enabled and is OFF by default.
+
+ CATEGORY=Finance
 @FUNCTION=COUPDAYBS
 @SHORTDESC=number of days from coupon period to settlement
 @SYNTAX=COUPDAYBS(settlement,maturity,frequency,basis,eom)
@@ -4266,7 +4274,7 @@ The successive use of the simulation tool also requires that you give to the too
 @{b}: optional upper bound, defaults to 1
 @NOTE=If @{x} < @{a} or @{x} > @{b} this function returns a #NUM! error. If @{alpha} <= 0 or @{beta} <= 0, 
this function returns a #NUM! error. If @{a} >= @{b} this function returns a #NUM! error.
 @EXCEL=This function is Excel compatible.
- SEEALSO=BETAINV
+ SEEALSO=BETAINV, BETA.DIST
 
 @CATEGORY=Statistics
 @FUNCTION=BETAINV
@@ -4279,7 +4287,7 @@ The successive use of the simulation tool also requires that you give to the too
 @{b}: optional upper bound, defaults to 1
 @NOTE=If @{p} < 0 or @{p} > 1 this function returns a #NUM! error. If @{alpha} <= 0 or @{beta} <= 0, this 
function returns a #NUM! error. If @{a} >= @{b} this function returns a #NUM! error.
 @EXCEL=This function is Excel compatible.
- SEEALSO=BETADIST
+ SEEALSO=BETADIST,BETA.DIST
 
 @CATEGORY=Statistics
 @FUNCTION=BINOM.DIST.RANGE
@@ -5394,11 +5402,11 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QBETA
 @SHORTDESC=probability quantile function of the beta distribution
 @SYNTAX=R.QBETA(p,a,b,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{a}: the first shape parameter of the distribution
 @{b}: the second scale parameter of the distribution
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the beta distribution.
 @SEEALSO=R.DBETA,R.PBETA
 
@@ -5406,11 +5414,11 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QBINOM
 @SHORTDESC=probability quantile function of the binomial distribution
 @SYNTAX=R.QBINOM(p,n,psuc,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{n}: the number of trials
 @{psuc}: the probability of success in each trial
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the binomial distribution.
 @SEEALSO=R.DBINOM,R.PBINOM
 
@@ -5418,11 +5426,11 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QCAUCHY
 @SHORTDESC=probability quantile function of the Cauchy distribution
 @SYNTAX=R.QCAUCHY(p,location,scale,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{location}: the center of the distribution
 @{scale}: the scale parameter of the distribution
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the Cauchy distribution.
 @SEEALSO=R.DCAUCHY,R.PCAUCHY
 
@@ -5430,10 +5438,10 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QCHISQ
 @SHORTDESC=probability quantile function of the chi-square distribution
 @SYNTAX=R.QCHISQ(p,df,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{df}: the number of degrees of freedom of the distribution
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the chi-square distribution.
 @ODF=A two argument invocation R.QCHISQ(@{p},@{df}) is exported to OpenFormula as CHISQINV(@{p},@{df}).
 @SEEALSO=R.DCHISQ,R.PCHISQ
@@ -5442,10 +5450,10 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QEXP
 @SHORTDESC=probability quantile function of the exponential distribution
 @SYNTAX=R.QEXP(p,scale,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{scale}: the scale parameter of the distribution
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the exponential distribution.
 @SEEALSO=R.DEXP,R.PEXP
 
@@ -5453,11 +5461,11 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QF
 @SHORTDESC=probability quantile function of the F distribution
 @SYNTAX=R.QF(p,n1,n2,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{n1}: the first number of degrees of freedom of the distribution
 @{n2}: the second number of degrees of freedom of the distribution
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the F distribution.
 @SEEALSO=R.DF,R.PF
 
@@ -5465,11 +5473,11 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QGAMMA
 @SHORTDESC=probability quantile function of the gamma distribution
 @SYNTAX=R.QGAMMA(p,shape,scale,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{shape}: the shape parameter of the distribution
 @{scale}: the scale parameter of the distribution
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the gamma distribution.
 @SEEALSO=R.DGAMMA,R.PGAMMA
 
@@ -5477,10 +5485,10 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QGEOM
 @SHORTDESC=probability quantile function of the geometric distribution
 @SYNTAX=R.QGEOM(p,psuc,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{psuc}: the probability of success in each trial
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the geometric distribution.
 @SEEALSO=R.DGEOM,R.PGEOM
 
@@ -5488,12 +5496,12 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QHYPER
 @SHORTDESC=probability quantile function of the hypergeometric distribution
 @SYNTAX=R.QHYPER(p,r,b,n,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{r}: the number of red balls
 @{b}: the number of black balls
 @{n}: the number of balls drawn
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the hypergeometric distribution.
 @SEEALSO=R.DHYPER,R.PHYPER
 
@@ -5501,11 +5509,11 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QLNORM
 @SHORTDESC=probability quantile function of the log-normal distribution
 @SYNTAX=R.QLNORM(p,logmean,logsd,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{logmean}: mean of the underlying normal distribution
 @{logsd}: standard deviation of the underlying normal distribution
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the log-normal distribution.
 @SEEALSO=R.DLNORM,R.PLNORM
 
@@ -5513,11 +5521,11 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QNBINOM
 @SHORTDESC=probability quantile function of the negative binomial distribution
 @SYNTAX=R.QNBINOM(p,n,psuc,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{n}: the number of trials
 @{psuc}: the probability of success in each trial
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the negative binomial distribution.
 @SEEALSO=R.DNBINOM,R.PNBINOM
 
@@ -5525,11 +5533,11 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QNORM
 @SHORTDESC=probability quantile function of the normal distribution
 @SYNTAX=R.QNORM(p,mu,sigma,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{mu}: mean of the distribution
 @{sigma}: standard deviation of the distribution
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the normal distribution.
 @SEEALSO=R.DNORM,R.PNORM
 
@@ -5537,10 +5545,10 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QPOIS
 @SHORTDESC=probability quantile function of the Poisson distribution
 @SYNTAX=R.QPOIS(p,lambda,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{lambda}: the mean of the distribution
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the Poisson distribution.
 @SEEALSO=R.DPOIS,R.PPOIS
 
@@ -5548,12 +5556,12 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QSNORM
 @SHORTDESC=probability quantile function of the skew-normal distribution
 @SYNTAX=R.QSNORM(p,shape,location,scale,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{shape}: the shape parameter of the distribution
 @{location}: the location parameter of the distribution
 @{scale}: the scale parameter of the distribution
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the skew-normal distribution.
 @SEEALSO=R.DSNORM,R.PSNORM
 
@@ -5561,11 +5569,11 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QST
 @SHORTDESC=probability quantile function of the skew-t distribution
 @SYNTAX=R.QST(p,n,shape,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{n}: the number of degrees of freedom of the distribution
 @{shape}: the shape parameter of the distribution
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the skew-t distribution.
 @SEEALSO=R.DST,R.PST
 
@@ -5573,10 +5581,10 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QT
 @SHORTDESC=probability quantile function of the Student t distribution
 @SYNTAX=R.QT(p,n,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{n}: the number of degrees of freedom of the distribution
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the Student t distribution.
 @SEEALSO=R.DT,R.PT
 
@@ -5584,12 +5592,12 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QTUKEY
 @SHORTDESC=probability quantile function of the Studentized range distribution
 @SYNTAX=R.QTUKEY(p,nmeans,df,nranges,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{nmeans}: the number of means
 @{df}: the number of degrees of freedom of the distribution
 @{nranges}: the number of ranges; default is 1
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the Studentized range distribution.
 @SEEALSO=R.PTUKEY
 
@@ -5597,11 +5605,11 @@ If the data set does not contain any duplicates this function returns a #N/A err
 @FUNCTION=R.QWEIBULL
 @SHORTDESC=probability quantile function of the Weibull distribution
 @SYNTAX=R.QWEIBULL(p,shape,scale,lower_tail,log_p)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability or natural logarithm of the probability
 @{shape}: the shape parameter of the distribution
 @{scale}: the scale parameter of the distribution
 @{lower_tail}: if true (the default), the lower tail of the distribution is considered
- {log_p}: if true, log of the probability is used
+ {log_p}: if true, @{p} is the natural logarithm of the probability; defaults to false
 @DESCRIPTION=This function returns the probability quantile function, i.e., the inverse of the cumulative 
distribution function, of the Weibull distribution.
 @SEEALSO=R.DWEIBULL,R.PWEIBULL
 
@@ -5830,11 +5838,11 @@ This function is Excel compatible for non-negative @{x}.
 
 @CATEGORY=Statistics
 @FUNCTION=TINV
- SHORTDESC=inverse of the survival function of the Student t-distribution
+ SHORTDESC=two tailed inverse of the Student t-distribution
 @SYNTAX=TINV(p,dof)
- ARGUMENTDESCRIPTION=@{p}: probability
+ ARGUMENTDESCRIPTION=@{p}: probability in both tails
 @{dof}: number of degrees of freedom
- DESCRIPTION=The survival function is 1 minus the cumulative distribution function.
+ DESCRIPTION=This functions returns the non-negative value x such that the area under the Student t density 
with @{dof} degrees of freedom to the right of x is @{p}/2.
 @NOTE=If @{p} < 0 or @{p} > 1 or @{dof} < 1 this function returns a #NUM! error. The parameterization of 
this function is different from what is used for, e.g., NORMSINV.  This is a common source of mistakes, but 
necessary for compatibility.
 @EXCEL=This function is Excel compatible.
 @SEEALSO=TDIST,TTEST
diff --git a/doc/C/functions.xml b/doc/C/functions.xml
index 83d1214..af79070 100644
--- a/doc/C/functions.xml
+++ b/doc/C/functions.xml
@@ -4861,6 +4861,36 @@
       </para>
       </refsect1>
     </refentry>
+    <refentry id="gnumeric-function-ATL_LAST">
+      <refmeta>
+        <refentrytitle>
+          <function>ATL_LAST</function>
+        </refentrytitle>
+      </refmeta>
+      <refnamediv>
+        <refname>
+          <function>ATL_LAST</function>
+        </refname>
+        <refpurpose>
+        sample real-time data source
+      </refpurpose>
+      </refnamediv>
+      <refsynopsisdiv>
+        <synopsis><function>ATL_LAST</function>(<parameter>tag</parameter>)</synopsis>
+      </refsynopsisdiv>
+      <refsect1>
+        <title>Arguments</title>
+        <para><parameter>tag</parameter>: tag to watch</para>
+      </refsect1>
+      <refsect1>
+        <title>Description</title>
+        <para><function>ATL_LAST</function> is a sample implementation of a real time data source.  It takes 
a string tag and monitors the named pipe ~/atl for changes to the value of that tag.</para>
+      </refsect1>
+      <refsect1>
+        <title>Note</title>
+        <para>This is not intended to be generally enabled and is OFF by default.</para>
+      </refsect1>
+    </refentry>
     <refentry id="gnumeric-function-COUPDAYBS">
       <refmeta>
         <refentrytitle>
@@ -14711,7 +14741,8 @@
       </refsect1>
       <refsect1>
         <title>See also</title>
-        <para><link linkend="gnumeric-function-BETAINV"><function>BETAINV</function></link>.
+        <para><link linkend="gnumeric-function-BETAINV"><function>BETAINV</function></link>,
+        <link linkend="gnumeric-function-BETA.DIST"><function>BETA.DIST</function></link>.
       </para>
       </refsect1>
     </refentry>
@@ -14750,7 +14781,8 @@
       </refsect1>
       <refsect1>
         <title>See also</title>
-        <para><link linkend="gnumeric-function-BETADIST"><function>BETADIST</function></link>.
+        <para><link linkend="gnumeric-function-BETADIST"><function>BETADIST</function></link>,
+        <link linkend="gnumeric-function-BETA.DIST"><function>BETA.DIST</function></link>.
       </para>
       </refsect1>
     </refentry>
@@ -18561,11 +18593,11 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>a</parameter>: the first shape parameter of the distribution</para>
         <para><parameter>b</parameter>: the second scale parameter of the distribution</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -18597,11 +18629,11 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>n</parameter>: the number of trials</para>
         <para><parameter>psuc</parameter>: the probability of success in each trial</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -18633,11 +18665,11 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>location</parameter>: the center of the distribution</para>
         <para><parameter>scale</parameter>: the scale parameter of the distribution</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -18669,10 +18701,10 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>df</parameter>: the number of degrees of freedom of the distribution</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -18708,10 +18740,10 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>scale</parameter>: the scale parameter of the distribution</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -18743,11 +18775,11 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>n1</parameter>: the first number of degrees of freedom of the distribution</para>
         <para><parameter>n2</parameter>: the second number of degrees of freedom of the distribution</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -18779,11 +18811,11 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>shape</parameter>: the shape parameter of the distribution</para>
         <para><parameter>scale</parameter>: the scale parameter of the distribution</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -18815,10 +18847,10 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>psuc</parameter>: the probability of success in each trial</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -18850,12 +18882,12 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>r</parameter>: the number of red balls</para>
         <para><parameter>b</parameter>: the number of black balls</para>
         <para><parameter>n</parameter>: the number of balls drawn</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -18887,11 +18919,11 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>logmean</parameter>: mean of the underlying normal distribution</para>
         <para><parameter>logsd</parameter>: standard deviation of the underlying normal distribution</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -18923,11 +18955,11 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>n</parameter>: the number of trials</para>
         <para><parameter>psuc</parameter>: the probability of success in each trial</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -18959,11 +18991,11 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>mu</parameter>: mean of the distribution</para>
         <para><parameter>sigma</parameter>: standard deviation of the distribution</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -18995,10 +19027,10 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>lambda</parameter>: the mean of the distribution</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -19030,12 +19062,12 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>shape</parameter>: the shape parameter of the distribution</para>
         <para><parameter>location</parameter>: the location parameter of the distribution</para>
         <para><parameter>scale</parameter>: the scale parameter of the distribution</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -19067,11 +19099,11 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>n</parameter>: the number of degrees of freedom of the distribution</para>
         <para><parameter>shape</parameter>: the shape parameter of the distribution</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -19103,10 +19135,10 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>n</parameter>: the number of degrees of freedom of the distribution</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -19138,12 +19170,12 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>nmeans</parameter>: the number of means</para>
         <para><parameter>df</parameter>: the number of degrees of freedom of the distribution</para>
         <para><parameter>nranges</parameter>: the number of ranges; default is 1</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -19174,11 +19206,11 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability or natural logarithm of the probability</para>
         <para><parameter>shape</parameter>: the shape parameter of the distribution</para>
         <para><parameter>scale</parameter>: the scale parameter of the distribution</para>
         <para><parameter>lower_tail</parameter>: if true (the default), the lower tail of the distribution 
is considered</para>
-        <para><parameter>log_p</parameter>: if true, log of the probability is used</para>
+        <para><parameter>log_p</parameter>: if true, <parameter>p</parameter> is the natural logarithm of 
the probability; defaults to false</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
@@ -19971,7 +20003,7 @@
           <function>TINV</function>
         </refname>
         <refpurpose>
-        inverse of the survival function of the Student t-distribution
+        two tailed inverse of the Student t-distribution
       </refpurpose>
       </refnamediv>
       <refsynopsisdiv>
@@ -19979,12 +20011,12 @@
       </refsynopsisdiv>
       <refsect1>
         <title>Arguments</title>
-        <para><parameter>p</parameter>: probability</para>
+        <para><parameter>p</parameter>: probability in both tails</para>
         <para><parameter>dof</parameter>: number of degrees of freedom</para>
       </refsect1>
       <refsect1>
         <title>Description</title>
-        <para>The survival function is 1 minus the cumulative distribution function.</para>
+        <para>This functions returns the non-negative value x such that the area under the Student t density 
with <parameter>dof</parameter> degrees of freedom to the right of x is <parameter>p</parameter>/2.</para>
       </refsect1>
       <refsect1>
         <title>Note</title>
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 24b0f88..a4f3287 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,12 @@
 2013-06-27  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * xlsx-utils.c (xlsx_func_betadist_handler): delete again
+       (xlsx_func_dist_handler): remove density scaling argument,
+       change all callers
+       (xlsx_conventions_new): disconnect xlsx_func_betadist_handler
+
+2013-06-27  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * xlsx-utils.c (xlsx_func_betadist_handler): new
        (xlsx_func_dist_handler): add density scaling argument, change
        all callers
diff --git a/plugins/excel/xlsx-utils.c b/plugins/excel/xlsx-utils.c
index b161a46..9bae9e0 100644
--- a/plugins/excel/xlsx-utils.c
+++ b/plugins/excel/xlsx-utils.c
@@ -211,8 +211,7 @@ xlsx_func_binominv_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UN
 }
 
 static GnmExpr const *
-xlsx_func_dist_handler (GnmExprList *args, guint n_args, char const *name, char const *name_p, char const 
*name_d, 
-                       GnmExpr const *d_scale)
+xlsx_func_dist_handler (GnmExprList *args, guint n_args, char const *name, char const *name_p, char const 
*name_d)
 {
        if (gnm_expr_list_length (args) != n_args) {
                GnmFunc  *f = gnm_func_lookup_or_add_placeholder (name);
@@ -235,29 +234,16 @@ xlsx_func_dist_handler (GnmExprList *args, guint n_args, char const *name, char
                if (constant == NULL || !VALUE_IS_NUMBER (constant)) {
                        args_c = gnm_expr_list_copy (args);
                        
-                       if (d_scale == NULL)
-                               return gnm_expr_new_funcall3 
-                                       (f_if, cum,
-                                        gnm_expr_new_funcall (f_p, args),
-                                        gnm_expr_new_funcall (f_d, args_c));
-                       else
-                               return gnm_expr_new_funcall3 
-                                       (f_if, cum,
-                                        gnm_expr_new_funcall (f_p, args),
-                                        gnm_expr_new_binary (gnm_expr_new_funcall (f_d, args_c), 
-                                                             GNM_EXPR_OP_DIV, d_scale));
-
+                       return gnm_expr_new_funcall3 
+                               (f_if, cum,
+                                gnm_expr_new_funcall (f_p, args),
+                                gnm_expr_new_funcall (f_d, args_c));
+                       
                } else if (value_is_zero (constant)) {
                        gnm_expr_free (cum);
-                       if (d_scale == NULL) 
-                               return gnm_expr_new_funcall (f_d, args);
-                       else
-                               return gnm_expr_new_binary (gnm_expr_new_funcall (f_d, args), 
-                                                           GNM_EXPR_OP_DIV, d_scale);
+                       return gnm_expr_new_funcall (f_d, args);
                } else {
                        gnm_expr_free (cum);
-                       if (d_scale != NULL)
-                               gnm_expr_free (d_scale);
                        return gnm_expr_new_funcall (f_p, args);
                }
        }
@@ -267,81 +253,30 @@ static GnmExpr const *
 xlsx_func_chisqdist_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UNUSED Workbook *scope, 
                             GnmExprList *args)
 {
-       return xlsx_func_dist_handler (args, 3, "chisq.dist", "r.pchisq", "r.dchisq", NULL);
+       return xlsx_func_dist_handler (args, 3, "chisq.dist", "r.pchisq", "r.dchisq");
 }
 
 static GnmExpr const *
 xlsx_func_fdist_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UNUSED Workbook *scope, 
                         GnmExprList *args)
 {
-       return xlsx_func_dist_handler (args, 4, "f.dist", "r.pf", "r.df", NULL);
+       return xlsx_func_dist_handler (args, 4, "f.dist", "r.pf", "r.df");
 }
 
 static GnmExpr const *
 xlsx_func_lognormdist_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UNUSED Workbook *scope, 
                               GnmExprList *args)
 {
-       return xlsx_func_dist_handler (args, 4, "lognorm.dist", "r.plnorm", "r.dlnorm", NULL);
+       return xlsx_func_dist_handler (args, 4, "lognorm.dist", "r.plnorm", "r.dlnorm");
 }
 
 static GnmExpr const *
 xlsx_func_negbinomdist_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UNUSED Workbook *scope, 
                                GnmExprList *args)
 {
-       return xlsx_func_dist_handler (args, 4, "negbinom.dist", "r.pnbinom", "r.dnbinom", NULL);
+       return xlsx_func_dist_handler (args, 4, "negbinom.dist", "r.pnbinom", "r.dnbinom");
 }
 
-static GnmExpr const *
-xlsx_func_betadist_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UNUSED Workbook *scope, 
-                           GnmExprList *args)
-{
-       int len = gnm_expr_list_length (args);
-       GnmExpr const *denom = NULL;
-
-       if (len == 6) {
-               GnmExprList *arg_upper = g_slist_nth (args, 5);
-               GnmValue const *constant = gnm_expr_get_constant (arg_upper->data);
-               if (constant != NULL && VALUE_IS_NUMBER (constant) 
-                   && 1.0 == value_get_as_float (constant)) {
-                       args = g_slist_remove_link (args, arg_upper);
-                       gnm_expr_list_free (arg_upper);
-                       len--;
-               }
-       }
-       if (len == 5) {
-               GnmExprList *arg_lower = g_slist_nth (args, 4);
-               GnmValue const *constant = gnm_expr_get_constant (arg_lower->data);
-               if (constant != NULL && VALUE_IS_NUMBER (constant) 
-                   && value_is_zero (constant)) {
-                       args = g_slist_remove_link (args, arg_lower);
-                       gnm_expr_list_free (arg_lower);
-                       len--;
-               }
-       }
-       if (len > 4 && len < 7) {
-               GnmExpr const *upper, *lower;
-               GnmExprList *arg_lower;
-               if (len == 6) {
-                       GnmExprList *arg_upper = g_slist_nth (args, 5);
-                       upper = arg_upper->data;
-                       args = g_slist_delete_link (args, arg_upper);
-               } else 
-                       upper = gnm_expr_new_constant (value_new_int (1));
-               arg_lower = g_slist_nth (args, 4);
-               lower = arg_lower->data;
-               args = g_slist_delete_link (args, arg_lower);
-
-               denom = gnm_expr_new_binary (upper, GNM_EXPR_OP_SUB, gnm_expr_copy (lower));
-
-               args->data = (GnmExpr *)gnm_expr_new_binary 
-                       (gnm_expr_new_binary (args->data, GNM_EXPR_OP_SUB, lower),
-                        GNM_EXPR_OP_DIV, gnm_expr_copy (denom));
-       }
-       return xlsx_func_dist_handler (args, 4, "beta.dist", "r.pbeta", "r.dbeta", denom);
-}
-
-
-
 static void
 xlsx_write_r_q_func (GnmConventionsOut *out, char const *name, char const *name_rt, 
                     GnmExprConstPtr const *ptr, int n, int n_p,
@@ -563,7 +498,6 @@ xlsx_conventions_new (gboolean output)
                char const *gnm_name;
                gpointer handler;
        } const xlfn_func_handlers[] = {
-               {"BETA.DIST", xlsx_func_betadist_handler},
                {"BINOM.INV", xlsx_func_binominv_handler},
                {"CHISQ.DIST", xlsx_func_chisqdist_handler},
                {"F.DIST", xlsx_func_fdist_handler},
@@ -611,6 +545,7 @@ xlsx_conventions_new (gboolean output)
                { "F.TEST", "FTEST" },
                { "GAMMA.DIST", "GAMMADIST" },
                { "GAMMA.INV", "GAMMAINV" },
+               { "HYPGEOM.DIST", "HYPGEOMDIST" },
                { "LOGNORM.INV", "LOGINV" },
                { "MODE.SNGL", "MODE" },
                { "NORM.DIST", "NORMDIST" },
diff --git a/plugins/fn-stat/ChangeLog b/plugins/fn-stat/ChangeLog
index bd54675..ab317a7 100644
--- a/plugins/fn-stat/ChangeLog
+++ b/plugins/fn-stat/ChangeLog
@@ -1,3 +1,10 @@
+2013-06-27  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * functions.c (help_beta_dist): new
+       (gnumeric_beta_dist): new
+       (stat_functions): add BETA.DIST
+       (plugin.xml.in): add BETA.DIST
+
 2013-06-25  Morten Welinder <terra gnome org>
 
        * Release 1.12.3
diff --git a/plugins/fn-stat/functions.c b/plugins/fn-stat/functions.c
index 11ec3ab..9dce2dd 100644
--- a/plugins/fn-stat/functions.c
+++ b/plugins/fn-stat/functions.c
@@ -1172,7 +1172,7 @@ static GnmFuncHelp const help_betadist[] = {
        { GNM_FUNC_HELP_NOTE, F_("If @{a} >= @{b} this function returns a #NUM! error.")},
        { GNM_FUNC_HELP_EXCEL, F_("This function is Excel compatible.") },
        { GNM_FUNC_HELP_EXAMPLES, "=BETADIST(0.12,2,3)" },
-       { GNM_FUNC_HELP_SEEALSO, "BETAINV"},
+       { GNM_FUNC_HELP_SEEALSO, "BETAINV, BETA.DIST"},
        { GNM_FUNC_HELP_END }
 };
 
@@ -1195,6 +1195,47 @@ gnumeric_betadist (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
 
 /***************************************************************************/
 
+static GnmFuncHelp const help_beta_dist[] = {
+       { GNM_FUNC_HELP_NAME, F_("BETA.DIST:cumulative distribution function of the beta distribution")},
+       { GNM_FUNC_HELP_ARG, F_("x:number")},
+       { GNM_FUNC_HELP_ARG, F_("alpha:scale parameter")},
+       { GNM_FUNC_HELP_ARG, F_("beta:scale parameter")},
+       { GNM_FUNC_HELP_ARG, F_("cumulative:whether to evaluate the density function or the cumulative "
+                               "distribution function")},
+       { GNM_FUNC_HELP_ARG, F_("a:optional lower bound, defaults to 0")},
+       { GNM_FUNC_HELP_ARG, F_("b:optional upper bound, defaults to 1")},
+       { GNM_FUNC_HELP_NOTE, F_("If @{x} < @{a} or @{x} > @{b} this function returns a #NUM! error.") },
+       { GNM_FUNC_HELP_NOTE, F_("If @{alpha} <= 0 or @{beta} <= 0, this function returns a #NUM! error.") },
+       { GNM_FUNC_HELP_NOTE, F_("If @{a} >= @{b} this function returns a #NUM! error.")},
+       { GNM_FUNC_HELP_EXCEL, F_("This function is Excel compatible.") },
+       { GNM_FUNC_HELP_EXAMPLES, "=BETA.DIST(0.12,2,3,FALSE,2,4)" },
+       { GNM_FUNC_HELP_SEEALSO, "BETAINV,BETADIST"},
+       { GNM_FUNC_HELP_END }
+};
+
+static GnmValue *
+gnumeric_beta_dist (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
+{
+       gnm_float x, alpha, beta, a, b;
+       gboolean cuml;
+
+       x = value_get_as_float (argv[0]);
+       alpha = value_get_as_float (argv[1]);
+       beta = value_get_as_float (argv[2]);
+       cuml = value_get_as_checked_bool (argv[3]);
+       a = argv[4] ? value_get_as_float (argv[4]) : 0;
+       b = argv[5] ? value_get_as_float (argv[5]) : 1;
+
+       if (x < a || x > b || a >= b || alpha <= 0 || beta <= 0)
+               return value_new_error_NUM (ei->pos);
+
+       if (cuml)
+               return value_new_float (pbeta ((x - a) / (b - a), alpha, beta, TRUE, FALSE));
+       else
+               return value_new_float (dbeta ((x - a) / (b - a), alpha, beta, FALSE) / (b - a));
+}
+/***************************************************************************/
+
 /* Note: Excel's this function returns a #NUM! for various values where it
    simply gives up computing the result.  */
 static GnmFuncHelp const help_betainv[] = {
@@ -1209,7 +1250,7 @@ static GnmFuncHelp const help_betainv[] = {
        { GNM_FUNC_HELP_NOTE, F_("If @{a} >= @{b} this function returns a #NUM! error.")},
        { GNM_FUNC_HELP_EXCEL, F_("This function is Excel compatible.") },
        { GNM_FUNC_HELP_EXAMPLES, "=BETAINV(0.45,1.6,1)" },
-       { GNM_FUNC_HELP_SEEALSO, "BETADIST"},
+       { GNM_FUNC_HELP_SEEALSO, "BETADIST,BETA.DIST"},
        { GNM_FUNC_HELP_END }
 };
 
@@ -5026,6 +5067,9 @@ GnmFuncDescriptor const stat_functions[] = {
        { "betadist",     "fff|ff",
          help_betadist, gnumeric_betadist, NULL, NULL, NULL,
          GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
+       { "beta.dist",     "fffb|ff",
+         help_beta_dist, gnumeric_beta_dist, NULL, NULL, NULL,
+         GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
        { "betainv",      "fff|ff",
          help_betainv, gnumeric_betainv, NULL, NULL, NULL,
          GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
diff --git a/plugins/fn-stat/plugin.xml.in b/plugins/fn-stat/plugin.xml.in
index c231877..a329cd4 100644
--- a/plugins/fn-stat/plugin.xml.in
+++ b/plugins/fn-stat/plugin.xml.in
@@ -17,6 +17,7 @@
                                <function name="averagea"/>
                                <function name="bernoulli"/>
                                <function name="betadist"/>
+                               <function name="beta.dist"/>
                                <function name="betainv"/>
                                <function name="binom.dist.range"/>
                                <function name="binomdist"/>


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