summaryrefslogtreecommitdiff
path: root/test/regress/2329.test
Commit message (Collapse)AuthorAgeFilesLines
* More unit tests for amount_t::roundtoMax Nikulin2024-08-071-2/+2
| | | | | - Add some tests from comments to pull request #2361. - Fix decimal separator in earlier added tests.
* Fix denominator of roundto resultMax Nikulin2024-08-051-0/+83
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