[Mono-list] Possible conversion bug associated with Int64.
Roberto Jimeno
jimeno@servidor.unam.mx
24 May 2003 23:18:01 -0600
This appears to be a bug, although being quite new to C#/mono, I might
be missing something. Should I file a bug report?
BTW, neither Int32, IntU64 nor Decimal appear to present this
"anomalous" behavior.
/*
[jimeno@chiquis]$ mono int64conv-bug.exe
999999999999999999=999999999999999999
9999999999999999999=-8446744073709551617
*/
using System;
class principal
{
static void convAndShow(string stringedNumber)
{
Int64 integer;
try {
integer = Convert.ToInt64(stringedNumber);
}
catch (OverflowException oe) {
Console.WriteLine("{0} Is too large to convert into an Int64",
stringedNumber);
return;
}
Console.WriteLine("{0}={1}", stringedNumber, integer);
}
static void Main()
{
string large ="999999999999999999";
string larger="9999999999999999999";
convAndShow(large);
convAndShow(larger);
}
}