[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Private/NumberFormat
From: |
Gopal.V <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Private/NumberFormat DecimalFormatter.cs, 1.1, 1.2 Formatter.cs, 1.7, 1.8 |
Date: |
Fri, 18 Jul 2003 14:22:50 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Private/NumberFormat
In directory subversions:/tmp/cvs-serv7033/runtime/System/Private/NumberFormat
Modified Files:
DecimalFormatter.cs Formatter.cs
Log Message:
Patch #1744 and some special formatting cases for Int64.MinValue
Index: DecimalFormatter.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Private/NumberFormat/DecimalFormatter.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** DecimalFormatter.cs 27 Nov 2002 14:37:27 -0000 1.1
--- DecimalFormatter.cs 18 Jul 2003 18:22:48 -0000 1.2
***************
*** 42,45 ****
--- 42,48 ----
string rawnumber;
StringBuilder buf;
+ bool willOverflow=false;
+ // willOverflow is set when negation overflows ie
+ // for Int64.MinValue
// Type validation
***************
*** 48,51 ****
--- 51,60 ----
isNegative = true;
value = (ulong) -OToLong(o);
+ if(value==0)
+ {
+ // We somehow overflowed the data
+ // this is definitely Int64.MinValue
+ willOverflow=true;
+ }
}
else if (IsSignedInt(o) || IsUnsignedInt(o))
***************
*** 60,65 ****
}
! // Type conversion
! rawnumber=(FormatInteger(value));
buf = new StringBuilder(rawnumber.Substring(0,
rawnumber.Length-1));
--- 69,82 ----
}
! if(!willOverflow)
! {
! // Type conversion
! rawnumber=(FormatInteger(value));
! }
! else
! {
! rawnumber="9223372036854775808.";
! }
!
buf = new StringBuilder(rawnumber.Substring(0,
rawnumber.Length-1));
Index: Formatter.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/Private/NumberFormat/Formatter.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** Formatter.cs 7 May 2003 06:15:23 -0000 1.7
--- Formatter.cs 18 Jul 2003 18:22:48 -0000 1.8
***************
*** 302,306 ****
if (IsSignedInt(o) && (OToLong(o) < 0) )
{
! ret = "-" + Formatter.FormatInteger((ulong)
-OToLong(o));
}
else if (IsSignedInt(o) || IsUnsignedInt(o))
--- 302,314 ----
if (IsSignedInt(o) && (OToLong(o) < 0) )
{
! if(o==Int64.MinValue)
! {
! // because -(Int64.MinValue) does not exist
! ret = "-9223372036854775808.";
! }
! else
! {
! ret = "-" + Formatter.FormatInteger((ulong)
-OToLong(o));
! }
}
else if (IsSignedInt(o) || IsUnsignedInt(o))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Private/NumberFormat DecimalFormatter.cs, 1.1, 1.2 Formatter.cs, 1.7, 1.8,
Gopal.V <address@hidden> <=