[Mono-bugs] [Bug 383531] [REGRESSION] Double number formatter inacurrate for certain mantissas

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Apr 25 06:33:35 EDT 2008


User robertj at gmx.net added comment

Robert Jordan <robertj at gmx.net> changed:

           What    |Removed                                         |Added
                 CC|                                                |robertj at gmx.net
            Summary|Double.Max / 2 = something different on Mono vs.|[REGRESSION] Double number formatter inacurrate
                   |.NET                                            |for certain mantissas

--- Comment #1 from Robert Jordan <robertj at gmx.net>  2008-04-25 04:33:34 MST ---
Only the string representation is different. Internally, the values are equal:

using System;

class Program
        static void Main()
                double expectedValue = 8.98846567431158E+307;
                double actualValue = Double.MaxValue / 2;

                Dump ("expectedValue", expectedValue);
                Dump ("actualValue", actualValue);
                Dump ("diff", Math.Abs (expectedValue - actualValue));

        static void Dump (string text, double d)
                Console.Write ("{0}: {1}: ", text, d.ToString("G17"));
                byte [] bytes = BitConverter.GetBytes (d);
                for (int i = 0; i < bytes.Length; i++)
                        Console.Write ("{0:000} ", bytes [i]);
                Console.WriteLine ();

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