[Mono-list] bug found! :-)

Thong (Tum) Nguyen tum@veridicus.com
Wed, 27 Aug 2003 02:19:54 +1200


^Tum


> -----Original Message-----
> From: mono-list-admin@lists.ximian.com [mailto:mono-list-
> admin@lists.ximian.com] On Behalf Of Rohit
> Sent: Tuesday, 26 August 2003 10:06 p.m.
> To: Thong (Tum) Nguyen; 'Maurizio Colucci'; mono-list@lists.ximian.com
> Subject: RE: [Mono-list] bug found! :-)
> 
> please see inline...
> 
> --- "Thong (Tum) Nguyen" <tum@veridicus.com> wrote:
> > Hmm..that's not the reason.
> >
> > 4/3 isn't an integer if you're doing floating point
> > arithmetic but
> > that's not what's happening here. Notice how the
> > following compiles
> > without an error:
> >
> > int u = 3;
> > int I = 4;
> > int o = i / u;
> >
> > The reason there is an error in Maurizio's code is
> > because dividing an
> > integer by an unsigned integer yields a long
> > (otherwise precision would
> > be lost).  The resulting long can't be assigned to
> > the integer "o"
> > without a cast.
> 
> that is exactly what I mean when I said 4/3 != integer
> (i did mean 3 is of uint type as was asked and as
> gaurav too correctly and clearly pointed out).

You said:

4/3 = 1.3333333333333333333333333333333 != integer.

The excessive amount of "3"s made me think you thought 4/3 =
1.333333333F rather than 4/3 = 1L = long != integer.  That's an
important distinction.

^Tum

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.298 / Virus Database: 161 - Release Date: 13/11/2001