[Mono-list] Mono and .Net Floating Point Inconsistencies

Robert Jordan robertj at gmx.net
Sat Jan 17 22:01:18 EST 2009


ddambro wrote:
> Hi,
> 
> I was fairly sure the code had executed.  As I mentioned, different flags in
> the C code caused errors in the program.  Just to be sure though, I threw in
> some fprintf statements to stderr into setFloats() and they printed
> properly, so the code was definitely executed.
> 
> Thankfully I have been able to come up with some code that shows at least
> one example of the inconsistencies I've been talking about.  Here it is:

It's just a string representation mismatch, as this code reveals the
same bits:

         Console.WriteLine(f1.ToString("R"));

	foreach (byte b in BitConverter.GetBytes(f1))
		Console.WriteLine (b);

Robert



More information about the Mono-list mailing list