[Mono-bugs] [Bug 655780] New: Decimal.ToString sometimes produces excess trailing zeros

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Nov 24 11:24:33 EST 2010


https://bugzilla.novell.com/show_bug.cgi?id=655780

https://bugzilla.novell.com/show_bug.cgi?id=655780#c0


           Summary: Decimal.ToString sometimes produces excess trailing
                    zeros
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.8.x
          Platform: x86
        OS/Version: Windows 7
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: joe at mistachkin.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12)
Gecko/20101026 Firefox/3.6.12


The following code shows the problem clearly:

using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            decimal d;

            for (d = 0; d < 5; d++)
                Console.WriteLine("d = {0}, d/3 = {1}", d, d / 5);

            Console.ReadKey();
        }
    }
}


Reproducible: Always

Steps to Reproduce:
1. Compile and run the above code.

Actual Results:  
d = 0, d/3 = 0
d = 1, d/3 = 0.2000000000000000000000000000
d = 2, d/3 = 0.4000000000000000000000000000
d = 3, d/3 = 0.6000000000000000000000000000
d = 4, d/3 = 0.8000000000000000000000000000


Expected Results:  
d = 0, d/3 = 0
d = 1, d/3 = 0.2
d = 2, d/3 = 0.4
d = 3, d/3 = 0.6
d = 4, d/3 = 0.8

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list