using System;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Text;
namespace System
{
/// Represents a decimal number.
/// 1
// Token: 0x02000021 RID: 33
[ComVisible(true)]
[Serializable]
public struct Decimal : IFormattable, IConvertible, IComparable, IComparable, IEquatable
{
/// Initializes a new instance of from parameters specifying the instance's constituent parts.
/// The low 32 bits of a 96-bit integer.
/// The middle 32 bits of a 96-bit integer.
/// The high 32 bits of a 96-bit integer.
/// The sign of the number; 1 is negative, 0 is positive.
/// A power of 10 ranging from 0 to 28.
///
/// is greater than 28.
// Token: 0x060002C6 RID: 710 RVA: 0x0000BCA0 File Offset: 0x00009EA0
public Decimal(int lo, int mid, int hi, bool isNegative, byte scale)
{
this.lo = (uint)lo;
this.mid = (uint)mid;
this.hi = (uint)hi;
if (scale > 28)
{
throw new ArgumentOutOfRangeException(Locale.GetText("scale must be between 0 and 28"));
}
this.flags = (uint)scale;
this.flags <<= 16;
if (isNegative)
{
this.flags |= 2147483648U;
}
}
/// Initializes a new instance of to the value of the specified 32-bit signed integer.
/// The value to represent as a .
// Token: 0x060002C7 RID: 711 RVA: 0x0000BD0C File Offset: 0x00009F0C
public Decimal(int value)
{
this.hi = (this.mid = 0U);
if (value < 0)
{
this.flags = 2147483648U;
this.lo = (uint)(~value + 1);
}
else
{
this.flags = 0U;
this.lo = (uint)value;
}
}
/// Initializes a new instance of to the value of the specified 32-bit unsigned integer.
/// The value to represent as a .
// Token: 0x060002C8 RID: 712 RVA: 0x0000BD58 File Offset: 0x00009F58
[CLSCompliant(false)]
public Decimal(uint value)
{
this.lo = value;
this.flags = (this.hi = (this.mid = 0U));
}
/// Initializes a new instance of to the value of the specified 64-bit signed integer.
/// The value to represent as a .
// Token: 0x060002C9 RID: 713 RVA: 0x0000BD88 File Offset: 0x00009F88
public Decimal(long value)
{
this.hi = 0U;
if (value < 0L)
{
this.flags = 2147483648U;
ulong num = (ulong)(~value + 1L);
this.lo = (uint)num;
this.mid = (uint)(num >> 32);
}
else
{
this.flags = 0U;
this.lo = (uint)value;
this.mid = (uint)((ulong)value >> 32);
}
}
/// Initializes a new instance of to the value of the specified 64-bit unsigned integer.
/// The value to represent as a .
// Token: 0x060002CA RID: 714 RVA: 0x0000BDEC File Offset: 0x00009FEC
[CLSCompliant(false)]
public Decimal(ulong value)
{
this.flags = (this.hi = 0U);
this.lo = (uint)value;
this.mid = (uint)(value >> 32);
}
/// Initializes a new instance of to the value of the specified single-precision floating-point number.
/// The value to represent as a .
///
/// is greater than or less than .-or- is , , or .
// Token: 0x060002CB RID: 715 RVA: 0x0000BE1C File Offset: 0x0000A01C
public Decimal(float value)
{
if (value > 7.9228163E+28f || value < -7.9228163E+28f || float.IsNaN(value) || float.IsNegativeInfinity(value) || float.IsPositiveInfinity(value))
{
throw new OverflowException(Locale.GetText("Value {0} is greater than Decimal.MaxValue or less than Decimal.MinValue", new object[] { value }));
}
decimal num = decimal.Parse(value.ToString(CultureInfo.InvariantCulture), NumberStyles.Float, CultureInfo.InvariantCulture);
this.flags = num.flags;
this.hi = num.hi;
this.lo = num.lo;
this.mid = num.mid;
}
/// Initializes a new instance of to the value of the specified double-precision floating-point number.
/// The value to represent as a .
///
/// is greater than or less than .-or- is , , or .
// Token: 0x060002CC RID: 716 RVA: 0x0000BED0 File Offset: 0x0000A0D0
public Decimal(double value)
{
if (value > 7.922816251426434E+28 || value < -7.922816251426434E+28 || double.IsNaN(value) || double.IsNegativeInfinity(value) || double.IsPositiveInfinity(value))
{
throw new OverflowException(Locale.GetText("Value {0} is greater than Decimal.MaxValue or less than Decimal.MinValue", new object[] { value }));
}
decimal num = decimal.Parse(value.ToString(CultureInfo.InvariantCulture), NumberStyles.Float, CultureInfo.InvariantCulture);
this.flags = num.flags;
this.hi = num.hi;
this.lo = num.lo;
this.mid = num.mid;
}
/// Initializes a new instance of to a decimal value represented in binary and contained in a specified array.
/// An array of 32-bit signed integers containing a representation of a decimal value.
///
/// is null.
/// The length of the is not 4.-or- The representation of the decimal value in is not valid.
// Token: 0x060002CD RID: 717 RVA: 0x0000BF8C File Offset: 0x0000A18C
public Decimal(int[] bits)
{
if (bits == null)
{
throw new ArgumentNullException(Locale.GetText("Bits is a null reference"));
}
if (bits.GetLength(0) != 4)
{
throw new ArgumentException(Locale.GetText("bits does not contain four values"));
}
this.lo = (uint)bits[0];
this.mid = (uint)bits[1];
this.hi = (uint)bits[2];
this.flags = (uint)bits[3];
byte b = (byte)(this.flags >> 16);
if (b > 28 || (this.flags & 2130771967U) != 0U)
{
throw new ArgumentException(Locale.GetText("Invalid bits[3]"));
}
}
/// For a description of this member, see .
/// The value of the current instance, converted to a .
/// The type to which to convert the value of this instance.
/// An implementation that supplies culture-specific information about the format of the returned value.
///
/// is null.
/// The requested type conversion is not supported.
// Token: 0x060002CF RID: 719 RVA: 0x0000C074 File Offset: 0x0000A274
object IConvertible.ToType(Type targetType, IFormatProvider provider)
{
if (targetType == null)
{
throw new ArgumentNullException("targetType");
}
return Convert.ToType(this, targetType, provider, false);
}
/// For a description of this member, see .
/// true if the value of the current instance is not zero; otherwise, false.
/// This parameter is ignored.
// Token: 0x060002D0 RID: 720 RVA: 0x0000C0A8 File Offset: 0x0000A2A8
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return Convert.ToBoolean(this);
}
/// For a description of this member, see .
/// The value of the current instance, converted to a .
/// This parameter is ignored.
/// The resulting integer value is less than or greater than .
// Token: 0x060002D1 RID: 721 RVA: 0x0000C0B8 File Offset: 0x0000A2B8
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(this);
}
/// This conversion is not supported. Attempting to use this method throws an .
/// This conversion is not supported. No value is returned.
/// This parameter is ignored.
/// In all cases.
// Token: 0x060002D2 RID: 722 RVA: 0x0000C0C8 File Offset: 0x0000A2C8
char IConvertible.ToChar(IFormatProvider provider)
{
throw new InvalidCastException();
}
/// This conversion is not supported. Attempting to use this method throws an .
/// This conversion is not supported. No value is returned.
/// This parameter is ignored.
/// In all cases.
// Token: 0x060002D3 RID: 723 RVA: 0x0000C0D0 File Offset: 0x0000A2D0
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
throw new InvalidCastException();
}
/// For a description of this member, see .
/// The value of the current instance, unchanged.
/// This parameter is ignored.
// Token: 0x060002D4 RID: 724 RVA: 0x0000C0D8 File Offset: 0x0000A2D8
decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return this;
}
/// For a description of this member, see .
/// The value of the current instance, converted to a .
/// This parameter is ignored.
// Token: 0x060002D5 RID: 725 RVA: 0x0000C0E0 File Offset: 0x0000A2E0
double IConvertible.ToDouble(IFormatProvider provider)
{
return Convert.ToDouble(this);
}
/// For a description of this member, see .
/// The value of the current instance, converted to a .
/// This parameter is ignored.
/// The resulting integer value is less than or greater than .
// Token: 0x060002D6 RID: 726 RVA: 0x0000C0F0 File Offset: 0x0000A2F0
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(this);
}
/// For a description of this member, see .
/// The value of the current instance, converted to a .
/// The parameter is ignored.
/// The resulting integer value is less than or greater than .
// Token: 0x060002D7 RID: 727 RVA: 0x0000C100 File Offset: 0x0000A300
int IConvertible.ToInt32(IFormatProvider provider)
{
return Convert.ToInt32(this);
}
/// For a description of this member, see .
/// The value of the current instance, converted to a .
/// This parameter is ignored.
/// The resulting integer value is less than or greater than .
// Token: 0x060002D8 RID: 728 RVA: 0x0000C110 File Offset: 0x0000A310
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(this);
}
/// For a description of this member, see .
/// The value of the current instance, converted to a .
/// This parameter is ignored.
/// The resulting integer value is less than or greater than .
// Token: 0x060002D9 RID: 729 RVA: 0x0000C120 File Offset: 0x0000A320
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(this);
}
/// For a description of this member, see .
/// The value of the current instance, converted to a .
/// This parameter is ignored.
// Token: 0x060002DA RID: 730 RVA: 0x0000C130 File Offset: 0x0000A330
float IConvertible.ToSingle(IFormatProvider provider)
{
return Convert.ToSingle(this);
}
/// For a description of this member, see .
/// The value of the current instance, converted to a .
/// This parameter is ignored.
/// The resulting integer value is less than or greater than .
// Token: 0x060002DB RID: 731 RVA: 0x0000C140 File Offset: 0x0000A340
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(this);
}
/// For a description of this member, see .
/// The value of the current instance, converted to a .
/// This parameter is ignored.
/// The resulting integer value is less than or greater than .
// Token: 0x060002DC RID: 732 RVA: 0x0000C150 File Offset: 0x0000A350
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(this);
}
/// For a description of this member, see .
/// The value of the current instance, converted to a .
/// This parameter is ignored.
/// The resulting integer value is less than or greater than .
// Token: 0x060002DD RID: 733 RVA: 0x0000C160 File Offset: 0x0000A360
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(this);
}
/// Converts the specified 64-bit signed integer, which contains an OLE Automation Currency value, to the equivalent value.
/// A that contains the equivalent of .
/// An OLE Automation Currency value.
/// 1
// Token: 0x060002DE RID: 734 RVA: 0x0000C170 File Offset: 0x0000A370
public static decimal FromOACurrency(long cy)
{
return cy / 10000m;
}
/// Converts the value of a specified instance of to its equivalent binary representation.
/// A 32-bit signed integer array with four elements that contain the binary representation of .
/// A value.
/// 1
// Token: 0x060002DF RID: 735 RVA: 0x0000C188 File Offset: 0x0000A388
public static int[] GetBits(decimal d)
{
return new int[]
{
(int)d.lo,
(int)d.mid,
(int)d.hi,
(int)d.flags
};
}
/// Returns the result of multiplying the specified value by negative one.
/// A with the value of , but the opposite sign.-or- Zero, if is zero.
/// A .
/// 1
// Token: 0x060002E0 RID: 736 RVA: 0x0000C1C4 File Offset: 0x0000A3C4
public static decimal Negate(decimal d)
{
d.flags ^= 2147483648U;
return d;
}
/// Adds two specified values.
/// A value that is the sum of and .
/// A .
/// A .
/// The sum of and is less than or greater than .
/// 1
// Token: 0x060002E1 RID: 737 RVA: 0x0000C1DC File Offset: 0x0000A3DC
public static decimal Add(decimal d1, decimal d2)
{
if (decimal.decimalIncr(ref d1, ref d2) == 0)
{
return d1;
}
throw new OverflowException(Locale.GetText("Overflow on adding decimal number"));
}
/// Subtracts one specified value from another.
/// The result of subtracting from .
/// A (the minuend).
/// A (the subtrahend).
/// The return value is less than or greater than .
/// 1
// Token: 0x060002E2 RID: 738 RVA: 0x0000C200 File Offset: 0x0000A400
public static decimal Subtract(decimal d1, decimal d2)
{
d2.flags ^= 2147483648U;
int num = decimal.decimalIncr(ref d1, ref d2);
if (num == 0)
{
return d1;
}
throw new OverflowException(Locale.GetText("Overflow on subtracting decimal numbers (" + num + ")"));
}
/// Returns the hash code for this instance.
/// A 32-bit signed integer hash code.
/// 2
// Token: 0x060002E3 RID: 739 RVA: 0x0000C254 File Offset: 0x0000A454
public override int GetHashCode()
{
return (int)(this.flags ^ this.hi ^ this.lo ^ this.mid);
}
// Token: 0x060002E4 RID: 740 RVA: 0x0000C274 File Offset: 0x0000A474
private static ulong u64(decimal value)
{
decimal.decimalFloorAndTrunc(ref value, 0);
ulong num;
if (decimal.decimal2UInt64(ref value, out num) != 0)
{
throw new OverflowException();
}
return num;
}
// Token: 0x060002E5 RID: 741 RVA: 0x0000C2A0 File Offset: 0x0000A4A0
private static long s64(decimal value)
{
decimal.decimalFloorAndTrunc(ref value, 0);
long num;
if (decimal.decimal2Int64(ref value, out num) != 0)
{
throw new OverflowException();
}
return num;
}
/// Returns a value indicating whether two specified instances of represent the same value.
/// true if and are equal; otherwise, false.
/// A .
/// A .
/// 1
// Token: 0x060002E6 RID: 742 RVA: 0x0000C2CC File Offset: 0x0000A4CC
public static bool Equals(decimal d1, decimal d2)
{
return decimal.Compare(d1, d2) == 0;
}
/// Returns a value indicating whether this instance and a specified represent the same type and value.
/// true if is a and equal to this instance; otherwise, false.
/// An .
/// 2
// Token: 0x060002E7 RID: 743 RVA: 0x0000C2D8 File Offset: 0x0000A4D8
public override bool Equals(object value)
{
return value is decimal && decimal.Equals((decimal)value, this);
}
// Token: 0x060002E8 RID: 744 RVA: 0x0000C2F8 File Offset: 0x0000A4F8
private bool IsZero()
{
return this.hi == 0U && this.lo == 0U && this.mid == 0U;
}
// Token: 0x060002E9 RID: 745 RVA: 0x0000C328 File Offset: 0x0000A528
private bool IsNegative()
{
return (this.flags & 2147483648U) == 2147483648U;
}
/// Rounds a specified number to the closest integer toward negative infinity.
/// If has a fractional part, the next whole number toward negative infinity that is less than .-or- If doesn't have a fractional part, is returned unchanged.
/// A .
/// 1
// Token: 0x060002EA RID: 746 RVA: 0x0000C340 File Offset: 0x0000A540
public static decimal Floor(decimal d)
{
decimal.decimalFloorAndTrunc(ref d, 1);
return d;
}
/// Returns the integral digits of the specified ; any fractional digits are discarded.
/// The result of rounded toward zero, to the nearest whole number.
/// A to truncate.
/// 1
// Token: 0x060002EB RID: 747 RVA: 0x0000C34C File Offset: 0x0000A54C
public static decimal Truncate(decimal d)
{
decimal.decimalFloorAndTrunc(ref d, 0);
return d;
}
/// Rounds a value to a specified number of decimal places.
/// The number equivalent to rounded to number of decimal places.
/// A value to round.
/// A value from 0 to 28 that specifies the number of decimal places to round to.
///
/// is not a value from 0 to 28.
/// 1
// Token: 0x060002EC RID: 748 RVA: 0x0000C358 File Offset: 0x0000A558
public static decimal Round(decimal d, int decimals)
{
return decimal.Round(d, decimals, MidpointRounding.ToEven);
}
/// Rounds a decimal value to a specified precision. A parameter specifies how to round the value if it is midway between two other numbers.
/// The number that is nearest to the parameter with a precision equal to the parameter. If is halfway between two numbers, one of which is even and the other odd, the parameter determines which of the two numbers is returned. If the precision of is less than , is returned unchanged.
/// A decimal number to round.
/// The number of significant decimal places (precision) in the return value.
/// A value that specifies how to round if it is midway between two other numbers.
///
/// is less than 0 or greater than 28.
///
/// is not a value.
/// The result is outside the range of a object.
/// 1
// Token: 0x060002ED RID: 749 RVA: 0x0000C364 File Offset: 0x0000A564
public static decimal Round(decimal d, int decimals, MidpointRounding mode)
{
if (mode != MidpointRounding.ToEven && mode != MidpointRounding.AwayFromZero)
{
throw new ArgumentException("The value '" + mode + "' is not valid for this usage of the type MidpointRounding.", "mode");
}
if (decimals < 0 || decimals > 28)
{
throw new ArgumentOutOfRangeException("decimals", "[0,28]");
}
bool flag = d.IsNegative();
if (flag)
{
d.flags ^= 2147483648U;
}
decimal num = (decimal)Math.Pow(10.0, (double)decimals);
decimal num2 = decimal.Floor(d);
decimal num3 = d - num2;
num3 *= 10000000000000000000000000000m;
num3 = decimal.Floor(num3);
num3 /= 10000000000000000000000000000m / num;
num3 = Math.Round(num3, mode);
num3 /= num;
decimal num4 = num2 + num3;
long num5 = (long)decimals - (long)((ulong)((num4.flags & 2147418112U) >> 16));
if (num5 > 0L)
{
while (num5 > 0L)
{
if (num4 > decimal.MaxValueDiv10)
{
break;
}
num4 *= 10m;
num5 -= 1L;
}
}
else if (num5 < 0L)
{
while (num5 < 0L)
{
num4 /= 10m;
num5 += 1L;
}
}
num4.flags = (uint)((uint)((long)decimals - num5) << 16);
if (flag)
{
num4.flags ^= 2147483648U;
}
return num4;
}
/// Rounds a decimal value to the nearest integer.
/// The integer that is nearest to the parameter. If is halfway between two integers, one of which is even and the other odd, the even number is returned.
/// A decimal number to round.
/// The result is outside the range of a object.
/// 1
// Token: 0x060002EE RID: 750 RVA: 0x0000C51C File Offset: 0x0000A71C
public static decimal Round(decimal d)
{
return Math.Round(d);
}
/// Rounds a decimal value to the nearest integer. A parameter specifies how to round the value if it is midway between two other numbers.
/// The integer that is nearest to the parameter. If is halfway between two numbers, one of which is even and the other odd, the parameter determines which of the two numbers is returned.
/// A decimal number to round.
/// A value that specifies how to round if it is midway between two other numbers.
///
/// is not a value.
/// The result is outside the range of a object.
/// 1
// Token: 0x060002EF RID: 751 RVA: 0x0000C524 File Offset: 0x0000A724
public static decimal Round(decimal d, MidpointRounding mode)
{
return Math.Round(d, mode);
}
/// Multiplies two specified values.
/// A that is the result of multiplying and .
/// A (the multiplicand).
/// A (the multiplier).
/// The return value is less than or greater than .
/// 1
// Token: 0x060002F0 RID: 752 RVA: 0x0000C530 File Offset: 0x0000A730
public static decimal Multiply(decimal d1, decimal d2)
{
if (d1.IsZero() || d2.IsZero())
{
return 0m;
}
if (decimal.decimalMult(ref d1, ref d2) != 0)
{
throw new OverflowException();
}
return d1;
}
/// Divides two specified values.
/// The that is the result of dividing by .
/// A (the dividend).
/// A (the divisor).
///
/// is zero.
/// The return value (that is, the quotient) is less than or greater than .
/// 1
// Token: 0x060002F1 RID: 753 RVA: 0x0000C574 File Offset: 0x0000A774
public static decimal Divide(decimal d1, decimal d2)
{
if (d2.IsZero())
{
throw new DivideByZeroException();
}
if (d1.IsZero())
{
return 0m;
}
d1.flags ^= 2147483648U;
d1.flags ^= 2147483648U;
decimal num;
if (decimal.decimalDiv(out num, ref d1, ref d2) != 0)
{
throw new OverflowException();
}
return num;
}
/// Computes the remainder after dividing two values.
/// The that is the remainder after dividing by .
/// A (the dividend).
/// A (the divisor).
///
/// is zero.
/// The return value is less than or greater than .
/// 1
// Token: 0x060002F2 RID: 754 RVA: 0x0000C5E4 File Offset: 0x0000A7E4
public static decimal Remainder(decimal d1, decimal d2)
{
if (d2.IsZero())
{
throw new DivideByZeroException();
}
if (d1.IsZero())
{
return 0m;
}
bool flag = d1.IsNegative();
if (flag)
{
d1.flags ^= 2147483648U;
}
if (d2.IsNegative())
{
d2.flags ^= 2147483648U;
}
if (d1 == d2)
{
return 0m;
}
decimal num;
if (d2 > d1)
{
num = d1;
}
else
{
if (decimal.decimalDiv(out num, ref d1, ref d2) != 0)
{
throw new OverflowException();
}
num = decimal.Truncate(num);
num = d1 - num * d2;
}
if (flag)
{
num.flags ^= 2147483648U;
}
return num;
}
/// Compares two specified values.
/// A signed number indicating the relative values of and .Return Value Meaning Less than zero is less than . Zero and are equal. Greater than zero is greater than .
/// A .
/// A .
/// 1
// Token: 0x060002F3 RID: 755 RVA: 0x0000C6C4 File Offset: 0x0000A8C4
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static int Compare(decimal d1, decimal d2)
{
return decimal.decimalCompare(ref d1, ref d2);
}
/// Compares this instance to a specified .
/// A signed number indicating the relative values of this instance and .Return Value Meaning Less than zero This instance is less than . Zero This instance is equal to . Greater than zero This instance is greater than .-or- is null.
/// An or null.
///
/// is not a .
/// 2
// Token: 0x060002F4 RID: 756 RVA: 0x0000C6D0 File Offset: 0x0000A8D0
public int CompareTo(object value)
{
if (value == null)
{
return 1;
}
if (!(value is decimal))
{
throw new ArgumentException(Locale.GetText("Value is not a System.Decimal"));
}
return decimal.Compare(this, (decimal)value);
}
/// Compares this instance to a specified object.
/// A signed number indicating the relative values of this instance and .Return Value Meaning Less than zero This instance is less than . Zero This instance is equal to . Greater than zero This instance is greater than .
/// A object.
/// 2
// Token: 0x060002F5 RID: 757 RVA: 0x0000C714 File Offset: 0x0000A914
public int CompareTo(decimal value)
{
return decimal.Compare(this, value);
}
/// Returns a value indicating whether this instance and a specified object represent the same value.
/// true if is equal to this instance; otherwise, false.
/// A object to compare to this instance.
/// 2
// Token: 0x060002F6 RID: 758 RVA: 0x0000C724 File Offset: 0x0000A924
public bool Equals(decimal value)
{
return decimal.Equals(value, this);
}
/// Returns the smallest integral value greater than or equal to the specified decimal number.
/// The smallest integral value greater than or equal to the parameter. Note that this method returns a rather than an integral type.
/// A decimal number.
/// 1
// Token: 0x060002F7 RID: 759 RVA: 0x0000C734 File Offset: 0x0000A934
public static decimal Ceiling(decimal d)
{
return Math.Ceiling(d);
}
/// Converts the string representation of a number to its equivalent.
/// The number equivalent to the number contained in .
/// The string representation of the number to convert.
///
/// is null.
///
/// is not in the correct format.
///
/// represents a number less than or greater than .
/// 1
// Token: 0x060002F8 RID: 760 RVA: 0x0000C73C File Offset: 0x0000A93C
public static decimal Parse(string s)
{
return decimal.Parse(s, NumberStyles.Number, null);
}
/// Converts the string representation of a number in a specified style to its equivalent.
/// The number equivalent to the number contained in as specified by .
/// The string representation of the number to convert.
/// A bitwise combination of values that indicates the style elements that can be present in . A typical value to specify is .
///
/// is null.
///
/// is not a value. -or- is the value.
///
/// is not in the correct format.
///
/// represents a number less than or greater than
/// 1
// Token: 0x060002F9 RID: 761 RVA: 0x0000C748 File Offset: 0x0000A948
public static decimal Parse(string s, NumberStyles style)
{
return decimal.Parse(s, style, null);
}
/// Converts the string representation of a number to its equivalent using the specified culture-specific format information.
/// The number equivalent to the number contained in as specified by .
/// The string representation of the number to convert.
/// An that supplies culture-specific parsing information about .
///
/// is null.
///
/// is not of the correct format
///
/// represents a number less than or greater than
/// 1
// Token: 0x060002FA RID: 762 RVA: 0x0000C754 File Offset: 0x0000A954
public static decimal Parse(string s, IFormatProvider provider)
{
return decimal.Parse(s, NumberStyles.Number, provider);
}
// Token: 0x060002FB RID: 763 RVA: 0x0000C760 File Offset: 0x0000A960
private static void ThrowAtPos(int pos)
{
throw new FormatException(string.Format(Locale.GetText("Invalid character at position {0}"), pos));
}
// Token: 0x060002FC RID: 764 RVA: 0x0000C77C File Offset: 0x0000A97C
private static void ThrowInvalidExp()
{
throw new FormatException(Locale.GetText("Invalid exponent"));
}
// Token: 0x060002FD RID: 765 RVA: 0x0000C790 File Offset: 0x0000A990
private static string stripStyles(string s, NumberStyles style, NumberFormatInfo nfi, out int decPos, out bool isNegative, out bool expFlag, out int exp, bool throwex)
{
isNegative = false;
expFlag = false;
exp = 0;
decPos = -1;
bool flag = false;
bool flag2 = false;
bool flag3 = false;
bool flag4 = (style & NumberStyles.AllowLeadingWhite) != NumberStyles.None;
bool flag5 = (style & NumberStyles.AllowTrailingWhite) != NumberStyles.None;
bool flag6 = (style & NumberStyles.AllowLeadingSign) != NumberStyles.None;
bool flag7 = (style & NumberStyles.AllowTrailingSign) != NumberStyles.None;
bool flag8 = (style & NumberStyles.AllowParentheses) != NumberStyles.None;
bool flag9 = (style & NumberStyles.AllowThousands) != NumberStyles.None;
bool flag10 = (style & NumberStyles.AllowDecimalPoint) != NumberStyles.None;
bool flag11 = (style & NumberStyles.AllowExponent) != NumberStyles.None;
bool flag12 = false;
if ((style & NumberStyles.AllowCurrencySymbol) != NumberStyles.None)
{
int num = s.IndexOf(nfi.CurrencySymbol);
if (num >= 0)
{
s = s.Remove(num, nfi.CurrencySymbol.Length);
flag12 = true;
}
}
string text = ((!flag12) ? nfi.NumberDecimalSeparator : nfi.CurrencyDecimalSeparator);
string text2 = ((!flag12) ? nfi.NumberGroupSeparator : nfi.CurrencyGroupSeparator);
int i = 0;
int length = s.Length;
StringBuilder stringBuilder = new StringBuilder(length);
while (i < length)
{
char c = s[i];
if (char.IsDigit(c))
{
break;
}
if (flag4 && char.IsWhiteSpace(c))
{
i++;
}
else if (flag8 && c == '(' && !flag && !flag2)
{
flag2 = true;
flag = true;
isNegative = true;
i++;
}
else if (flag6 && c == nfi.NegativeSign[0] && !flag)
{
int length2 = nfi.NegativeSign.Length;
if (length2 == 1 || s.IndexOf(nfi.NegativeSign, i, length2) == i)
{
flag = true;
isNegative = true;
i += length2;
}
}
else if (flag6 && c == nfi.PositiveSign[0] && !flag)
{
int length3 = nfi.PositiveSign.Length;
if (length3 == 1 || s.IndexOf(nfi.PositiveSign, i, length3) == i)
{
flag = true;
i += length3;
}
}
else
{
if (flag10 && c == text[0])
{
int length4 = text.Length;
if (length4 != 1 && s.IndexOf(text, i, length4) != i)
{
if (!throwex)
{
return null;
}
decimal.ThrowAtPos(i);
}
break;
}
if (!throwex)
{
return null;
}
decimal.ThrowAtPos(i);
}
}
if (i == length)
{
if (throwex)
{
throw new FormatException(Locale.GetText("No digits found"));
}
return null;
}
else
{
while (i < length)
{
char c2 = s[i];
if (char.IsDigit(c2))
{
stringBuilder.Append(c2);
i++;
}
else if (flag9 && c2 == text2[0])
{
int length5 = text2.Length;
if (length5 != 1 && s.IndexOf(text2, i, length5) != i)
{
if (!throwex)
{
return null;
}
decimal.ThrowAtPos(i);
}
i += length5;
}
else
{
if (!flag10 || c2 != text[0] || flag3)
{
break;
}
int length6 = text.Length;
if (length6 == 1 || s.IndexOf(text, i, length6) == i)
{
decPos = stringBuilder.Length;
flag3 = true;
i += length6;
}
}
}
if (i < length)
{
char c3 = s[i];
if (flag11 && char.ToUpperInvariant(c3) == 'E')
{
expFlag = true;
i++;
if (i >= length)
{
if (!throwex)
{
return null;
}
decimal.ThrowInvalidExp();
}
c3 = s[i];
bool flag13 = false;
if (c3 == nfi.PositiveSign[0])
{
int length7 = nfi.PositiveSign.Length;
if (length7 == 1 || s.IndexOf(nfi.PositiveSign, i, length7) == i)
{
i += length7;
if (i >= length)
{
if (!throwex)
{
return null;
}
decimal.ThrowInvalidExp();
}
}
}
else if (c3 == nfi.NegativeSign[0])
{
int length8 = nfi.NegativeSign.Length;
if (length8 == 1 || s.IndexOf(nfi.NegativeSign, i, length8) == i)
{
i += length8;
if (i >= length)
{
if (!throwex)
{
return null;
}
decimal.ThrowInvalidExp();
}
flag13 = true;
}
}
c3 = s[i];
if (!char.IsDigit(c3))
{
if (!throwex)
{
return null;
}
decimal.ThrowInvalidExp();
}
exp = (int)(c3 - '0');
i++;
while (i < length && char.IsDigit(s[i]))
{
exp *= 10;
exp += (int)(s[i] - '0');
i++;
}
if (flag13)
{
exp *= -1;
}
}
}
while (i < length)
{
char c4 = s[i];
if (flag5 && char.IsWhiteSpace(c4))
{
i++;
}
else if (flag8 && c4 == ')' && flag2)
{
flag2 = false;
i++;
}
else if (flag7 && c4 == nfi.NegativeSign[0] && !flag)
{
int length9 = nfi.NegativeSign.Length;
if (length9 == 1 || s.IndexOf(nfi.NegativeSign, i, length9) == i)
{
flag = true;
isNegative = true;
i += length9;
}
}
else if (flag7 && c4 == nfi.PositiveSign[0] && !flag)
{
int length10 = nfi.PositiveSign.Length;
if (length10 == 1 || s.IndexOf(nfi.PositiveSign, i, length10) == i)
{
flag = true;
i += length10;
}
}
else
{
if (!throwex)
{
return null;
}
decimal.ThrowAtPos(i);
}
}
if (!flag2)
{
if (!flag3)
{
decPos = stringBuilder.Length;
}
return stringBuilder.ToString();
}
if (throwex)
{
throw new FormatException(Locale.GetText("Closing Parentheses not found"));
}
return null;
}
}
/// Converts the string representation of a number to its equivalent using the specified style and culture-specific format.
/// The number equivalent to the number contained in as specified by and .
/// The string representation of the number to convert.
/// A bitwise combination of values that indicates the style elements that can be present in . A typical value to specify is .
/// An object that supplies culture-specific information about the format of .
///
/// is not in the correct format.
///
/// represents a number less than or greater than .
///
/// is null.
///
/// is not a value. -or- is the value.
/// 1
// Token: 0x060002FE RID: 766 RVA: 0x0000CE48 File Offset: 0x0000B048
public static decimal Parse(string s, NumberStyles style, IFormatProvider provider)
{
if (s == null)
{
throw new ArgumentNullException("s");
}
if ((style & NumberStyles.AllowHexSpecifier) != NumberStyles.None)
{
throw new ArgumentException("Decimal.TryParse does not accept AllowHexSpecifier", "style");
}
decimal num;
decimal.PerformParse(s, style, provider, out num, true);
return num;
}
/// Converts the string representation of a number to its equivalent. A return value indicates whether the conversion succeeded or failed.
/// true if was converted successfully; otherwise, false.
/// The string representation of the number to convert.
/// When this method returns, contains the number that is equivalent to the numeric value contained in , if the conversion succeeded, or is zero if the conversion failed. The conversion fails if the parameter is null, is not a number in a valid format, or represents a number less than or greater than . This parameter is passed uninitialized.
/// 1
// Token: 0x060002FF RID: 767 RVA: 0x0000CE90 File Offset: 0x0000B090
public static bool TryParse(string s, out decimal result)
{
if (s == null)
{
result = 0m;
return false;
}
return decimal.PerformParse(s, NumberStyles.Number, null, out result, false);
}
/// Converts the string representation of a number to its equivalent using the specified style and culture-specific format. A return value indicates whether the conversion succeeded or failed.
/// true if was converted successfully; otherwise, false.
/// The string representation of the number to convert.
/// A bitwise combination of values that indicates the permitted format of . A typical value to specify is .
/// An object that supplies culture-specific parsing information about .
/// When this method returns, contains the number that is equivalent to the numeric value contained in , if the conversion succeeded, or is zero if the conversion failed. The conversion fails if the parameter is null, is not in a format compliant with , or represents a number less than or greater than . This parameter is passed uninitialized.
///
/// is not a value. -or- is the value.
/// 1
// Token: 0x06000300 RID: 768 RVA: 0x0000CEB4 File Offset: 0x0000B0B4
public static bool TryParse(string s, NumberStyles style, IFormatProvider provider, out decimal result)
{
if (s == null || (style & NumberStyles.AllowHexSpecifier) != NumberStyles.None)
{
result = 0m;
return false;
}
return decimal.PerformParse(s, style, provider, out result, false);
}
// Token: 0x06000301 RID: 769 RVA: 0x0000CEEC File Offset: 0x0000B0EC
private static bool PerformParse(string s, NumberStyles style, IFormatProvider provider, out decimal res, bool throwex)
{
NumberFormatInfo instance = NumberFormatInfo.GetInstance(provider);
int num;
bool flag;
bool flag2;
int num2;
s = decimal.stripStyles(s, style, instance, out num, out flag, out flag2, out num2, throwex);
if (s == null)
{
res = 0m;
return false;
}
if (num < 0)
{
if (throwex)
{
throw new Exception(Locale.GetText("Error in System.Decimal.Parse"));
}
res = 0m;
return false;
}
else
{
int num3 = s.Length;
int num4 = 0;
while (num4 < num && s[num4] == '0')
{
num4++;
}
if (num4 > 1 && num3 > 1)
{
s = s.Substring(num4, num3 - num4);
num -= num4;
}
int num5 = ((num != 0) ? 28 : 27);
num3 = s.Length;
if (num3 >= num5 + 1 && string.Compare(s, 0, "79228162514264337593543950335", 0, num5 + 1, false, CultureInfo.InvariantCulture) <= 0)
{
num5++;
}
if (num3 > num5 && num < num3)
{
int num6 = (int)(s[num5] - '0');
s = s.Substring(0, num5);
bool flag3 = false;
if (num6 > 5)
{
flag3 = true;
}
else if (num6 == 5)
{
if (flag)
{
flag3 = true;
}
else
{
int num7 = (int)(s[num5 - 1] - '0');
flag3 = (num7 & 1) == 1;
}
}
if (flag3)
{
char[] array = s.ToCharArray();
int i = num5 - 1;
while (i >= 0)
{
int num8 = (int)(array[i] - '0');
if (array[i] != '9')
{
array[i] = (char)(num8 + 49);
break;
}
array[i--] = '0';
}
if (i == -1 && array[0] == '0')
{
num++;
s = "1".PadRight(num, '0');
}
else
{
s = new string(array);
}
}
}
decimal num9;
if (decimal.string2decimal(out num9, s, (uint)num, 0) != 0)
{
if (throwex)
{
throw new OverflowException();
}
res = 0m;
return false;
}
else
{
if (!flag2 || decimal.decimalSetExponent(ref num9, num2) == 0)
{
if (flag)
{
num9.flags ^= 2147483648U;
}
res = num9;
return true;
}
if (throwex)
{
throw new OverflowException();
}
res = 0m;
return false;
}
}
}
/// Returns the for value type .
/// The enumerated constant .
/// 2
// Token: 0x06000302 RID: 770 RVA: 0x0000D15C File Offset: 0x0000B35C
public TypeCode GetTypeCode()
{
return TypeCode.Decimal;
}
/// Converts the value of the specified to the equivalent 8-bit unsigned integer.
/// An 8-bit unsigned integer equivalent to .
/// The value.
///
/// is less than or greater than .
/// 1
// Token: 0x06000303 RID: 771 RVA: 0x0000D160 File Offset: 0x0000B360
public static byte ToByte(decimal value)
{
if (value > 255m || value < 0m)
{
throw new OverflowException(Locale.GetText("Value is greater than Byte.MaxValue or less than Byte.MinValue"));
}
return (byte)decimal.Truncate(value);
}
/// Converts the value of the specified to the equivalent double-precision floating-point number.
/// A double-precision floating-point number equivalent to .
/// The value to convert.
/// 1
// Token: 0x06000304 RID: 772 RVA: 0x0000D1B0 File Offset: 0x0000B3B0
public static double ToDouble(decimal d)
{
return Convert.ToDouble(d);
}
/// Converts the value of the specified to the equivalent 16-bit signed integer.
/// A 16-bit signed integer equivalent to .
/// A value.
///
/// is less than or greater than .
/// 1
// Token: 0x06000305 RID: 773 RVA: 0x0000D1B8 File Offset: 0x0000B3B8
public static short ToInt16(decimal value)
{
if (value > 32767m || value < -32768m)
{
throw new OverflowException(Locale.GetText("Value is greater than Int16.MaxValue or less than Int16.MinValue"));
}
return (short)decimal.Truncate(value);
}
/// Converts the value of the specified to the equivalent 32-bit signed integer.
/// A 32-bit signed integer equivalent to the value of .
/// The value to convert.
///
/// is less than or greater than .
/// 1
// Token: 0x06000306 RID: 774 RVA: 0x0000D20C File Offset: 0x0000B40C
public static int ToInt32(decimal d)
{
if (d > 2147483647m || d < -2147483648m)
{
throw new OverflowException(Locale.GetText("Value is greater than Int32.MaxValue or less than Int32.MinValue"));
}
return (int)decimal.Truncate(d);
}
/// Converts the value of the specified to the equivalent 64-bit signed integer.
/// A 64-bit signed integer equivalent to the value of .
/// The value to convert.
///
/// is less than or greater than .
/// 1
// Token: 0x06000307 RID: 775 RVA: 0x0000D260 File Offset: 0x0000B460
public static long ToInt64(decimal d)
{
if (d > 9223372036854775807m || d < -9223372036854775808m)
{
throw new OverflowException(Locale.GetText("Value is greater than Int64.MaxValue or less than Int64.MinValue"));
}
return (long)decimal.Truncate(d);
}
/// Converts the specified value to the equivalent OLE Automation Currency value, which is contained in a 64-bit signed integer.
/// A 64-bit signed integer that contains the OLE Automation equivalent of .
/// A value.
/// 2
// Token: 0x06000308 RID: 776 RVA: 0x0000D2BC File Offset: 0x0000B4BC
public static long ToOACurrency(decimal value)
{
return (long)(value * 10000m);
}
/// Converts the value of the specified to the equivalent 8-bit signed integer.
/// An 8-bit signed integer equivalent to .
/// A value.
///
/// is less than or greater than .
/// 1
// Token: 0x06000309 RID: 777 RVA: 0x0000D2D4 File Offset: 0x0000B4D4
[CLSCompliant(false)]
public static sbyte ToSByte(decimal value)
{
if (value > 127m || value < -128m)
{
throw new OverflowException(Locale.GetText("Value is greater than SByte.MaxValue or less than SByte.MinValue"));
}
return (sbyte)decimal.Truncate(value);
}
/// Converts the value of the specified to the equivalent single-precision floating-point number.
/// A single-precision floating-point number equivalent to the value of .
/// A value to convert.
/// 1
// Token: 0x0600030A RID: 778 RVA: 0x0000D320 File Offset: 0x0000B520
public static float ToSingle(decimal d)
{
return Convert.ToSingle(d);
}
/// Converts the value of the specified to the equivalent 16-bit unsigned integer.
/// A 16-bit unsigned integer equivalent to the value of .
/// A value to convert.
///
/// is greater than or less than .
/// 1
// Token: 0x0600030B RID: 779 RVA: 0x0000D328 File Offset: 0x0000B528
[CLSCompliant(false)]
public static ushort ToUInt16(decimal value)
{
if (value > 65535m || value < 0m)
{
throw new OverflowException(Locale.GetText("Value is greater than UInt16.MaxValue or less than UInt16.MinValue"));
}
return (ushort)decimal.Truncate(value);
}
/// Converts the value of the specified to the equivalent 32-bit unsigned integer.
/// A 32-bit unsigned integer equivalent to the value of .
/// A value to convert.
///
/// is negative or greater than .
/// 1
// Token: 0x0600030C RID: 780 RVA: 0x0000D378 File Offset: 0x0000B578
[CLSCompliant(false)]
public static uint ToUInt32(decimal d)
{
if (d > 4294967295m || d < 0m)
{
throw new OverflowException(Locale.GetText("Value is greater than UInt32.MaxValue or less than UInt32.MinValue"));
}
return (uint)decimal.Truncate(d);
}
/// Converts the value of the specified to the equivalent 64-bit unsigned integer.
/// A 64-bit unsigned integer equivalent to the value of .
/// A value to convert.
///
/// is negative or greater than .
/// 1
// Token: 0x0600030D RID: 781 RVA: 0x0000D3C8 File Offset: 0x0000B5C8
[CLSCompliant(false)]
public static ulong ToUInt64(decimal d)
{
if (d > 18446744073709551615m || d < 0m)
{
throw new OverflowException(Locale.GetText("Value is greater than UInt64.MaxValue or less than UInt64.MinValue"));
}
return (ulong)decimal.Truncate(d);
}
/// Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.
/// The string representation of the value of this instance as specified by and .
/// A numeric format string (see Remarks).
/// An that supplies culture-specific formatting information.
///
/// is invalid.
/// 1
// Token: 0x0600030E RID: 782 RVA: 0x0000D418 File Offset: 0x0000B618
public string ToString(string format, IFormatProvider provider)
{
return NumberFormatter.NumberToString(format, this, provider);
}
/// Converts the numeric value of this instance to its equivalent string representation.
/// A string that represents the value of this instance.
/// 1
// Token: 0x0600030F RID: 783 RVA: 0x0000D428 File Offset: 0x0000B628
public override string ToString()
{
return this.ToString("G", null);
}
/// Converts the numeric value of this instance to its equivalent string representation, using the specified format.
/// The string representation of the value of this instance as specified by .
/// A numeric format string (see Remarks).
///
/// is invalid.
/// 1
// Token: 0x06000310 RID: 784 RVA: 0x0000D438 File Offset: 0x0000B638
public string ToString(string format)
{
return this.ToString(format, null);
}
/// Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
/// The string representation of the value of this instance as specified by .
/// An that supplies culture-specific formatting information.
/// 1
// Token: 0x06000311 RID: 785 RVA: 0x0000D444 File Offset: 0x0000B644
public string ToString(IFormatProvider provider)
{
return this.ToString("G", provider);
}
// Token: 0x06000312 RID: 786
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int decimal2UInt64(ref decimal val, out ulong result);
// Token: 0x06000313 RID: 787
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int decimal2Int64(ref decimal val, out long result);
// Token: 0x06000314 RID: 788
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int decimalIncr(ref decimal d1, ref decimal d2);
// Token: 0x06000315 RID: 789
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern int decimal2string(ref decimal val, int digits, int decimals, char[] bufDigits, int bufSize, out int decPos, out int sign);
// Token: 0x06000316 RID: 790
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern int string2decimal(out decimal val, string sDigits, uint decPos, int sign);
// Token: 0x06000317 RID: 791
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern int decimalSetExponent(ref decimal val, int exp);
// Token: 0x06000318 RID: 792
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern double decimal2double(ref decimal val);
// Token: 0x06000319 RID: 793
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void decimalFloorAndTrunc(ref decimal val, int floorFlag);
// Token: 0x0600031A RID: 794
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int decimalMult(ref decimal pd1, ref decimal pd2);
// Token: 0x0600031B RID: 795
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int decimalDiv(out decimal pc, ref decimal pa, ref decimal pb);
// Token: 0x0600031C RID: 796
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int decimalIntDiv(out decimal pc, ref decimal pa, ref decimal pb);
// Token: 0x0600031D RID: 797
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int decimalCompare(ref decimal d1, ref decimal d2);
/// Adds two specified values.
/// The result of adding and .
/// A .
/// A .
/// The return value is less than or greater than .
/// 3
// Token: 0x0600031E RID: 798 RVA: 0x0000D454 File Offset: 0x0000B654
public static decimal operator +(decimal d1, decimal d2)
{
return decimal.Add(d1, d2);
}
/// Decrements the operand by one.
/// The value of decremented by 1.
/// The operand.
/// The return value is less than or greater than .
/// 3
// Token: 0x0600031F RID: 799 RVA: 0x0000D460 File Offset: 0x0000B660
public static decimal operator --(decimal d)
{
return decimal.Add(d, -1m);
}
/// Increments the operand by 1.
/// The value of incremented by 1.
/// The operand.
/// The return value is less than or greater than .
/// 3
// Token: 0x06000320 RID: 800 RVA: 0x0000D470 File Offset: 0x0000B670
public static decimal operator ++(decimal d)
{
return decimal.Add(d, 1m);
}
/// Subtracts two specified values.
/// The result of subtracting from .
/// A .
/// A .
/// The return value is less than or greater than .
/// 3
// Token: 0x06000321 RID: 801 RVA: 0x0000D480 File Offset: 0x0000B680
public static decimal operator -(decimal d1, decimal d2)
{
return decimal.Subtract(d1, d2);
}
/// Negates the value of the specified operand.
/// The result of multiplied by negative one (-1).
/// The operand.
/// 3
// Token: 0x06000322 RID: 802 RVA: 0x0000D48C File Offset: 0x0000B68C
public static decimal operator -(decimal d)
{
return decimal.Negate(d);
}
/// Returns the value of the operand (the sign of the operand is unchanged).
/// The value of the operand, .
/// The operand.
/// 3
// Token: 0x06000323 RID: 803 RVA: 0x0000D494 File Offset: 0x0000B694
public static decimal operator +(decimal d)
{
return d;
}
/// Multiplies two specified values.
/// The result of multiplying by .
/// A .
/// A .
/// The return value is less than or greater than .
/// 3
// Token: 0x06000324 RID: 804 RVA: 0x0000D498 File Offset: 0x0000B698
public static decimal operator *(decimal d1, decimal d2)
{
return decimal.Multiply(d1, d2);
}
/// Divides two specified values.
/// The result of by .
/// A (the dividend).
/// A (the divisor).
///
/// is zero.
/// The return value is less than or greater than .
/// 3
// Token: 0x06000325 RID: 805 RVA: 0x0000D4A4 File Offset: 0x0000B6A4
public static decimal operator /(decimal d1, decimal d2)
{
return decimal.Divide(d1, d2);
}
/// Returns the remainder resulting from dividing two specified values.
/// The remainder resulting from dividing by .
/// A (the dividend).
/// A (the divisor).
///
/// is zero.
/// The return value is less than or greater than .
/// 3
// Token: 0x06000326 RID: 806 RVA: 0x0000D4B0 File Offset: 0x0000B6B0
public static decimal operator %(decimal d1, decimal d2)
{
return decimal.Remainder(d1, d2);
}
/// Converts a to an 8-bit unsigned integer.
/// An 8-bit unsigned integer that represents the converted .
/// A to convert.
///
/// is less than or greater than .
/// 3
// Token: 0x06000327 RID: 807 RVA: 0x0000D4BC File Offset: 0x0000B6BC
public static explicit operator byte(decimal value)
{
ulong num = decimal.u64(value);
return checked((byte)num);
}
/// Converts a to an 8-bit signed integer.
/// An 8-bit signed integer that represents the converted .
/// A to convert.
///
/// is less than or greater than .
/// 3
// Token: 0x06000328 RID: 808 RVA: 0x0000D4D4 File Offset: 0x0000B6D4
[CLSCompliant(false)]
public static explicit operator sbyte(decimal value)
{
long num = decimal.s64(value);
return checked((sbyte)num);
}
/// Converts a to a Unicode character.
/// A Unicode character that represents the converted .
/// A to convert.
///
/// is less than or greater than .
/// 3
// Token: 0x06000329 RID: 809 RVA: 0x0000D4EC File Offset: 0x0000B6EC
public static explicit operator char(decimal value)
{
ulong num = decimal.u64(value);
return checked((char)num);
}
/// Converts a to a 16-bit signed integer.
/// A 16-bit signed integer that represents the converted .
/// A to convert.
///
/// is less than or greater than .
/// 3
// Token: 0x0600032A RID: 810 RVA: 0x0000D504 File Offset: 0x0000B704
public static explicit operator short(decimal value)
{
long num = decimal.s64(value);
return checked((short)num);
}
/// Converts a to a 16-bit unsigned integer.
/// A 16-bit unsigned integer that represents the converted .
/// A to convert.
///
/// is greater than or less than .
/// 3
// Token: 0x0600032B RID: 811 RVA: 0x0000D51C File Offset: 0x0000B71C
[CLSCompliant(false)]
public static explicit operator ushort(decimal value)
{
ulong num = decimal.u64(value);
return checked((ushort)num);
}
/// Converts a to a 32-bit signed integer.
/// A 32-bit signed integer that represents the converted .
/// A to convert.
///
/// is less than or greater than .
/// 3
// Token: 0x0600032C RID: 812 RVA: 0x0000D534 File Offset: 0x0000B734
public static explicit operator int(decimal value)
{
long num = decimal.s64(value);
return checked((int)num);
}
/// Converts a to a 32-bit unsigned integer.
/// A 32-bit unsigned integer that represents the converted .
/// A to convert.
///
/// is negative or greater than .
/// 3
// Token: 0x0600032D RID: 813 RVA: 0x0000D54C File Offset: 0x0000B74C
[CLSCompliant(false)]
public static explicit operator uint(decimal value)
{
ulong num = decimal.u64(value);
return checked((uint)num);
}
/// Converts a to a 64-bit signed integer.
/// A 64-bit signed integer that represents the converted .
/// A to convert.
///
/// is less than or greater than .
/// 3
// Token: 0x0600032E RID: 814 RVA: 0x0000D564 File Offset: 0x0000B764
public static explicit operator long(decimal value)
{
return decimal.s64(value);
}
/// Converts a to a 64-bit unsigned integer.
/// A 64-bit unsigned integer that represents the converted .
/// A to convert.
///
/// is negative or greater than .
/// 3
// Token: 0x0600032F RID: 815 RVA: 0x0000D56C File Offset: 0x0000B76C
[CLSCompliant(false)]
public static explicit operator ulong(decimal value)
{
return decimal.u64(value);
}
/// Converts an 8-bit unsigned integer to a .
/// A that represents the converted 8-bit unsigned integer.
/// An 8-bit unsigned integer.
/// 3
// Token: 0x06000330 RID: 816 RVA: 0x0000D574 File Offset: 0x0000B774
public static implicit operator decimal(byte value)
{
return new decimal((int)value);
}
/// Converts an 8-bit signed integer to a .
/// A that represents the converted 8-bit signed integer.
/// An 8-bit signed integer.
/// 3
// Token: 0x06000331 RID: 817 RVA: 0x0000D57C File Offset: 0x0000B77C
[CLSCompliant(false)]
public static implicit operator decimal(sbyte value)
{
return new decimal((int)value);
}
/// Converts a 16-bit signed integer to a .
/// A that represents the converted 16-bit signed integer.
/// A 16-bit signed integer.
/// 3
// Token: 0x06000332 RID: 818 RVA: 0x0000D588 File Offset: 0x0000B788
public static implicit operator decimal(short value)
{
return new decimal((int)value);
}
/// Converts a 16-bit unsigned integer to a .
/// A that represents the converted 16-bit unsigned integer.
/// A 16-bit unsigned integer.
/// 3
// Token: 0x06000333 RID: 819 RVA: 0x0000D590 File Offset: 0x0000B790
[CLSCompliant(false)]
public static implicit operator decimal(ushort value)
{
return new decimal((int)value);
}
/// Converts a Unicode character to a .
/// A that represents the converted Unicode character.
/// A Unicode character.
/// 3
// Token: 0x06000334 RID: 820 RVA: 0x0000D598 File Offset: 0x0000B798
public static implicit operator decimal(char value)
{
return new decimal((int)value);
}
/// Converts a 32-bit signed integer to a .
/// A that represents the converted 32-bit signed integer.
/// A 32-bit signed integer.
/// 3
// Token: 0x06000335 RID: 821 RVA: 0x0000D5A0 File Offset: 0x0000B7A0
public static implicit operator decimal(int value)
{
return new decimal(value);
}
/// Converts a 32-bit unsigned integer to a .
/// A that represents the converted 32-bit unsigned integer.
/// A 32-bit unsigned integer.
/// 3
// Token: 0x06000336 RID: 822 RVA: 0x0000D5A8 File Offset: 0x0000B7A8
[CLSCompliant(false)]
public static implicit operator decimal(uint value)
{
return new decimal(value);
}
/// Converts a 64-bit signed integer to a .
/// A that represents the converted 64-bit signed integer.
/// A 64-bit signed integer.
/// 3
// Token: 0x06000337 RID: 823 RVA: 0x0000D5B0 File Offset: 0x0000B7B0
public static implicit operator decimal(long value)
{
return new decimal(value);
}
/// Converts a 64-bit unsigned integer to a .
/// A that represents the converted 64-bit unsigned integer.
/// A 64-bit unsigned integer.
/// 3
// Token: 0x06000338 RID: 824 RVA: 0x0000D5B8 File Offset: 0x0000B7B8
[CLSCompliant(false)]
public static implicit operator decimal(ulong value)
{
return new decimal(value);
}
/// Converts a single-precision floating-point number to a .
/// A that represents the converted single-precision floating point number.
/// A single-precision floating-point number.
///
/// is less than or greater than .-or- is , , or .
/// 3
// Token: 0x06000339 RID: 825 RVA: 0x0000D5C0 File Offset: 0x0000B7C0
public static explicit operator decimal(float value)
{
return new decimal(value);
}
/// Converts a double-precision floating-point number to a .
/// A that represents the converted double-precision floating point number.
/// A double-precision floating-point number.
///
/// is less than or greater than .-or- is , , or .
/// 3
// Token: 0x0600033A RID: 826 RVA: 0x0000D5C8 File Offset: 0x0000B7C8
public static explicit operator decimal(double value)
{
return new decimal(value);
}
/// Converts a to a single-precision floating-point number.
/// A single-precision floating-point number that represents the converted .
/// A to convert.
/// 3
// Token: 0x0600033B RID: 827 RVA: 0x0000D5D0 File Offset: 0x0000B7D0
public static explicit operator float(decimal value)
{
return (float)(double)value;
}
/// Converts a to a double-precision floating-point number.
/// A double-precision floating-point number that represents the converted .
/// A to convert.
/// 3
// Token: 0x0600033C RID: 828 RVA: 0x0000D5DC File Offset: 0x0000B7DC
public static explicit operator double(decimal value)
{
return decimal.decimal2double(ref value);
}
/// Returns a value indicating whether two instances of are not equal.
/// true if and are not equal; otherwise, false.
/// A .
/// A .
/// 3
// Token: 0x0600033D RID: 829 RVA: 0x0000D5E8 File Offset: 0x0000B7E8
public static bool operator !=(decimal d1, decimal d2)
{
return !decimal.Equals(d1, d2);
}
/// Returns a value indicating whether two instances of are equal.
/// true if and are equal; otherwise, false.
/// A .
/// A .
/// 3
// Token: 0x0600033E RID: 830 RVA: 0x0000D5F4 File Offset: 0x0000B7F4
public static bool operator ==(decimal d1, decimal d2)
{
return decimal.Equals(d1, d2);
}
/// Returns a value indicating whether a specified is greater than another specified .
/// true if is greater than ; otherwise, false.
/// A .
/// A .
/// 3
// Token: 0x0600033F RID: 831 RVA: 0x0000D600 File Offset: 0x0000B800
public static bool operator >(decimal d1, decimal d2)
{
return decimal.Compare(d1, d2) > 0;
}
/// Returns a value indicating whether a specified is greater than or equal to another specified .
/// true if is greater than or equal to ; otherwise, false.
/// A .
/// A .
/// 3
// Token: 0x06000340 RID: 832 RVA: 0x0000D60C File Offset: 0x0000B80C
public static bool operator >=(decimal d1, decimal d2)
{
return decimal.Compare(d1, d2) >= 0;
}
/// Returns a value indicating whether a specified is less than another specified .
/// true if is less than ; otherwise, false.
/// A .
/// A .
/// 3
// Token: 0x06000341 RID: 833 RVA: 0x0000D61C File Offset: 0x0000B81C
public static bool operator <(decimal d1, decimal d2)
{
return decimal.Compare(d1, d2) < 0;
}
/// Returns a value indicating whether a specified is less than or equal to another specified .
/// true if is less than or equal to ; otherwise, false.
/// A .
/// A .
/// 3
// Token: 0x06000342 RID: 834 RVA: 0x0000D628 File Offset: 0x0000B828
public static bool operator <=(decimal d1, decimal d2)
{
return decimal.Compare(d1, d2) <= 0;
}
/// Represents the smallest possible value of . This field is constant and read-only.
/// 1
// Token: 0x04000042 RID: 66
public const decimal MinValue = -79228162514264337593543950335m;
/// Represents the largest possible value of . This field is constant and read-only.
/// 1
// Token: 0x04000043 RID: 67
public const decimal MaxValue = 79228162514264337593543950335m;
/// Represents the number negative one (-1).
/// 1
// Token: 0x04000044 RID: 68
public const decimal MinusOne = -1m;
/// Represents the number one (1).
/// 1
// Token: 0x04000045 RID: 69
public const decimal One = 1m;
/// Represents the number zero (0).
/// 1
// Token: 0x04000046 RID: 70
public const decimal Zero = 0m;
// Token: 0x04000047 RID: 71
private const int DECIMAL_DIVIDE_BY_ZERO = 5;
// Token: 0x04000048 RID: 72
private const uint MAX_SCALE = 28U;
// Token: 0x04000049 RID: 73
private const int iMAX_SCALE = 28;
// Token: 0x0400004A RID: 74
private const uint SIGN_FLAG = 2147483648U;
// Token: 0x0400004B RID: 75
private const uint SCALE_MASK = 16711680U;
// Token: 0x0400004C RID: 76
private const int SCALE_SHIFT = 16;
// Token: 0x0400004D RID: 77
private const uint RESERVED_SS32_BITS = 2130771967U;
// Token: 0x0400004E RID: 78
private static readonly decimal MaxValueDiv10 = 7922816251426433759354395033.5m;
// Token: 0x0400004F RID: 79
private uint flags;
// Token: 0x04000050 RID: 80
private uint hi;
// Token: 0x04000051 RID: 81
private uint lo;
// Token: 0x04000052 RID: 82
private uint mid;
}
}