summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2011-05-19 15:55:13 -0400
committerKohei Yoshida <kyoshida@novell.com>2011-05-19 15:56:41 -0400
commitb7a805c683a1143f63fa2bac88a8ae2ae95f6875 (patch)
tree55ff29e3da89c1d2200777b64a1e8ae71f9c4645
parentb1ad6ec86661730b5dcd787bc7a0b5337a3c6eb7 (diff)
fdo#37326: Sign number must be either 1 or -1, never 0.
This fixes incorrect result with LINEST cell function. Signed-off-by: Kohei Yoshida <kyoshida@novell.com>
-rw-r--r--sc/source/core/tool/interpr5.cxx8
1 files changed, 2 insertions, 6 deletions
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index bc1348c44..7f005e227 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -1978,14 +1978,10 @@ double lcl_TGetColumnSumProduct(ScMatrixRef pMatA, SCSIZE nRa,
return fResult;
}
+// no mathematical signum, but used to switch between adding and subtracting
double lcl_GetSign(double fValue)
{
- if (fValue < 0.0)
- return -1.0;
- else if (fValue > 0.0)
- return 1.0;
- else
- return 0.0;
+ return (fValue >= 0.0 ? 1.0 : -1.0 );
}
/* Calculates a QR decomposition with Householder reflection.