Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Avoid string in amount_t::in_place_truncate | Max Nikulin | 2024-08-15 | 1 | -26/+1 |
| | | | | | Do not serialize to string just to get rounded value. `in_place_roundto` should be reliable enough now. | ||||
* | Avoid ctype abuse. | Taylor R Campbell | 2024-08-06 | 1 | -3/+4 |
| | | | | | fix https://github.com/ledger/ledger/issues/2338 fix https://github.com/ledger/ledger/issues/2340 | ||||
* | Fix copy on write for amount_t::in_place_roundto | Max Nikulin | 2024-08-06 | 1 | -8/+1 |
| | | | | | | | | | | | | - Copy amount quantity before rounding. - Fix `amount_t::roundto(int)`. - Transform `balance/testRound` into `balance/testRoundto`. It was a mix of `round` and `roundto` operation with unclear purpose and was relying on `in_place_roundto` behavior modifying all copies. There is no unit tests for balance `round` and `unround` any more. Closes #2362 | ||||
* | Fix denominator of roundto result | Max Nikulin | 2024-08-05 | 1 | -2/+39 |
| | | | | | | | | | | | | | | | | | | Multiprecision rational created from a double value may have large power of 2 denominator since fractional decimal numbers can not be represented as binary floating point numbers. It leads to failed assertion when result is compared to a value converted directly from strings. Use integer multiprecision arithmetics to round numbers to ensure proper denominator. Inspired by python gmpy2 package <https://github.com/aleaxit/gmpy/blob/3e4564ae9d/src/gmpy2_mpq_misc.c#L315> The change makes `roundto` symmetric for positive/negative arguments. Halves are rounded to nearest even. Rounded away from zero are discussed in #1663 and it may be achieved with minimal modification. - See #2329 - Closes #1983 | ||||
* | Refactor basic_flags_t to ledger::flags::basic_t | Alexis Hildebrandt | 2023-04-12 | 1 | -1/+1 |
| | |||||
* | Update copyright year | Alexis Hildebrandt | 2023-02-02 | 1 | -1/+1 |
| | | | | [skip ci] | ||||
* | Update copyright statement for 2022 | Alexis Hildebrandt | 2022-07-02 | 1 | -1/+1 |
| | |||||
* | Avoid dereferencing null pointer | Kunht Kun | 2022-03-12 | 1 | -1/+2 |
| | | | | | | | Here `comm` could be a null pointer (the new test regress/2057 shows such a case). So test it before dereferencing to avoid segfault. Re: #2057 | ||||
* | Use correct int return type for stream input operations | kanreki | 2021-12-08 | 1 | -4/+4 |
| | | | | | | | | This makes it safe to compare results to -1 to indicate EOF, regardless of whether char is considered signed or unsigned; and so eliminates compiler warnings on platforms such as ARM. Fixes bug #2058. | ||||
* | Fix --time-colon for negative time amounts | Rafael Ascensão | 2021-09-27 | 1 | -7/+3 |
| | | | | | | | | | | | | | | | While the current formula works for positive numbers, negative numbers are incorrectly represented. One of the issues comes from the fact that floor(x) < x for every x. `amount_t precision` will always be a non negative number and the code that attempts to fix the issue for negative number will never run. If we truncate the number instead, the current formula works for both positive and negative numbers without making negative numbers a corner case. So let's do that. Signed-off-by: Rafael Ascensão <rafa.almas@gmail.com> | ||||
* | Fix amount tokenizer re: embedded minus sign. | Donald Lam | 2021-05-02 | 1 | -2/+9 |
| | | | | | An amount may have a (single) leading minus sign, but none after that. Bug #2001 (and #1809). | ||||
* | Fix typos in comments | Martin Michlmayr | 2020-05-21 | 1 | -2/+2 |
| | |||||
* | Don't attempt to invert a value if it's already zero (#1703) | John Wiegley | 2019-01-11 | 1 | -1/+3 |
| | |||||
* | [misc] Update year in copyright notice to 2017 | Alexis Hildebrandt | 2018-01-27 | 1 | -1/+1 |
| | | | | [ci skip] | ||||
* | The "format" directive for commodities now disables "style observation" | John Wiegley | 2018-01-01 | 1 | -1/+3 |
| | |||||
* | [misc] Update year in copyright notice to 2017 | Alexis Hildebrandt | 2017-01-05 | 1 | -1/+1 |
| | | | | [ci skip] | ||||
* | [misc] Update year in copyright notice to 2016 | Alexis Hildebrandt | 2016-01-02 | 1 | -1/+1 |
| | | | | [ci skip] | ||||
* | [ledger] Remove --cache option | Alexis Hildebrandt | 2015-02-18 | 1 | -79/+0 |
| | | | | and all boost serialisation related code. | ||||
* | Bump copyright notice to 2015 | Alexis Hildebrandt | 2014-12-27 | 1 | -1/+1 |
| | | | | | | The following script makes it a no-brainer: % NEXT_YEAR=2015; ag -l 'Copyright.*Wiegley' \ | xargs sed -i '' -e "s/\(Copyright.*\)-20[0-9]\{2\}/\1-${NEXT_YEAR}/" | ||||
* | Unify debugging categories | Martin Michlmayr | 2014-07-01 | 1 | -4/+4 |
| | | | | | Debugging categories follow the filename, which in this case is singular (rather than plural) "account" and "amount". | ||||
* | Bump copyright information to 2014 | Alexis Hildebrandt | 2014-02-02 | 1 | -1/+1 |
| | |||||
* | Apply --time-colon option only to time commodities | Alexis Hildebrandt | 2013-09-07 | 1 | -5/+5 |
| | | | | See #989 | ||||
* | Resolve new compiler warnings from Clang | John Wiegley | 2013-05-19 | 1 | -0/+2 |
| | |||||
* | fix ledger xml output, remove ledger json command | Johann Klähn | 2013-03-08 | 1 | -5/+3 |
| | | | | | | | | | | | | As the format used by property trees to represent valid JSON and that for valid XML is too different and given that there are more requests for valid XML output I decided to pursue a quick fix and remove the json command in favor of a working xml command. See bug #782, #909, recent discussion on mailing list. JSON support is postponed until I or someone else finds time to work on this or the python bindings are more stable. | ||||
* | Bump copyright information to 2013 | John Wiegley | 2013-02-18 | 1 | -1/+1 |
| | |||||
* | Bug 634 Added roundto function, optimized floor and ceiling | Craig Earls | 2013-01-30 | 1 | -14/+15 |
| | | | | Fixes Bug634 by adding roundto(amount, places). | ||||
* | Merge pull request #107 from afh/pull/time_colon | John Wiegley | 2013-01-29 | 1 | -2/+21 |
|\ | | | | | Add --time-colon option | ||||
| * | Add --time-colon option | Alexis Hildebrandt | 2012-11-10 | 1 | -2/+21 |
| | | | | | | | | | | | | | | | | | | The --time-colon option will display the value for a seconds based commodity as real hours and minutes. For example 8100 seconds by default will be displayed as 2.25 whereas with the --time-colon option they will be displayed as 2:15. | ||||
* | | whitespace cleanup | Johann Klähn | 2013-01-16 | 1 | -1/+1 |
|/ | |||||
* | Bug 634 and 488, Corrected behavior of floor, and added ceiling | Craig Earls | 2012-10-25 | 1 | -3/+20 |
| | | | | This is only a partial fix for 634, since rounding is not fixed. | ||||
* | Changed all ASSERTS_ON -> !NO_ASSERTS | John Wiegley | 2012-05-20 | 1 | -1/+1 |
| | |||||
* | Converted the Ledger build system to use CMake | John Wiegley | 2012-05-20 | 1 | -7/+7 |
| | |||||
* | Switched to Boost.PropertyTree for XML generation | John Wiegley | 2012-05-18 | 1 | -7/+5 |
| | |||||
* | Switch to using Boost.Format | John Wiegley | 2012-05-14 | 1 | -6/+6 |
| | |||||
* | Whitespace fix | John Wiegley | 2012-03-30 | 1 | -4/+4 |
| | |||||
* | Never price commodities using annotated commodities | John Wiegley | 2012-03-30 | 1 | -3/+3 |
| | |||||
* | Improved some error messages | John Wiegley | 2012-03-29 | 1 | -10/+8 |
| | |||||
* | Always call TRACE_CTOR at the end of constructors | John Wiegley | 2012-03-20 | 1 | -5/+5 |
| | |||||
* | Tighten up argument passing related to fn_market() | John Wiegley | 2012-03-11 | 1 | -12/+7 |
| | |||||
* | Added syntactic sugar for lot pricing: {{$500.00}} | John Wiegley | 2012-03-10 | 1 | -4/+8 |
| | |||||
* | Added amount_t::commodity_ptr() | John Wiegley | 2012-03-09 | 1 | -2/+7 |
| | |||||
* | Made amount_t::price return an optional<amount_t> | John Wiegley | 2012-03-07 | 1 | -2/+2 |
| | |||||
* | Corrected several compile and link problems | John Wiegley | 2012-03-06 | 1 | -0/+2 |
| | |||||
* | Changed the category of a few DEBUG statements | John Wiegley | 2012-03-06 | 1 | -4/+4 |
| | |||||
* | Use unique_ptr instead of std::auto_ptr | John Wiegley | 2012-03-05 | 1 | -2/+2 |
| | |||||
* | All tests are working again but one | John Wiegley | 2012-03-05 | 1 | -6/+3 |
| | |||||
* | Increased file copyrights to 2012 | John Wiegley | 2012-02-29 | 1 | -1/+1 |
| | |||||
* | Fixed many Clang type conversion warnings with static_cast | John Wiegley | 2012-02-17 | 1 | -4/+8 |
| | |||||
* | Fixes for variable shadowing (5/28) | John Wiegley | 2012-02-17 | 1 | -3/+3 |
| | |||||
* | Fixes for variable shadowing (4/28) | John Wiegley | 2012-02-17 | 1 | -4/+4 |
| |