mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-16 18:25:11 -06:00
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.
This commit is contained in:
parent
217418bb8c
commit
fc567208f3
@ -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";
|
||||
}
|
||||
|
@ -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)))
|
||||
|
Loading…
Reference in New Issue
Block a user