gnucash master: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Fri Dec 5 19:56:34 EST 2014


Updated	 via  https://github.com/Gnucash/gnucash/commit/ae7e9c24 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8a3e3687 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d35bcdb8 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8e429f74 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/79938cae (commit)
	 via  https://github.com/Gnucash/gnucash/commit/7c7946de (commit)
	 via  https://github.com/Gnucash/gnucash/commit/503a6070 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/456e1219 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/b694df72 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/701d8030 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c4d649bc (commit)
	 via  https://github.com/Gnucash/gnucash/commit/33a0c4e9 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ab940945 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a9933510 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f4c69dbc (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9e37ad27 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/f5c7b110 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/765d5583 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/7c22669a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/296ce314 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1b288df2 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c649aa97 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/810a6bc8 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1c83db58 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c7752d5d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1e6855ef (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d4fdd9ef (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9d029d7f (commit)
	 via  https://github.com/Gnucash/gnucash/commit/996345a0 (commit)
	from  https://github.com/Gnucash/gnucash/commit/3c46aac9 (commit)



commit ae7e9c24121671f536db7d07505d582d6b0c057f
Merge: 996345a 8a3e368
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Dec 5 15:47:54 2014 -0800

    Merge branch 'c++-numeric'
    
    A new C++ implementation of 128-bit math replaces qofmath128.c with
    gnc-int128.cpp, and the gnc-numeric arithmetic operations now wrap
    the equivalent functions in a new GncRational class, which works with
    a GncDenom class to handle rounding and denominator-type settings.
    
    All arithmetic is now done with 128 bits of precision and no overflows
    are signalled until conversion back to the int64_t-based gnc_numeric.
    C++ clients will be able to use GncRational directly, at which point
    some of its other functionality can be added; this will allow chained
    128-bit arithmetic, which will permit more complicated calculations
    without overflow.
    
    Operators are not implemented for GncRational (they are for GncInt128,
    which makes the GncRational implemntation much easier to read) because
    of the need for passing denominator and rounding specs.

commit 8a3e3687912b67df2d36dfb2ca1d4aadb0773c5b
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Dec 5 15:46:07 2014 -0800

    Rename QofInt128 to GncInt128.
    
    It has nothing to do with QOF.

commit d35bcdb877608b9dd44e7184f74c02189be1cd00
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Dec 5 14:50:23 2014 -0800

    Move arithmetic functions into C++ implementation.

commit 8e429f7458161cb60120d8ca9836cd59006a7323
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Dec 4 11:48:08 2014 -0800

    Rename GncNumeric to GncRational and move to its own files.

commit 79938cae2e9d360a9cd39dfb0a5cc3d9113ce076
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Dec 3 16:32:01 2014 -0800

    Remove qofmath128, replaced by qofint128.

commit 7c7946dec879e691aee8683ba85deda23b943f64
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Dec 3 10:31:37 2014 -0800

    Disable rescaling big GncNumerics when there is a pre-calculated auto denom.

commit 503a607090980f5f14966b323a9a69878ed4a614
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Dec 3 10:29:55 2014 -0800

    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.

commit 456e121930903a14d5ca1076ae5e61c994c1744f
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Dec 3 10:24:37 2014 -0800

    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.

commit b694df72020b43d63fce1d4bfa673e7ea9a42e43
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Dec 3 10:18:03 2014 -0800

    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.

commit 701d8030b830a24089e0ae18d84bd2be8a032c32
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Dec 3 10:11:35 2014 -0800

    Ensure numeric errors aren't stored in split amounts or values.

commit c4d649bc93e83a44c346800211090202bf7b5e9f
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Nov 29 17:54:45 2014 -0800

    A better, clearer approach to constraining random gnc_numerics
    
    Which happens to actually work.

commit 33a0c4e968c1564d1323b710e6c8c18776c1f83b
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Nov 29 17:53:41 2014 -0800

    Reimplement gnc_numeric with QofInt128
    
    And in a more C++ idiom.

commit ab94094523ecf8df6ed2312b298adbfb5aec1b08
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Nov 29 13:24:03 2014 -0800

    Lose the value returns for various reasons of inequality.

commit a99335104fe6951ffa5647da65ee10862a813202
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Nov 29 13:23:18 2014 -0800

    Assert that the quotient and remainder references aren't this.
    
    Otherwise this gets zeroed and produces a wrong result.

commit f4c69dbc48326046f900e01779caf97748af7afb
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Nov 29 13:22:00 2014 -0800

    Ensure that the sign is correctly preserved and transferred.

commit 9e37ad27b354b7e4c0228e14d1aaec4feebc2f5f
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Nov 19 13:31:19 2014 -0800

    Implement QofInt128.pow.

