[Mono-list] Bug in mono floating point computation

dietmar dietmar@ximian.com
02 Dec 2002 15:51:20 +0100


Should be fixed in latest CVS.

- Dietmar

On Sun, 2002-12-01 at 20:10, Stephane SOPPERA wrote:
> Hi,
> 
> I think I saw a bug and I managed to isolate it in the following code:
> 
> using System;
> 
> class Bug{
>         static void Main()
>         {
>                 ulong u = 3960077;
>                 ulong f = 1000000;
> 
>                 for (int i = 0; i< 10000000; ++i) 
>                 {
>                         Math.Cos(i);
>                 }
> 
>                 double d = u/(double)f;
> 
>                 Console.WriteLine(d);
>                 
>                 d = u/(double)f;
> 
>                 Console.WriteLine(d);
> 
> 
>                 
>         }
> }
> 
> 
> this code produces the following output:
> nan
> 3,960077
> 
> Is that a bug?
> What I think to be the problem is that the nan comes from the cos
> computation and since I'm not reading the output of cos a "nan flag"
> keeps activated and is desactivated at the first floating point
> computation following the cos.
> 
> I'm using mono 0.16 provided by the RPM for mandrake 8.2. I'm running
> a
> mandrake 9.0.
> 
> Is that a bug?
> Is it already corrected (I didn't see it in bugzilla)?
> 
> Thanks in advance,
> 
> 
> -- 
> Stephane SOPPERA
> http://stephane.soppera.free.fr
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>