[Mono-list] bug found! :-)

Thong (Tum) Nguyen tum@veridicus.com
Tue, 26 Aug 2003 20:40:24 +1200


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.  

Of course the error should be "cannot convert from long to int" rather
than "cannot convert from int to long".

All the best,

^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 3:37 p.m.
> To: Maurizio Colucci; mono-list@lists.ximian.com
> Subject: Re: [Mono-list] bug found! :-)
> 
> thats not a bug!
> cause
> 
> 4/3 = 1.3333333333333333333333333333333 != integer.
> 
> thanks
> rohit
> --- Maurizio Colucci <seguso.forever@tin.it> wrote:
> > uint u = 3;
> > int i = 4;
> > int o = i/u; << error
> >
> > Mono gives the error: cannot convert from int to
> > long.
> > But there is no long here, just an uint (32 bits).
> >
> >
> > mono 0.26 redhat rpms.
> >
> > _______________________________________________
> > Mono-list maillist  -  Mono-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 
> 
> ---
> Incoming 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
> 

---
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