[Mono-list] -- Math.cs --

yoros@wanadoo.es yoros@wanadoo.es
Thu, 6 Feb 2003 21:41:29 +0100


In the documentation is said that Math.Round for doubles and decimals
will do the bank rounding... It does now.

See you,

    Pedro


On Thu, Feb 06, 2003 at 11:53:56AM +0100, dietmar wrote:
> Marcus just pointed out the we cant use round(), because it does not
> conform to IEEE rounding conventions. Try the following test:
> 
> using System;
> 
> class Test {
> 
> 	static void Main () {
> 		Console.WriteLine (Math.Round((double)2.5));
> 		Console.WriteLine (Math.Round((double)3.5));
> 		Console.WriteLine (Math.Round((double)4.5));
> 		Console.WriteLine (Math.Round((double)5.5));
> 	}
> }
> 
> Result is:
> 
> 2
> 4
> 4
> 6
> 
> - Dietmar
> 
> On Sun, 2003-02-02 at 09:42, yoros@wanadoo.es wrote:
> > Hi,
> > 
> > Here are the final files that I got. I think that the Math performance
> > is good and that the results are the most accurate that can be with
> > "libm" because MS.NET are using another kind of numerical algorithms.
> > 
> > I changed the following files:
> > 
> >         mcs/class/corlib/System/Math.cs
> >         mono/mono/metadata/icall.c
> >         mono/mono/metadata/sysmath.h
> >         mono/mono/metadata/sysmath.c
> > 
> > With this mail, there is the changelog file for Math.cs (please, be
> > careful with the "tildes").
> > 
> > Sorry for the other posts, I was trying to get this out quickly
> > because
> > I have a lot of work and I must study.
> > 
> > See you,
> > 
> >     Pedro
> > 
> > -- 
> > Pedro Martinez Juliá
> > \  yoros@terra.es
> > )|    yoros@wanadoo.es
> > /        http://yoros.cjb.net
> > Socio HispaLinux #311
> > Usuario Linux #275438 - http://counter.li.org
> > GnuPG public information:  pub  1024D/74F1D3AC
> > Key fingerprint = 8431 7B47 D2B4 5A46 5F8E  534F 588B E285 74F1 D3AC
> > 
> 

-- 
Pedro Martinez Juliá
\  yoros@terra.es
)|    yoros@wanadoo.es
/        http://yoros.cjb.net
Socio HispaLinux #311
Usuario Linux #275438 - http://counter.li.org
GnuPG public information:  pub  1024D/74F1D3AC
Key fingerprint = 8431 7B47 D2B4 5A46 5F8E  534F 588B E285 74F1 D3AC