commit f5c7b1101d743b735a4409a5dbc3a8f9562504ca
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Nov 19 10:36:00 2014 -0800

    Implement QofInt128::gcd and lcm.

commit 765d5583c157b8ba50c06b7a6b33eb4fda4671a7
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Nov 19 10:35:34 2014 -0800

    Fix mask error in operator<<= and operator>>=
    
    Must specify 1 as a uint64_t to get the right masks.

commit 7c22669a76fd711469bc720d2c8e644833215465
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Nov 17 14:44:38 2014 -0800

    Check for incoming overflow and NaN on all class computational operators.

commit 296ce314a3863becc612f90f3253c9f5501def47
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Nov 17 14:43:23 2014 -0800

    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.

commit 1b288df20d2b52792ec1aae8f3c9c2170001fb5f
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Nov 17 14:40:39 2014 -0800

    Add bitwise operators and binary operators.

commit c649aa97363e3c7d739023cd0c9248a2b8142b6b
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Nov 17 14:38:57 2014 -0800

    Some more constructors, for convenience.

commit 810a6bc8aedafda9cac21e7a3fb59dca52f433e2
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Nov 17 12:13:34 2014 -0800

    Operators /= and %= plus function div() for QofInt128.

commit 1c83db5896c1f5f6270a63c069f5eee2d94c4ed0
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Nov 17 12:09:55 2014 -0800

    Add increment, decrement, and shift-eauals operators to QofInt128.
    
    They'll be needed for division.

commit c7752d5d3cd4f9ce6bcdba3e1c7d6b08a14d572d
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Nov 17 12:08:00 2014 -0800

    Add zero and abs functions to QofInt128.

commit 1e6855efe560934f5fab1e4980ffff4ec5690777
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Nov 9 11:55:59 2014 -0800

    Implement operator*= for QofInt128

commit d4fdd9ef1788073f56cbbfa173374d96bb87e9dc
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Oct 29 18:32:47 2014 -0700

    Begin QofInt128 class.
    
    Constructs, adds & subtracts, prints, and compares.
    
    Includes unit tests.

commit 9d029d7f821e36e6a0c4f05669ed035d1ade151e
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Sep 20 18:06:41 2014 -0700

    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.

commit 996345a00f7f267ba404edda50cab359fd60666e
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Dec 3 16:24:16 2014 -0800

    Fix gperformance-tools setup and apply it to src/engine/tests.



Summary of changes:
 configure.ac                                 |   2 +-
 po/POTFILES.in                               |   3 +-
 src/app-utils/gnc-ui-util.c                  |   4 +-
 src/app-utils/test/test-print-parse-amount.c |   2 +-
 src/backend/xml/test/test-dom-converters1.c  |   2 +-
 src/engine/Split.c                           |   9 +-
 src/engine/cap-gains.c                       |   3 +
 src/engine/gnc-lot.c                         |   1 +
 src/engine/test-core/test-engine-stuff.c     | 120 ++--
 src/engine/test-core/test-engine-stuff.h     |   2 +-
 src/engine/test/Makefile.am                  |   4 +
 src/engine/test/test-numeric.c               |  59 +-
 src/engine/test/utest-Split.cpp              |   7 +-
 src/engine/test/utest-Transaction.c          |   2 +-
 src/libqof/qof/Makefile.am                   |  13 +-
 src/libqof/qof/gnc-int128.cpp                | 923 +++++++++++++++++++++++++++
 src/libqof/qof/gnc-int128.hpp                | 254 ++++++++
 src/libqof/qof/gnc-numeric.cpp               | 756 +---------------------
 src/libqof/qof/gnc-numeric.h                 |   8 -
 src/libqof/qof/gnc-rational.cpp              | 351 ++++++++++
 src/libqof/qof/gnc-rational.hpp              |  87 +++
 src/libqof/qof/qofmath128-p.h                |  86 ---
 src/libqof/qof/qofmath128.cpp                | 418 ------------
 src/libqof/qof/test/Makefile.am              |  17 +
 src/libqof/qof/test/gtest-gnc-int128.cpp     | 467 ++++++++++++++
 25 files changed, 2281 insertions(+), 1319 deletions(-)
 create mode 100644 src/libqof/qof/gnc-int128.cpp
 create mode 100644 src/libqof/qof/gnc-int128.hpp
 create mode 100644 src/libqof/qof/gnc-rational.cpp
 create mode 100644 src/libqof/qof/gnc-rational.hpp
 delete mode 100644 src/libqof/qof/qofmath128-p.h
 delete mode 100644 src/libqof/qof/qofmath128.cpp
 create mode 100644 src/libqof/qof/test/gtest-gnc-int128.cpp



More information about the gnucash-patches mailing list