[Mono-list] bug found! :-)

Gaurav Vaish gvaish@adobe.com
Tue, 26 Aug 2003 14:15:39 +0530

See section 7.2.6 of C# Language Specs (Numeric Promotions).

    Numeric promotion consists of automatically performing certain implicit
conversions of the operands of the predefined unary and binary numeric
operators. Numeric promotion is not a distinct mechanism, but rather an
effect of applying overload resolution to the predefined operators. Numeric
promotion specifically does not affect evaluation of user-defined operators,
although user-defined operators can be implemented to exhibit similar

    As an example of numeric promotion, consider the predefined
implementations of the binary * operator:

int operator *(int x, int y);
uint operator *(uint x, uint y);
long operator *(long x, long y);
ulong operator *(ulong x, ulong y);
float operator *(float x, float y);
double operator *(double x, double y);
decimal operator *(decimal x, decimal y);

    When overload resolution rules (Section 7.4.2) are applied to this set
of operators, the effect is to select the first of the operators for which
implicit conversions exist from the operand types. For example, for the
operation b * s, where b is a byte and s is a short, overload resolution
selects operator *(int, int) as the best operator. Thus, the effect is that
b and s are converted to int, and the type of the result is int. Likewise,
for the operation i * d, where i is an int and d is a double, overload
resolution selects operator *(double, double) as the best operator.


----- Original Message ----- 
From: "Maurizio Colucci" <seguso.forever@tin.it>
To: <mono-list@lists.ximian.com>
Sent: Tuesday, August 26, 2003 14:00
Subject: Re: [Mono-list] bug found! :-)

> On Tuesday 26 August 2003 05:36, Rohit wrote:
> > thats not a bug!
> > cause
> >
> > 4/3 = 1.3333333333333333333333333333333 != integer.
> Then why does this remove the error?
> int o = i/(int)u
> ?