[gcalctool] Fix off-by-one error in mp_cast_to_double
- From: Robin Sonefors <rsonefors src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gcalctool] Fix off-by-one error in mp_cast_to_double
- Date: Mon, 5 Oct 2009 23:57:13 +0000 (UTC)
commit 19761f8f5ea585cb8818270d0ae3916cb7faf87c
Author: Robin Sonefors <ozamosi flukkost nu>
Date: Mon Oct 5 07:18:15 2009 +0200
Fix off-by-one error in mp_cast_to_double
ChangeLog | 4 ++++
src/mp-convert.c | 2 +-
2 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 13da6de..9ab8d66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,10 @@
gcalctool change history.
=========================
+2009-10-05 Robin Sonefors <ozamosi flukkost nu>
+
+ * Fix off-by-one in mp_cast_to_double
+
2009-10-04 Robin Sonefors <ozamosi flukkost nu>
* Make "Insert character" work, use unsigned numbers, and work with UTF-8
diff --git a/src/mp-convert.c b/src/mp-convert.c
index 976e05f..939a946 100644
--- a/src/mp-convert.c
+++ b/src/mp-convert.c
@@ -409,7 +409,7 @@ mp_cast_to_double(const MPNumber *x)
}
/* NOW ALLOW FOR EXPONENT */
- ret_val *= mppow_di(db, x->exponent - tm);
+ ret_val *= mppow_di(db, x->exponent - tm - 1);
/* CHECK REASONABLENESS OF RESULT. */
/* LHS SHOULD BE .LE. 0.5 BUT ALLOW FOR SOME ERROR IN DLOG */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]