Commit Graph

16490 Commits

Author SHA1 Message Date
John Ralls
503a607090 More overflow-avoidance.
One source of overflow during testing was changing the denominator on a
max-precision number. If the numerator was clamped with a large denominator,
changing to a smaller denominator without rescaling created a number that
would overflow later when applied to a commodity with a different SCU. This
change re-scales numerators in those cases so that the overflows don't happen.
2014-12-03 16:28:55 -08:00
John Ralls
456e121930 Ensure random numeric denominator is the account SCU when creating splits.
The lot creation and balancing code uses gnc_numeric_foo_fixed(), assuming that
all amounts in a split have the same denominator, the account's SCU. Ensuring
this when creating test cases prevents spurious failures.
2014-12-03 16:28:54 -08:00
John Ralls
b694df7202 Prevent overflow.
LCD denom was equivalent to using rounding.denom, which is val.denom * 10.
If val.num was at the max # of digits that would overflow, so instead
fix val.denom and actually round the result; since we're adding
5/(val.denom * 10) to accomplish the rounding we want to truncate the result.
2014-12-03 16:28:54 -08:00
John Ralls
701d8030b8 Ensure numeric errors aren't stored in split amounts or values. 2014-12-03 16:28:54 -08:00
John Ralls
c4d649bc93 A better, clearer approach to constraining random gnc_numerics
Which happens to actually work.
2014-12-03 16:28:54 -08:00
John Ralls
33a0c4e968 Reimplement gnc_numeric with QofInt128
And in a more C++ idiom.
2014-12-03 16:28:54 -08:00
John Ralls
ab94094523 Lose the value returns for various reasons of inequality. 2014-12-03 16:28:54 -08:00
John Ralls
a99335104f Assert that the quotient and remainder references aren't this.
Otherwise this gets zeroed and produces a wrong result.
2014-12-03 16:28:54 -08:00
John Ralls
f4c69dbc48 Ensure that the sign is correctly preserved and transferred. 2014-12-03 16:28:54 -08:00
John Ralls
9e37ad27b3 Implement QofInt128.pow. 2014-12-03 16:28:54 -08:00
John Ralls
f5c7b1101d Implement QofInt128::gcd and lcm. 2014-12-03 16:28:54 -08:00
John Ralls
765d5583c1 Fix mask error in operator<<= and operator>>=
Must specify 1 as a uint64_t to get the right masks.
2014-12-03 16:28:54 -08:00
John Ralls
7c22669a76 Check for incoming overflow and NaN on all class computational operators. 2014-12-03 16:28:54 -08:00
John Ralls
296ce314a3 Extract a class function bits() to return a size value.
Helps to pre-determine overflow. Also correct the original implementation
in operator *=, which got the wrong answer.
2014-12-03 16:28:53 -08:00
John Ralls
1b288df20d Add bitwise operators and binary operators. 2014-12-03 16:28:53 -08:00
John Ralls
c649aa9736 Some more constructors, for convenience. 2014-12-03 16:28:53 -08:00
John Ralls
810a6bc8ae Operators /= and %= plus function div() for QofInt128. 2014-12-03 16:28:53 -08:00
John Ralls
1c83db5896 Add increment, decrement, and shift-eauals operators to QofInt128.
They'll be needed for division.
2014-12-03 16:28:53 -08:00
John Ralls
c7752d5d3c Add zero and abs functions to QofInt128. 2014-12-03 16:28:53 -08:00
John Ralls
1e6855efe5 Implement operator*= for QofInt128 2014-12-03 16:28:53 -08:00
John Ralls
d4fdd9ef17 Begin QofInt128 class.
Constructs, adds & subtracts, prints, and compares.

