[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Char.cs,1.6,1.7 Conso
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Char.cs,1.6,1.7 Console.cs,1.9,1.10 Convert.cs,1.11,1.12 DateTime.cs,1.19,1.20 Decimal.cs,1.11,1.12 Double.cs,1.11,1.12 Math.cs,1.8,1.9 NotFiniteNumberException.cs,1.6,1.7 Random.cs,1.4,1.5 Single.cs,1.9,1.10 TimeSpan.cs,1.7,1.8 |
Date: |
Tue, 15 Apr 2003 03:27:56 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System
In directory subversions:/tmp/cvs-serv27699/runtime/System
Modified Files:
Char.cs Console.cs Convert.cs DateTime.cs Decimal.cs Double.cs
Math.cs NotFiniteNumberException.cs Random.cs Single.cs
TimeSpan.cs
Log Message:
Mark up members of the "ExtendedNumerics" subset of ECMA with
CONFIG_EXTENDED_NUMERICS.
Index: Char.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Char.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** Char.cs 26 Nov 2002 04:00:35 -0000 1.6
--- Char.cs 15 Apr 2003 07:27:54 -0000 1.7
***************
*** 183,186 ****
--- 183,187 ----
#endif // !ECMA_COMPAT
+ #if CONFIG_EXTENDED_NUMERICS
// Get the numeric value associated with a character.
public static double GetNumericValue(char c)
***************
*** 203,206 ****
--- 204,208 ----
return GetNumericValue(s[index]);
}
+ #endif // CONFIG_EXTENDED_NUMERICS
// Get the Unicode category for a character.
Index: Console.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Console.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** Console.cs 15 Apr 2003 04:37:44 -0000 1.9
--- Console.cs 15 Apr 2003 07:27:54 -0000 1.10
***************
*** 224,227 ****
--- 224,228 ----
Out.Write(value, index, count);
}
+ #if CONFIG_EXTENDED_NUMERICS
public static void Write(double value)
{
***************
*** 236,239 ****
--- 237,241 ----
Out.Write(value);
}
+ #endif
public static void Write(int value)
{
***************
*** 305,308 ****
--- 307,311 ----
Out.WriteLine(value, index, count);
}
+ #if CONFIG_EXTENDED_NUMERICS
public static void WriteLine(double value)
{
***************
*** 317,320 ****
--- 320,324 ----
Out.WriteLine(value);
}
+ #endif
public static void WriteLine(int value)
{
Index: Convert.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Convert.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** Convert.cs 15 Apr 2003 04:37:44 -0000 1.11
--- Convert.cs 15 Apr 2003 07:27:54 -0000 1.12
***************
*** 55,68 ****
[CLSCompliant(false)]
public static bool ToBoolean(ulong value) { return (value != 0); }
public static bool ToBoolean(float value) { return (value != 0.0); }
public static bool ToBoolean(double value) { return (value != 0.0); }
- public static bool ToBoolean(String value)
- {
- return Boolean.Parse(value);
- }
public static bool ToBoolean(Decimal value)
{
return (value != 0.0m);
}
#if !ECMA_COMPAT
public static bool ToBoolean(char value)
--- 55,70 ----
[CLSCompliant(false)]
public static bool ToBoolean(ulong value) { return (value != 0); }
+ #if CONFIG_EXTENDED_NUMERICS
public static bool ToBoolean(float value) { return (value != 0.0); }
public static bool ToBoolean(double value) { return (value != 0.0); }
public static bool ToBoolean(Decimal value)
{
return (value != 0.0m);
}
+ #endif
+ public static bool ToBoolean(String value)
+ {
+ return Boolean.Parse(value);
+ }
#if !ECMA_COMPAT
public static bool ToBoolean(char value)
***************
*** 144,147 ****
--- 146,150 ----
return ToBoolean((ulong)value);
}
+ #if CONFIG_EXTENDED_NUMERICS
else if(type == typeof(float))
{
***************
*** 156,159 ****
--- 159,163 ----
return ToBoolean((Decimal)value);
}
+ #endif
else if(type == typeof(String))
{
***************
*** 269,272 ****
--- 273,277 ----
}
}
+ #if CONFIG_EXTENDED_NUMERICS
public static byte ToByte(float value)
{
***************
*** 281,284 ****
--- 286,290 ----
return Decimal.ToByte(Decimal.Round(value, 0));
}
+ #endif
public static byte ToByte(String value)
{
***************
*** 369,372 ****
--- 375,379 ----
return ToByte((ulong)value);
}
+ #if CONFIG_EXTENDED_NUMERICS
else if(type == typeof(float))
{
***************
*** 381,384 ****
--- 388,392 ----
return ToByte((Decimal)value);
}
+ #endif
else if(type == typeof(String))
{
***************
*** 500,503 ****
--- 508,512 ----
}
}
+ #if CONFIG_EXTENDED_NUMERICS
[CLSCompliant(false)]
public static sbyte ToSByte(float value)
***************
*** 515,518 ****
--- 524,528 ----
return Decimal.ToSByte(Decimal.Round(value, 0));
}
+ #endif
[CLSCompliant(false)]
public static sbyte ToSByte(String value)
***************
*** 608,611 ****
--- 618,622 ----
return ToSByte((ulong)value);
}
+ #if CONFIG_EXTENDED_NUMERICS
else if(type == typeof(float))
{
***************
*** 620,623 ****
--- 631,635 ----
return ToSByte((Decimal)value);
}
+ #endif
else if(type == typeof(String))
{
***************
*** 719,722 ****
--- 731,735 ----
}
}
+ #if CONFIG_EXTENDED_NUMERICS
public static short ToInt16(float value)
{
***************
*** 731,734 ****
--- 744,748 ----
return Decimal.ToInt16(Decimal.Round(value, 0));
}
+ #endif
public static short ToInt16(String value)
{
***************
*** 819,822 ****
--- 833,837 ----
return ToInt16((ulong)value);
}
+ #if CONFIG_EXTENDED_NUMERICS
else if(type == typeof(float))
{
***************
*** 831,834 ****
--- 846,850 ----
return ToInt16((Decimal)value);
}
+ #endif
else if(type == typeof(String))
{
***************
*** 939,942 ****
--- 955,959 ----
return unchecked((ushort)value);
}
+ #if CONFIG_EXTENDED_NUMERICS
[CLSCompliant(false)]
public static ushort ToUInt16(float value)
***************
*** 954,957 ****
--- 971,975 ----
return Decimal.ToUInt16(Decimal.Round(value,
0));
}
+ #endif
[CLSCompliant(false)]
public static ushort ToUInt16(String value)
***************
*** 1047,1050 ****
--- 1065,1069 ----
return ToUInt16((ulong)value);
}
+ #if CONFIG_EXTENDED_NUMERICS
else if(type == typeof(float))
{
***************
*** 1059,1062 ****
--- 1078,1082 ----
return ToUInt16((Decimal)value);
}
+ #endif
else if(type == typeof(String))
{
***************
*** 1137,1140 ****
--- 1157,1161 ----
return unchecked((int)value);
}
+ #if CONFIG_EXTENDED_NUMERICS
public static int ToInt32(float value)
{
***************
*** 1160,1163 ****
--- 1181,1185 ----
return Decimal.ToInt32(Decimal.Round(value, 0));
}
+ #endif
public static int ToInt32(String value)
{
***************
*** 1247,1250 ****
--- 1269,1273 ----
return ToInt32((ulong)value);
}
+ #if CONFIG_EXTENDED_NUMERICS
else if(type == typeof(float))
{
***************
*** 1259,1262 ****
--- 1282,1286 ----
return ToInt32((Decimal)value);
}
+ #endif
else if(type == typeof(String))
{
***************
*** 1357,1360 ****
--- 1381,1385 ----
return unchecked((uint)value);
}
+ #if CONFIG_EXTENDED_NUMERICS
[CLSCompliant(false)]
public static uint ToUInt32(float value)
***************
*** 1383,1386 ****
--- 1408,1412 ----
return Decimal.ToUInt32(Decimal.Round(value,
0));
}
+ #endif
[CLSCompliant(false)]
public static uint ToUInt32(String value)
***************
*** 1475,1478 ****
--- 1501,1505 ----
return ToUInt32((ulong)value);
}
+ #if CONFIG_EXTENDED_NUMERICS
else if(type == typeof(float))
{
***************
*** 1487,1490 ****
--- 1514,1518 ----
return ToUInt32((Decimal)value);
}
+ #endif
else if(type == typeof(String))
{
***************
*** 1551,1554 ****
--- 1579,1583 ----
return unchecked((long)value);
}
+ #if CONFIG_EXTENDED_NUMERICS
public static long ToInt64(float value)
{
***************
*** 1574,1577 ****
--- 1603,1607 ----
return Decimal.ToInt64(Decimal.Round(value, 0));
}
+ #endif
public static long ToInt64(String value)
{
***************
*** 1661,1664 ****
--- 1691,1695 ----
return ToInt64((ulong)value);
}
+ #if CONFIG_EXTENDED_NUMERICS
else if(type == typeof(float))
{
***************
*** 1673,1676 ****
--- 1704,1708 ----
return ToInt64((Decimal)value);
}
+ #endif
else if(type == typeof(String))
{
***************
*** 1764,1767 ****
--- 1796,1800 ----
return unchecked((ulong)value);
}
+ #if CONFIG_EXTENDED_NUMERICS
[CLSCompliant(false)]
public static ulong ToUInt64(float value)
***************
*** 1790,1793 ****
--- 1823,1827 ----
return Decimal.ToUInt64(Decimal.Round(value,
0));
}
+ #endif
[CLSCompliant(false)]
public static ulong ToUInt64(String value)
***************
*** 1882,1885 ****
--- 1916,1920 ----
return (ulong)value;
}
+ #if CONFIG_EXTENDED_NUMERICS
else if(type == typeof(float))
{
***************
*** 1894,1897 ****
--- 1929,1933 ----
return ToUInt64((Decimal)value);
}
+ #endif
else if(type == typeof(String))
{
***************
*** 2011,2014 ****
--- 2047,2051 ----
}
#if !ECMA_COMPAT
+ #if CONFIG_EXTENDED_NUMERICS
public static char ToChar(float value)
{
***************
*** 2023,2026 ****
--- 2060,2064 ----
return ((IConvertible)value).ToChar(null);
}
+ #endif
public static char ToChar(Object value)
{
***************
*** 2093,2096 ****
--- 2131,2135 ----
return ToChar((ulong)value);
}
+ #if CONFIG_EXTENDED_NUMERICS
else if(type == typeof(float))
{
***************
*** 2105,2108 ****
--- 2144,2148 ----
return ToChar((Decimal)value);
}
+ #endif
else if(type == typeof(String))
{
***************
*** 2123,2126 ****
--- 2163,2168 ----
#endif // ECMA_COMPAT
+ #if CONFIG_EXTENDED_NUMERICS
+
// Convert various types into Single.
public static float ToSingle(bool value) { return (value ? 1.0f :
0.0f); }
***************
*** 2435,2438 ****
--- 2477,2482 ----
#endif // ECMA_COMPAT
+ #endif // CONFIG_EXTENDED_NUMERICS
+
// Convert various types into String.
public static String ToString(bool value)
***************
*** 2516,2519 ****
--- 2560,2564 ----
return value.ToString();
}
+ #if CONFIG_EXTENDED_NUMERICS
public static String ToString(float value)
{
***************
*** 2540,2543 ****
--- 2585,2589 ----
return value.ToString(provider);
}
+ #endif
public static String ToString(DateTime value)
{
***************
*** 2762,2765 ****
--- 2808,2813 ----
#endif // !ECMA_COMPAT
+ #if CONFIG_EXTENDED_NUMERICS
+
// Convert various types into Decimal.
public static Decimal ToDecimal(bool value)
***************
*** 2910,2913 ****
--- 2958,2963 ----
#endif // !ECMA_COMPAT
+ #endif // CONFIG_EXTENDED_NUMERICS
+
#if !ECMA_COMPAT
***************
*** 3644,3648 ****
--- 3694,3702 ----
// Perform primitive type conversions the hard
way
// because we don't have support for
IConvertible.
+ #if CONFIG_EXTENDED_NUMERICS
if(objType != typeof(String) && objType !=
typeof(Decimal))
+ #else
+ if(objType != typeof(String))
+ #endif
{
try
***************
*** 3684,3687 ****
--- 3738,3742 ----
return ToUInt64(obj);
}
+ #if CONFIG_EXTENDED_NUMERICS
else if(toType == typeof(float))
{
***************
*** 3696,3699 ****
--- 3751,3755 ----
return ToDecimal(obj);
}
+ #endif
}
catch(OverflowException)
***************
*** 3725,3731 ****
to == typeof(uint) ||
to == typeof(long) ||
! to == typeof(ulong) ||
to == typeof(float) ||
to == typeof(double));
}
else if(from == typeof(byte))
--- 3781,3792 ----
to == typeof(uint) ||
to == typeof(long) ||
! to == typeof(ulong)
! #if CONFIG_EXTENDED_NUMERICS
! ||
to == typeof(float) ||
to == typeof(double));
+ #else
+ );
+ #endif
}
else if(from == typeof(byte))
***************
*** 3738,3744 ****
to == typeof(uint) ||
to == typeof(long) ||
! to == typeof(ulong) ||
to == typeof(float) ||
to == typeof(double));
}
else if(from == typeof(sbyte))
--- 3799,3810 ----
to == typeof(uint) ||
to == typeof(long) ||
! to == typeof(ulong)
! #if CONFIG_EXTENDED_NUMERICS
! ||
to == typeof(float) ||
to == typeof(double));
+ #else
+ );
+ #endif
}
else if(from == typeof(sbyte))
***************
*** 3747,3753 ****
to == typeof(short) ||
to == typeof(int) ||
! to == typeof(long) ||
to == typeof(float) ||
to == typeof(double));
}
else if(from == typeof(short))
--- 3813,3824 ----
to == typeof(short) ||
to == typeof(int) ||
! to == typeof(long)
! #if CONFIG_EXTENDED_NUMERICS
! ||
to == typeof(float) ||
to == typeof(double));
+ #else
+ );
+ #endif
}
else if(from == typeof(short))
***************
*** 3755,3761 ****
return (to == typeof(short) ||
to == typeof(int) ||
! to == typeof(long) ||
to == typeof(float) ||
to == typeof(double));
}
else if(from == typeof(ushort) || from ==
typeof(char))
--- 3826,3837 ----
return (to == typeof(short) ||
to == typeof(int) ||
! to == typeof(long)
! #if CONFIG_EXTENDED_NUMERICS
! ||
to == typeof(float) ||
to == typeof(double));
+ #else
+ );
+ #endif
}
else if(from == typeof(ushort) || from ==
typeof(char))
***************
*** 3766,3799 ****
to == typeof(uint) ||
to == typeof(long) ||
! to == typeof(ulong) ||
to == typeof(float) ||
to == typeof(double));
}
else if(from == typeof(int))
{
return (to == typeof(int) ||
! to == typeof(long) ||
to == typeof(float) ||
to == typeof(double));
}
else if(from == typeof(uint))
{
return (to == typeof(uint) ||
! to == typeof(ulong) ||
to == typeof(float) ||
to == typeof(double));
}
else if(from == typeof(long))
{
! return (to == typeof(long) ||
to == typeof(float) ||
to == typeof(double));
}
else if(from == typeof(ulong))
{
! return (to == typeof(ulong) ||
to == typeof(float) ||
to == typeof(double));
}
else if(from == typeof(float))
{
--- 3842,3901 ----
to == typeof(uint) ||
to == typeof(long) ||
! to == typeof(ulong)
! #if CONFIG_EXTENDED_NUMERICS
! ||
to == typeof(float) ||
to == typeof(double));
+ #else
+ );
+ #endif
}
else if(from == typeof(int))
{
return (to == typeof(int) ||
! to == typeof(long)
! #if CONFIG_EXTENDED_NUMERICS
! ||
to == typeof(float) ||
to == typeof(double));
+ #else
+ );
+ #endif
}
else if(from == typeof(uint))
{
return (to == typeof(uint) ||
! to == typeof(ulong)
! #if CONFIG_EXTENDED_NUMERICS
! ||
to == typeof(float) ||
to == typeof(double));
+ #else
+ );
+ #endif
}
else if(from == typeof(long))
{
! return (to == typeof(long)
! #if CONFIG_EXTENDED_NUMERICS
! ||
to == typeof(float) ||
to == typeof(double));
+ #else
+ );
+ #endif
}
else if(from == typeof(ulong))
{
! return (to == typeof(ulong)
! #if CONFIG_EXTENDED_NUMERICS
! ||
to == typeof(float) ||
to == typeof(double));
+ #else
+ );
+ #endif
}
+ #if CONFIG_EXTENDED_NUMERICS
else if(from == typeof(float))
{
***************
*** 3805,3808 ****
--- 3907,3911 ----
return (to == typeof(double));
}
+ #endif
return false;
}
Index: DateTime.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/DateTime.cs,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** DateTime.cs 11 Feb 2003 15:23:55 -0000 1.19
--- DateTime.cs 15 Apr 2003 07:27:54 -0000 1.20
***************
*** 801,804 ****
--- 801,805 ----
{ return new TimeSpan(value_ - d.value_); }
+ #if CONFIG_EXTENDED_NUMERICS
// Internal version of the "Add*" methods.
private DateTime DoAdd(double value, long multiplier)
***************
*** 837,840 ****
--- 838,846 ----
return DoAdd(value, TimeSpan.TicksPerMinute);
}
+ public DateTime AddSeconds(double value)
+ {
+ return DoAdd(value, TimeSpan.TicksPerSecond);
+ }
+ #endif // CONFIG_EXTENDED_NUMERICS
public DateTime AddMonths(int months)
{
***************
*** 873,880 ****
return new DateTime(year, month, day,
hour,
minute, second, fractions);
- }
- public DateTime AddSeconds(double value)
- {
- return DoAdd(value, TimeSpan.TicksPerSecond);
}
public DateTime AddTicks(long value)
--- 879,882 ----
Index: Decimal.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Decimal.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** Decimal.cs 15 Apr 2003 04:37:44 -0000 1.11
--- Decimal.cs 15 Apr 2003 07:27:54 -0000 1.12
***************
*** 22,25 ****
--- 22,27 ----
{
+ #if CONFIG_EXTENDED_NUMERICS
+
using System.Private;
using System.Private.NumberFormat;
***************
*** 706,709 ****
--- 708,713 ----
}; // class Decimal
+
+ #endif // CONFIG_EXTENDED_NUMERICS
}; // namespace System
Index: Double.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Double.cs,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** Double.cs 16 Jan 2003 15:33:59 -0000 1.11
--- Double.cs 15 Apr 2003 07:27:54 -0000 1.12
***************
*** 22,25 ****
--- 22,27 ----
{
+ #if CONFIG_EXTENDED_NUMERICS
+
using System.Private;
using System.Private.NumberFormat;
***************
*** 277,280 ****
--- 279,284 ----
}; // class Double
+
+ #endif // CONFIG_EXTENDED_NUMERICS
}; // namespace System
Index: Math.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Math.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** Math.cs 15 Apr 2003 04:37:44 -0000 1.8
--- Math.cs 15 Apr 2003 07:27:54 -0000 1.9
***************
*** 22,25 ****
--- 22,27 ----
{
+ #if CONFIG_EXTENDED_NUMERICS
+
using System.Runtime.CompilerServices;
***************
*** 438,441 ****
--- 440,445 ----
}; // class Math
+
+ #endif // CONFIG_EXTENDED_NUMERICS
}; // namespace System
Index: NotFiniteNumberException.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/runtime/System/NotFiniteNumberException.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** NotFiniteNumberException.cs 7 Apr 2003 04:22:51 -0000 1.6
--- NotFiniteNumberException.cs 15 Apr 2003 07:27:54 -0000 1.7
***************
*** 23,26 ****
--- 23,28 ----
{
+ #if CONFIG_EXTENDED_NUMERICS
+
using System.Runtime.Serialization;
***************
*** 91,94 ****
--- 93,98 ----
}; // class NotFiniteNumberException
+
+ #endif // CONFIG_EXTENDED_NUMERICS
}; // namespace System
Index: Random.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Random.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** Random.cs 15 Apr 2003 04:37:44 -0000 1.4
--- Random.cs 15 Apr 2003 07:27:54 -0000 1.5
***************
*** 22,25 ****
--- 22,27 ----
{
+ #if CONFIG_EXTENDED_NUMERICS
+
public class Random
{
***************
*** 113,116 ****
--- 115,206 ----
}; // class Random
+
+ #else // !CONFIG_EXTENDED_NUMERICS
+
+ // Use an integer-only implementation if we don't have floating-point.
+
+ public class Random
+ {
+ // Current seed value for this instance.
+ private int seed;
+
+ // Constructors.
+ public Random() : this(Environment.TickCount) {}
+ public Random(int seed)
+ {
+ // Make sure that the seed value is positive.
+ this.seed = unchecked(seed & 0x7FFFFFFF);
+ }
+
+ // Compute the next random number sample value. This algorithm
+ // is based on "rand()" from the FreeBSD sources.
+ private int Sample()
+ {
+ seed = unchecked((int)((((uint)seed) *
1103515245 + 12345) &
+
(uint)0x7FFFFFFF));
+ return seed;
+ }
+
+ // Get the next value in the random sequence.
+ public virtual int Next()
+ {
+ return Sample();
+ }
+ public virtual int Next(int maxValue)
+ {
+ if(maxValue < 0)
+ {
+ throw new ArgumentOutOfRangeException
+ ("maxValue",
_("ArgRange_NonNegative"));
+ }
+ else if(maxValue != 0)
+ {
+ return (int)(((long)(Sample()) *
(long)maxValue) >> 31);
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ public virtual int Next(int minValue, int maxValue)
+ {
+ uint range;
+ if(minValue > maxValue)
+ {
+ throw new ArgumentOutOfRangeException
+ ("minValue",
_("ArgRange_MinValueGtMaxValue"));
+ }
+ else if(minValue != maxValue)
+ {
+ // Use an unsigned integer for the
range just in
+ // case it is greater than 31 bits in
size.
+ range = unchecked((uint)(maxValue -
minValue));
+ return
(int)(((((ulong)(long)(Sample())) *
+
(ulong)range)) >> 31) + minValue;
+ }
+ else
+ {
+ return minValue;
+ }
+ }
+
+ // Fill an array with random bytes.
+ public virtual void NextBytes(byte[] buffer)
+ {
+ if(buffer == null)
+ {
+ throw new
ArgumentNullException("buffer");
+ }
+ int len = buffer.Length;
+ int posn;
+ for(posn = 0; posn < len; ++posn)
+ {
+ buffer[posn] =
unchecked((byte)(Sample() >> (31 - 8)));
+ }
+ }
+
+ }; // class Random
+
+ #endif // !CONFIG_EXTENDED_NUMERICS
}; // namespace System
Index: Single.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Single.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** Single.cs 27 Nov 2002 14:37:27 -0000 1.9
--- Single.cs 15 Apr 2003 07:27:54 -0000 1.10
***************
*** 22,25 ****
--- 22,27 ----
{
+ #if CONFIG_EXTENDED_NUMERICS
+
using System.Private;
using System.Private.NumberFormat;
***************
*** 277,280 ****
--- 279,284 ----
}; // class Single
+
+ #endif // CONFIG_EXTENDED_NUMERICS
}; // namespace System
Index: TimeSpan.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/TimeSpan.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** TimeSpan.cs 26 Nov 2002 04:00:36 -0000 1.7
--- TimeSpan.cs 15 Apr 2003 07:27:54 -0000 1.8
***************
*** 50,62 ****
int milliseconds)
{
- Decimal result;
try
{
! result = ((Decimal)days) *
((Decimal)TicksPerDay) +
! ((Decimal)hours) *
((Decimal)TicksPerHour) +
! ((Decimal)minutes) *
((Decimal)TicksPerMinute) +
! ((Decimal)seconds) *
((Decimal)TicksPerSecond) +
!
((Decimal)milliseconds) * 10000.0m;
! value_ = Decimal.ToInt64(result);
}
catch(OverflowException)
--- 50,63 ----
int milliseconds)
{
try
{
! checked
! {
! value_ = ((long)days) *
TicksPerDay +
! ((long)hours)
* TicksPerHour +
!
((long)minutes) * TicksPerMinute +
!
((long)seconds) * TicksPerSecond +
!
((long)milliseconds) * TicksPerMillisecond;
! }
}
catch(OverflowException)
***************
*** 169,173 ****
public TimeSpan Duration()
{
! return new TimeSpan(Math.Abs(value_));
}
--- 170,181 ----
public TimeSpan Duration()
{
! if(value_ < 0)
! {
! return new TimeSpan(-value_);
! }
! else
! {
! return this;
! }
}
***************
*** 191,194 ****
--- 199,203 ----
}
+ #if CONFIG_EXTENDED_NUMERICS
// Convert a floating point number of days into a TimeSpan.
public static TimeSpan FromDays(double value)
***************
*** 298,301 ****
--- 307,311 ----
}
}
+ #endif // CONFIG_EXTENDED_NUMERICS
// Convert a number of ticks into a TimeSpan.
***************
*** 329,334 ****
{
long numberofticks = 0;
! int days = 0, hours, minutes, seconds,
fractions;
! double fractionsinseconds;
int fractionslength = 0;
String fractionss = String.Empty;
--- 339,344 ----
{
long numberofticks = 0;
! int days = 0, hours, minutes, seconds;
! long fractions;
int fractionslength = 0;
String fractionss = String.Empty;
***************
*** 388,393 ****
//Calculate the fractions expressed in a second
! fractions = Int32.Parse(fractionss);
! fractionsinseconds = fractions /
(Math.Pow(10,fractionslength));
//Calculate the numberofticks
--- 398,414 ----
//Calculate the fractions expressed in a second
! if(fractionss != String.Empty)
! {
! fractions = Int32.Parse(fractionss) *
TicksPerSecond;
! while(fractionslength > 0)
! {
! fractions /= 10;
! --fractionslength;
! }
! }
! else
! {
! fractions = 0;
! }
//Calculate the numberofticks
***************
*** 396,400 ****
numberofticks += (minutes * TicksPerMinute);
numberofticks += (seconds * TicksPerSecond);
! numberofticks += (fractions * TicksPerSecond);
//Apply the minus specifier
--- 417,421 ----
numberofticks += (minutes * TicksPerMinute);
numberofticks += (seconds * TicksPerSecond);
! numberofticks += fractions;
//Apply the minus specifier
***************
*** 506,509 ****
--- 527,531 ----
}
}
+ #if CONFIG_EXTENDED_NUMERICS
public double TotalDays
{
***************
*** 553,556 ****
--- 575,579 ----
}
}
+ #endif // CONFIG_EXTENDED_NUMERICS
}; // class TimeSpan
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System Char.cs,1.6,1.7 Console.cs,1.9,1.10 Convert.cs,1.11,1.12 DateTime.cs,1.19,1.20 Decimal.cs,1.11,1.12 Double.cs,1.11,1.12 Math.cs,1.8,1.9 NotFiniteNumberException.cs,1.6,1.7 Random.cs,1.4,1.5 Single.cs,1.9,1.10 TimeSpan.cs,1.7,1.8,
Rhys Weatherley <address@hidden> <=