http://bugzilla.novell.com/show_bug.cgi?id=576341
http://bugzilla.novell.com/show_bug.cgi?id=576341#c0 Summary: Modulus on Decimal values does not work as expected Classification: Mono Product: Mono: Runtime Version: 2.6.x Platform: PC OS/Version: Windows 7 Status: NEW Severity: Minor Priority: P5 - None Component: JIT AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: Third Party Developer/Partner Blocker: No Description of Problem: The modulus operator (%) doesn't appear to work as expected on decimal values. (Or at least match C# on the Microsoft .NET implementation.) Steps to reproduce the problem: 1. Compile the attached source file. 2. Run it. Actual Results: 20.0M % 10.0M = 0.0 20.0M % 10.00M = 10.00 (should be 0.0) This likely has to do with the semantic difference between 0.0 and 0.00 to the Mono runtime. (There shouldn't be one.) Expected Results: Matches C# on Windows. (20.0M % 10.0M = 0.0) How often does this happen? Every time. Additional Information: Here is a console session illustrating the problem: ----------------------- D:\FSharp\Oct 2009 CTP\bin>type ModDecimals.cs using System; namespace Repro { class Repro { static void Main() { decimal a = 20.0M; decimal b = 10.0M; decimal c = 10.00M; // Note second 0 Console.WriteLine("20.0M % 10.0M = {0}", (a % b)); Console.WriteLine("20.0M % 10.00M = {0}", (a % c)); } } } D:\FSharp\Oct 2009 CTP\bin>C:\Windows\Microsoft.NET\Framework\v2.0.50727\csc. ModDecimals.cs Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.4927 for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727 Copyright (C) Microsoft Corporation 2001-2005. All rights reserved. D:\FSharp\Oct 2009 CTP\bin>ModDecimals.cs D:\FSharp\Oct 2009 CTP\bin>ModDecimals.exe 20.0M % 10.0M = 0.0 20.0M % 10.00M = 0.00 D:\FSharp\Oct 2009 CTP\bin>mono ModDecimals.exe 20.0M % 10.0M = 0.0 20.0M % 10.00M = 10.00 -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
