[gnumeric] GAMMA: Use new gnm_gamma.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GAMMA: Use new gnm_gamma.
- Date: Tue, 27 Aug 2013 20:42:32 +0000 (UTC)
commit 83d877986398e311a50c715e9d7c9a327244af8a
Author: Morten Welinder <terra gnome org>
Date: Tue Aug 27 16:41:57 2013 -0400
GAMMA: Use new gnm_gamma.
plugins/fn-math/ChangeLog | 4 ++++
plugins/fn-math/functions.c | 15 +--------------
2 files changed, 5 insertions(+), 14 deletions(-)
---
diff --git a/plugins/fn-math/ChangeLog b/plugins/fn-math/ChangeLog
index f4c5d50..0439299 100644
--- a/plugins/fn-math/ChangeLog
+++ b/plugins/fn-math/ChangeLog
@@ -1,3 +1,7 @@
+2013-08-27 Morten Welinder <terra gnome org>
+
+ * functions.c (gnumeric_gamma): Use new gnm_gamma.
+
2013-08-19 Morten Welinder <terra gnome org>
* Release 1.12.5
diff --git a/plugins/fn-math/functions.c b/plugins/fn-math/functions.c
index afdb624..9caedb4 100644
--- a/plugins/fn-math/functions.c
+++ b/plugins/fn-math/functions.c
@@ -930,20 +930,7 @@ static GnmFuncHelp const help_gamma[] = {
static GnmValue *
gnumeric_gamma (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
{
- gnm_float x = value_get_as_float (argv[0]);
- gboolean x_is_integer = (x == gnm_floor (x));
-
- if (x < 0 && x_is_integer)
- return value_new_error_NUM (ei->pos);
-
- if (x_is_integer)
- return value_new_float (fact (x - 1));
- else {
- gnm_float res = gnm_exp (gnm_lgamma (x));
- if (x < 0 && gnm_fmod (gnm_floor (-x), 2.0) == 0.0)
- res = 0 - res;
- return value_new_float (res);
- }
+ return value_new_float (gnm_gamma (value_get_as_float (argv[0])));
}
/***************************************************************************/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]