View Issue Details

IDProjectCategoryView StatusLast Update
0000946MetaPostbugpublic2016-11-25 11:29
Reportertoby Assigned Toluigi scarso  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version1.890 
Summary0000946: Decimal number system: floor function is wrong with negative argument
DescriptionThe 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 Reproduceshow numbersystem;
show floor -3.14159;
Additional InformationProduces -3 with "decimal" number system, but should produce -4. (Works ok with "Scaled", "double", and "binary".)
TagsNo tags attached.

Activities

toby

2015-08-16 23:21

reporter   ~0001395

This is with V1.999 compiled from trunc a couple of weeks ago, and with v1.902

toby

2015-08-17 16:14

reporter   ~0001396

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.

luigi scarso

2015-09-14 18:35

manager   ~0001404

Thank you for the report.

luigi scarso

2015-09-21 08:56

manager   ~0001409

Fixed in revision 2068.

Issue History

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