[Mono-devel-list] problems wih decimal on cygwin

Konstantin Triger kostat at mainsoft.com
Wed Jul 6 07:05:30 EDT 2005


Hi Eno,

I think not:
In the reported bug mono divides exactly, while in .Net the result is 
rounded.
I have a situation when the result is wrong (0/x != 0) and an exception 
is thrown. When I test it with mono 2.0 it works correctly. I also 
suppose that on linux the issue will disappear.

Regards,
Konstantin Triger



Atsushi Eno wrote:

> Hi Kosta,
>
> Maybe the same or similar bug as #71287?
> http://bugzilla.ximian.com/show_bug.cgi?id=71287
>
> Atsushi Eno
>
> Konstantin Triger wrote:
>
>> Hello,
>>
>> I run the following code on cygwin:
>>
>> decimal d1 = 0;
>> decimal d = d1 / 10000000000000000000000000000M;
>> Console.WriteLine( d > 0 );
>> decimal d2 = 1;
>> decimal d3 = d2 + d;
>> Console.WriteLine( d3 );
>>
>> and the output it produces is:
>>
>> True
>>
>> Unhandled Exception: System.OverflowException: Overflow on adding 
>> decimal number
>> in <0x00063> System.Decimal:Add (Decimal d1, Decimal d2)
>> in <0x0004a> System.Decimal:op_Addition (Decimal d1, Decimal d2)
>> in <0x001e8> Class1:Main (System.String[] args)
>>
>> Has anyone run into this situation?
>>
>




More information about the Mono-devel-list mailing list