gnucash maint: Bug 797233 - Balance Sheet, Chart of Accounts, and other reports...
John Ralls
jralls at code.gnucash.org
Tue May 14 16:41:01 EDT 2019
Updated via https://github.com/Gnucash/gnucash/commit/fc567208 (commit)
from https://github.com/Gnucash/gnucash/commit/217418bb (commit)
commit fc567208f3400f26263582a4c10926e12fe108eb
Author: John Ralls <jralls at ceridwen.us>
Date: Tue May 14 13:34:07 2019 -0700
Bug 797233 - Balance Sheet, Chart of Accounts, and other reports...
crash when involving foreign currency stocks.
Scheme's inexact->exact function just converts the floating-point
representation of a number into an exact rational (documented in the
API Reference, Simple Generic Data Types, Numerical data types, Exact
and Inexact Numbers), which isn't what we want.
We want the number converted to exact directly from the string and to do
that we have gnc-fq-helper preface it with #e.
diff --git a/libgnucash/quotes/gnc-fq-helper.in b/libgnucash/quotes/gnc-fq-helper.in
index 1e781913e..95e7210c5 100755
--- a/libgnucash/quotes/gnc-fq-helper.in
+++ b/libgnucash/quotes/gnc-fq-helper.in
@@ -186,7 +186,7 @@ sub schemify_num {
if(!$numstr) { return "failed-conversion"; }
if($numstr =~ /^\s*(\d+(\.\d+)?([eE][+-]?\d+)?)$/o) {
- return $1;
+ return "#e" . $1;
} else {
return "failed-conversion";
}
diff --git a/libgnucash/scm/price-quotes.scm b/libgnucash/scm/price-quotes.scm
index 812fcbb07..c12fa35e0 100644
--- a/libgnucash/scm/price-quotes.scm
+++ b/libgnucash/scm/price-quotes.scm
@@ -404,13 +404,7 @@
(else #f)))
(if price
- ;; The second argument to inexact->exact is chosen to give reasonable values
- ;; for prices between .12345e-9 and 12345678.87654
-
- ;; inexact->exact is probably not necessary but it can't hurt and is cheap.
- (set! price
- (gnc-scm-to-numeric
- (rationalize (inexact->exact price) 1/1000000000000000))))
+ (set! price (gnc-scm-to-numeric price)))
(if gnc-time
(set! gnc-time (timestr->time64 gnc-time time-zone))
(set! gnc-time (gnc:get-today)))
Summary of changes:
libgnucash/quotes/gnc-fq-helper.in | 2 +-
libgnucash/scm/price-quotes.scm | 8 +-------
2 files changed, 2 insertions(+), 8 deletions(-)
More information about the gnucash-changes
mailing list