View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000946 | MetaPost | bug | public | 2015-08-16 23:17 | 2016-11-25 11:29 |
Reporter | toby | Assigned To | luigi scarso | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.890 | ||||
Summary | 0000946: Decimal number system: floor function is wrong with negative argument | ||||
Description | The floor function does not work properly with negative arguments when using the decimal number system. This means that "ceiling" "mod" and "div" are also broken for negative arguments. | ||||
Steps To Reproduce | show numbersystem; show floor -3.14159; | ||||
Additional Information | Produces -3 with "decimal" number system, but should produce -4. (Works ok with "Scaled", "double", and "binary".) | ||||
Tags | No tags attached. | ||||
|
This is with V1.999 compiled from trunc a couple of weeks ago, and with v1.902 |
|
Here's a patch for "mpmathdecimal.w" 1428c1428 < set.round = DEC_ROUND_DOWN; --- > set.round = DEC_ROUND_FLOOR; reference: http://speleotrove.com/decimal/dncont.html You want to round towards -Infinity not towards zero. With this change, the bug is gone on my test system. |
|
Thank you for the report. |
|
Fixed in revision 2068. |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-08-16 23:17 | toby | New Issue | |
2015-08-16 23:21 | toby | Note Added: 0001395 | |
2015-08-17 16:14 | toby | Note Added: 0001396 | |
2015-09-14 18:35 | luigi scarso | Note Added: 0001404 | |
2015-09-21 08:56 | luigi scarso | Note Added: 0001409 | |
2016-11-25 11:29 | luigi scarso | Status | new => closed |
2016-11-25 11:29 | luigi scarso | Assigned To | => luigi scarso |
2016-11-25 11:29 | luigi scarso | Resolution | open => fixed |