Bug 17538 - incorrect rounding when adding/subtracting decimal values and precision of result is beyond decimal type (28+)
Summary: incorrect rounding when adding/subtracting decimal values and precision of re...
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: 3.2.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-01-31 07:12 UTC by INOMATA Kentaro
Modified: 2015-02-06 15:32 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description INOMATA Kentaro 2014-01-31 07:12:57 UTC
from http://d.hatena.ne.jp/hnw/20140104

decimal dcm3 = 987654321098765432109876543.2m;
decimal dcm4 = 0.05m;
decimal dcm5 = dcm3 + dcm4;

dcm3 + dcm4 is 987654321098765432109876543.25 and it IS equally close to two representable values, so "bankers' rounding" is expected, but actual value is 987654321098765432109876543.3.
Comment 1 Zoltan Varga 2014-02-01 22:08:50 UTC
->class libs for now
Comment 2 Marek Safar 2014-02-03 03:15:50 UTC
Addition/subtraction code is implemented in runtime
Comment 3 Miguel de Icaza [MSFT] 2015-02-06 15:32:59 UTC
Fixed with the new Decimal code.