[gnumeric] Doc fixes
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Doc fixes
- Date: Tue, 5 Nov 2019 01:28:38 +0000 (UTC)
commit 6c00075696ff7656f81185300a910b013061f21a
Author: Morten Welinder <terra gnome org>
Date: Mon Nov 4 20:28:26 2019 -0500
Doc fixes
src/mathfunc.c | 16 +++++++++++++++-
src/sf-gamma.c | 6 +++---
2 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/src/mathfunc.c b/src/mathfunc.c
index 7ab0b9c57..f51b72261 100644
--- a/src/mathfunc.c
+++ b/src/mathfunc.c
@@ -5041,8 +5041,22 @@ gnm_lambert_w (gnm_float x, int k)
if (gnm_isnan (x) || x < -one_over_e)
return gnm_nan;
- else if (x == -one_over_e)
+ else if (x == -one_over_e) {
+ // This is technically wrong. The mathematically right
+ // value of 1/e is 0.367879441171442321595524...
+ // which rounds to 0.367879441171442334024277... as a double.
+ // Note, that the rounding went up. In other words, when we
+ // observe "x == -one_over_e" then x is already less that the
+ // mathematically right value of -1/e and we ought to return
+ // NaN. That is, however, a somewhat useless behaviour so
+ // we return -1 instead.
+ //
+ // NOTE 1: The analysis might be different for long double.
+ // NOTE 2: The analysis assumes that 1/e when computed as double
+ // division (based on rounded e) produces the right
+ // value. It does, see goffice's test/constants
return -1;
+ }
if (k == 0) {
if (x == gnm_pinf)
diff --git a/src/sf-gamma.c b/src/sf-gamma.c
index a2d260e72..45751af45 100644
--- a/src/sf-gamma.c
+++ b/src/sf-gamma.c
@@ -1633,7 +1633,7 @@ gnm_digamma_series_1 (gnm_float x)
{
static const gnm_float ctr = 3414350731.0 / 4294967296.0; // ~ x0-2/3
// Taylor series data for digamma(x)*x around ctr
- // (Multiplying by x eliminates the pole at 0 and inproves convergence)
+ // (Multiplying by x eliminates the pole at 0 and improves convergence)
// There are more terms here than will be used in practice
static const gnm_float c[] = {
@@ -1702,7 +1702,7 @@ static gnm_float
gnm_digamma_series_2 (gnm_float x, gnm_float dx)
{
// Taylor series data for digamma(x)*x around x0.
- // (Multiplying by x eliminates the pole at 0 and inproves convergence)
+ // (Multiplying by x eliminates the pole at 0 and improves convergence)
// There are more terms here than will be used in practice
static const gnm_float c[] = {
@@ -1772,7 +1772,7 @@ gnm_digamma_series_3 (gnm_float x)
static const gnm_float ctr = 9140973792.0 / 4294967296.0; // ~ x0+2/3
// Taylor series data for digamma(x)*x*(x+1) around ctr.
- // (Multiplying by x eliminates the pole at 0 and inproves convergence;
+ // (Multiplying by x eliminates the pole at 0 and improves convergence;
// multiplying by x+1 removes trouble caused by the pole at -1.)
//
// There are more terms here than will be used in practice
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]