[gnumeric] fn-r: help text updates.



commit ed13c16276fb7d1609f777ac83cbcd98423746f1
Author: Morten Welinder <terra gnome org>
Date:   Fri Mar 1 12:56:59 2013 -0500

    fn-r: help text updates.

 ChangeLog                |    5 +++++
 NEWS                     |    1 +
 plugins/fn-r/ChangeLog   |    5 +++++
 plugins/fn-r/functions.c |   18 +++++++++---------
 plugins/fn-r/generate    |    2 --
 src/mathfunc.h           |   10 +++++-----
 6 files changed, 25 insertions(+), 16 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b2b77c3..fd9f3ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-01  Morten Welinder  <terra gnome org>
+
+       * src/mathfunc.h: Make sure the "q" functions take "p" as their
+       first argument, not "x".
+
 2013-03-01  Jean Brefort  <jean brefort normalesup org>
 
        reviewed by: <delete if not using a buddy>
diff --git a/NEWS b/NEWS
index a9debe8..8432ec0 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,7 @@ Morten:
        * Fix ssconvert crash.  [#694741]
        * Unconditionally enable solver.
        * Rewrite the file history dialog.  [#694777]
+       * Fix R.QF and R.QBINOM documentation.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.0
diff --git a/plugins/fn-r/ChangeLog b/plugins/fn-r/ChangeLog
index 73a9eb6..52c3918 100644
--- a/plugins/fn-r/ChangeLog
+++ b/plugins/fn-r/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-01  Morten Welinder  <terra gnome org>
+
+       * functions.c: Re-generate to catch mathfunc.h fixes and thus fix
+       q-functions' documentation.
+
 2013-02-27  Morten Welinder  <terra gnome org>
 
        * extra.c (qsnorm): Implement.
diff --git a/plugins/fn-r/functions.c b/plugins/fn-r/functions.c
index 46a56a9..45ef4ce 100644
--- a/plugins/fn-r/functions.c
+++ b/plugins/fn-r/functions.c
@@ -148,7 +148,7 @@ gnumeric_r_plnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
 
 static GnmFuncHelp const help_r_qlnorm[] = {
        { GNM_FUNC_HELP_NAME, F_("R.QLNORM:probability quantile function of the log-normal distribution") },
-       { GNM_FUNC_HELP_ARG, F_("x:observation") },
+       { GNM_FUNC_HELP_ARG, F_("p:probability") },
        { GNM_FUNC_HELP_ARG, F_("logmean:mean of the underlying normal distribution") },
        { GNM_FUNC_HELP_ARG, F_("logsd:standard deviation of the underlying normal distribution") },
        { GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is 
considered") },
@@ -161,13 +161,13 @@ static GnmFuncHelp const help_r_qlnorm[] = {
 static GnmValue *
 gnumeric_r_qlnorm (GnmFuncEvalInfo *ei, GnmValue const * const *args)
 {
-       gnm_float x = value_get_as_float (args[0]);
+       gnm_float p = value_get_as_float (args[0]);
        gnm_float logmean = value_get_as_float (args[1]);
        gnm_float logsd = value_get_as_float (args[2]);
        gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
        gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
 
-       return value_new_float (qlnorm (x, logmean, logsd, lower_tail, log_p));
+       return value_new_float (qlnorm (p, logmean, logsd, lower_tail, log_p));
 }
 
 /* ------------------------------------------------------------------------- */
@@ -458,7 +458,7 @@ gnumeric_r_pf (GnmFuncEvalInfo *ei, GnmValue const * const *args)
 
 static GnmFuncHelp const help_r_qf[] = {
        { GNM_FUNC_HELP_NAME, F_("R.QF:probability quantile function of the F distribution") },
-       { GNM_FUNC_HELP_ARG, F_("x:observation") },
+       { GNM_FUNC_HELP_ARG, F_("p:probability") },
        { GNM_FUNC_HELP_ARG, F_("n1:the first number of degrees of freedom of the distribution") },
        { GNM_FUNC_HELP_ARG, F_("n2:the second number of degrees of freedom of the distribution") },
        { GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is 
considered") },
@@ -471,13 +471,13 @@ static GnmFuncHelp const help_r_qf[] = {
 static GnmValue *
 gnumeric_r_qf (GnmFuncEvalInfo *ei, GnmValue const * const *args)
 {
-       gnm_float x = value_get_as_float (args[0]);
+       gnm_float p = value_get_as_float (args[0]);
        gnm_float n1 = value_get_as_float (args[1]);
        gnm_float n2 = value_get_as_float (args[2]);
        gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
        gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
 
-       return value_new_float (qf (x, n1, n2, lower_tail, log_p));
+       return value_new_float (qf (p, n1, n2, lower_tail, log_p));
 }
 
 /* ------------------------------------------------------------------------- */
@@ -838,7 +838,7 @@ gnumeric_r_pbinom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
 
 static GnmFuncHelp const help_r_qbinom[] = {
        { GNM_FUNC_HELP_NAME, F_("R.QBINOM:probability quantile function of the binomial distribution") },
-       { GNM_FUNC_HELP_ARG, F_("x:observation") },
+       { GNM_FUNC_HELP_ARG, F_("p:probability") },
        { GNM_FUNC_HELP_ARG, F_("n:the number of trials") },
        { GNM_FUNC_HELP_ARG, F_("psuc:the probability of success in each trial") },
        { GNM_FUNC_HELP_ARG, F_("lower_tail:if true (the default), the lower tail of the distribution is 
considered") },
@@ -851,13 +851,13 @@ static GnmFuncHelp const help_r_qbinom[] = {
 static GnmValue *
 gnumeric_r_qbinom (GnmFuncEvalInfo *ei, GnmValue const * const *args)
 {
-       gnm_float x = value_get_as_float (args[0]);
+       gnm_float p = value_get_as_float (args[0]);
        gnm_float n = value_get_as_float (args[1]);
        gnm_float psuc = value_get_as_float (args[2]);
        gboolean lower_tail = args[3] ? value_get_as_checked_bool (args[3]) : TRUE;
        gboolean log_p = args[4] ? value_get_as_checked_bool (args[4]) : FALSE;
 
-       return value_new_float (qbinom (x, n, psuc, lower_tail, log_p));
+       return value_new_float (qbinom (p, n, psuc, lower_tail, log_p));
 }
 
 /* ------------------------------------------------------------------------- */
diff --git a/plugins/fn-r/generate b/plugins/fn-r/generate
index 589ebec..7abcc6f 100644
--- a/plugins/fn-r/generate
+++ b/plugins/fn-r/generate
@@ -103,8 +103,6 @@ my %argoverride = ();
         ({ 'n' => 'the number of trials',
            'psuc' => "the probability of success in each trial",
            @common })];
-    $argoverride{"dbinom:p"} = $argoverride{"pbinom:p"} = $argoverride{"qbinom:p"} =
-       "psuc";
 
     $funcs{'dnbinom'} = $funcs{'pnbinom'} = $funcs{'qnbinom'} =
        [\&distribution,
diff --git a/src/mathfunc.h b/src/mathfunc.h
index d737b3f..2a0e0a1 100644
--- a/src/mathfunc.h
+++ b/src/mathfunc.h
@@ -58,7 +58,7 @@ gnm_float qnorm (gnm_float p, gnm_float mu, gnm_float sigma, gboolean lower_tail
 /* The log-normal distribution.  */
 gnm_float dlnorm (gnm_float x, gnm_float logmean, gnm_float logsd, gboolean give_log);
 gnm_float plnorm (gnm_float x, gnm_float logmean, gnm_float logsd, gboolean lower_tail, gboolean log_p);
-gnm_float qlnorm (gnm_float x, gnm_float logmean, gnm_float logsd, gboolean lower_tail, gboolean log_p);
+gnm_float qlnorm (gnm_float p, gnm_float logmean, gnm_float logsd, gboolean lower_tail, gboolean log_p);
 
 /* The gamma distribution.  */
 gnm_float dgamma (gnm_float x, gnm_float shape, gnm_float scale, gboolean give_log);
@@ -78,7 +78,7 @@ gnm_float qt (gnm_float p, gnm_float ndf, gboolean lower_tail, gboolean log_p);
 /* The F distribution.  */
 gnm_float df (gnm_float x, gnm_float m, gnm_float n, gboolean give_log);
 gnm_float pf (gnm_float x, gnm_float n1, gnm_float n2, gboolean lower_tail, gboolean log_p);
-gnm_float qf (gnm_float x, gnm_float n1, gnm_float n2, gboolean lower_tail, gboolean log_p);
+gnm_float qf (gnm_float p, gnm_float n1, gnm_float n2, gboolean lower_tail, gboolean log_p);
 
 /* The chi-squared distribution.  */
 gnm_float dchisq (gnm_float x, gnm_float df, gboolean give_log);
@@ -101,10 +101,10 @@ gnm_float pexp (gnm_float x, gnm_float scale, gboolean lower_tail, gboolean log_
 gnm_float qexp (gnm_float p, gnm_float scale, gboolean lower_tail, gboolean log_p);
 
 /* Binomial distribution.  */
-gnm_float dbinom (gnm_float x, gnm_float n, gnm_float p, gboolean give_log);
-gnm_float pbinom (gnm_float x, gnm_float n, gnm_float p, gboolean lower_tail, gboolean log_p);
+gnm_float dbinom (gnm_float x, gnm_float n, gnm_float psuc, gboolean give_log);
+gnm_float pbinom (gnm_float x, gnm_float n, gnm_float psuc, gboolean lower_tail, gboolean log_p);
 gnm_float pbinom2 (gnm_float x0, gnm_float x1, gnm_float n, gnm_float p);
-gnm_float qbinom (gnm_float x, gnm_float n, gnm_float p, gboolean lower_tail, gboolean log_p);
+gnm_float qbinom (gnm_float p, gnm_float n, gnm_float psuc, gboolean lower_tail, gboolean log_p);
 
 /* Negative binomial distribution.  */
 gnm_float dnbinom (gnm_float x, gnm_float n, gnm_float p, gboolean give_log);


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