gnumeric r16784 - in trunk: . src
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16784 - in trunk: . src
- Date: Thu, 11 Sep 2008 22:26:50 +0000 (UTC)
Author: mortenw
Date: Thu Sep 11 22:26:49 2008
New Revision: 16784
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16784&view=rev
Log:
2008-09-11 Morten Welinder <terra gnome org>
* src/mathfunc.c (random_landau): Fix off-by-one. I hope.
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/src/README.gnm_float
trunk/src/mathfunc.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Thu Sep 11 22:26:49 2008
@@ -22,6 +22,7 @@
Morten:
* Fix display of array formulas. [#550902]
+ * Fix off-by-one for random_landau.
--------------------------------------------------------------------------
Gnumeric 1.9.2
Modified: trunk/src/README.gnm_float
==============================================================================
--- trunk/src/README.gnm_float (original)
+++ trunk/src/README.gnm_float Thu Sep 11 22:26:49 2008
@@ -4,7 +4,7 @@
This has some coding style consequences...
-1. Don't use (say) "exp"; use "expgnum". If you simply use "exp",
+1. Don't use (say) "exp"; use "gnm_exp". If you simply use "exp",
the argument will be cast from gnm_float to double, thus potentially
losing precision and the answer will also have reduced range and
precision.
@@ -31,10 +31,10 @@
Don't use... Use...
---------------------------------------------------
-loggnum (1+x) log1pgnum (x)
-loggnum (1-x) log1pgnum (-x)
-expgnum (x * loggnum (y)) powgnum (y, x)
-expgnum (x) - 1 expm1gnum (x)
-1 - expgnum (x) -expm1gnum (x)
-powgnum (1+x,y) pow1p (x,y)
-powgnum (1+x,y) - 1 pow1pm1 (x,y)
+gnm_log (1+x) gnm_log1p (x)
+gnm_log (1-x) gnm_log1p (-x)
+gnm_exp (x * gnm_log (y)) gnm_pow (y, x)
+gnm_exp (x) - 1 gnm_expm1 (x)
+1 - gnm_exp (x) -gnm_expm1 (x)
+gnm_pow (1+x,y) pow1p (x,y)
+gnm_pow (1+x,y) - 1 pow1pm1 (x,y)
Modified: trunk/src/mathfunc.c
==============================================================================
--- trunk/src/mathfunc.c (original)
+++ trunk/src/mathfunc.c Thu Sep 11 22:26:49 2008
@@ -7333,7 +7333,11 @@
gnm_float
random_landau (void)
{
- static gnm_float F[982] = {
+ static gnm_float F[983] = {
+ 0.0000000, /*
+ * Add empty element [0] to account for difference
+ * between C and Fortran convention for lower bound.
+ */
00.000000, 00.000000, 00.000000, 00.000000, 00.000000,
-2.244733, -2.204365, -2.168163, -2.135219, -2.104898,
-2.076740, -2.050397, -2.025605, -2.002150, -1.979866,
@@ -7542,10 +7546,6 @@
i = U;
U = U - i;
- /* Account for difference between C and Fortran convention for lower
- * bound. */
- I = i - 1;
-
if (I >= 70 && I <= 800)
RANLAN = F[I] + U * (F[I + 1] - F[I]);
else if (I >= 7 && I <= 980)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]