Includes unit tests.
2014-12-03 16:28:53 -08:00
John Ralls
9d029d7f82 More realistic get_random_gnc_numeric()
Increases the possible denominators to 1E10, but clamps the numerator to
1E13 * denom with 1E19 max. This is equivalent to $1E8/1 US in
Indonesian Rupiah, the currency with the lowest per-unit value in the
world at the time of this commit.
2014-12-03 16:28:53 -08:00
John Ralls
996345a00f Fix gperformance-tools setup and apply it to src/engine/tests. 2014-12-03 16:26:38 -08:00
Geert Janssens
032a2ee169 Yet another guile 2 precompile fix of the German tax report
The previous one only fixed part of the problem
2014-12-03 12:04:49 +01:00
Geert Janssens
2ef755052e Fix guile 2 precompilation of German tax report 2014-12-03 09:52:08 +01:00
John Ralls
946432c953 Guile compilation: One missed CLEANFILES. 2014-12-02 09:47:20 -08:00
John Ralls
e1310bc9ff Fix the *.win32-bin.txt and downloaded.mt940 attributes. 2014-12-02 09:34:56 -08:00
John Ralls
5933f0dc1f Guile precompilation: One more missing library-dir. 2014-12-02 09:03:11 -08:00
John Ralls
afdf0de542 Reapply fix of Guile precompilation without unwanted change in gnc-numeric.c. 2014-12-02 08:25:34 -08:00
John Ralls
9bcc1ad6ce Revert "Fix Guile-2.0 precompilation."
This reverts commit a26801ab0e.
2014-12-02 08:18:06 -08:00
John Ralls
a26801ab0e Fix Guile-2.0 precompilation. 2014-12-01 21:50:46 -08:00
Frank H. Ellenberger
5aa8f8dbae Update of de.po: 351 +50 remaining 2014-12-01 15:06:04 +01:00
John Ralls
4afa8be3c5 Bug 738477 - WebKit is broken on Win32.
Turns out our URL for loading jqplot is what was broken.
2014-11-30 16:08:00 -08:00
Robert Fewell
3c46aac94a Bug 738462 - CSV Import This patch adds some text to clarify that the transaction export is not a match for the import. 2014-11-30 15:43:18 +01:00
Robert Fewell
32dd199326 Bug 679791 - Import Template for importing CSV files - part2
This patch adds the option to Save and Load the CSV import settings.
2014-11-30 15:32:12 +01:00
Robert Fewell
eec86eec80 Bug 679791 - Import Template for importing CSV files - part 1.
This patch fixes the resetting of the widgets on the setting
preview page when you navigate back to the file selection page
in the assistant.
2014-11-30 15:31:37 +01:00
Frank H. Ellenberger
abd237fb48 Update of de.po -still 530 + 53 to review
Rework of
0022bc21f4
2014-11-30 04:48:14 +01:00
Geert Janssens
1b53d7fa2e Merge branch 'master' of https://github.com/c-holtermann/gnucash 2014-11-29 16:32:50 +01:00
Geert Janssens
e219ef22ea Merge branch 'maint' 2014-11-29 14:26:27 +01:00
Geert Janssens
abf78a202c Python bindings - fix creation of new xml files 2014-11-24 11:51:33 +01:00
John Ralls
19f08da56b Implement copy and move operator= and move constructor for KvpValueImpl
Fixes double-delete crash of the embedded ptr when copy-initializing.
2014-11-18 17:00:04 -08:00
lmat
ba59350f69 Adding KvpValueImpl test suite 2014-11-18 09:54:34 -08:00
Geert Janssens
e59c3e0639 Fix a few typos in python example scripts and align them with the latest api changes 2014-11-17 17:59:07 +01:00
Geert Janssens
22490a37ab Fix build-time hard-coded path introduced by the guile2 compile changes
These changes hardcoded the standards-reports path at build time.
On Windows and OS X the final path is only known at installation time.
So after installation the build-time hard-coded path would be invalid and
the standard-reports directory could no longer be found.
2014-11-17 14:48:02 +01:00
Geert Janssens
64d9a3b99e Prevent crash when standards-report dir doesn't exist 2014-11-17 15:43:16 +01:00
Christoph Holtermann
67b807fbf1 Small doc changes 2014-11-12 16:50:00 +01:00
Christoph Holtermann
de47330288 Change latex_invoices.py to query for all invoices
Before invoices were catched by going through lots
and getting associated invoices.
2014-11-12 16:45:53 +01:00
Christoph Holtermann
c86c69ad05 Additional doxygen doc 2014-11-12 16:39:08 +01:00
Christoph Holtermann
7d6caa8232 latex_invoices.py includes gncinvoicefkt.py 2014-11-12 15:30:13 +01:00
Geert Janssens
578dfd810b Fix head-or-tail stylesheet after guile2 compile changes
In particular the N_ macro is now defined in a separate module
which should be 'use-module'd when N_ is used.
2014-11-12 15:24:47 +01:00