[Mono-dev] Difference in floating point arithmetic between Mono and .NET

RandolphOfR omhpublic at haynold.com
Wed Mar 23 01:43:30 EDT 2011


Hello:

There seems to be an odd difference between how .NET and Mono treat the
following scenario (don't ask why I care about it--it's for an interface to
an existing Math package that gives meaning to special NaN values):

            var d = BitConverter.ToDouble(new byte[] { 162, 7, 0, 0, 0, 0,
240, 127 }, 0);
            var b = BitConverter.GetBytes(d);
            foreach (var a in b)
                Console.Write(a.ToString() + " ");
            Console.WriteLine();

Mono prints the line "162 7 0 0 0 0 240 127" but .Net (and, with equivalent
code, also Java) prints the line "162 7 0 0 0 0 248 127". Is there a reason
why this is so, and is it intentional? Intuitively, Mono's behavior seems
saner than .NET's, but I'm not an expert in IEE 754.


--
View this message in context: http://mono.1490590.n4.nabble.com/Difference-in-floating-point-arithmetic-between-Mono-and-NET-tp3398534p3398534.html
Sent from the Mono - Dev mailing list archive at Nabble.com.


More information about the Mono-devel-list mailing list