using System; using System.Globalization; using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; namespace System { /// Represents a single-precision floating-point number. /// 1 // Token: 0x0200001F RID: 31 [ComVisible(true)] [Serializable] public struct Single : IFormattable, IConvertible, IComparable, IComparable, IEquatable { /// 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: 0x0600027D RID: 637 RVA: 0x0000AD08 File Offset: 0x00008F08 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. // Token: 0x0600027E RID: 638 RVA: 0x0000AD14 File Offset: 0x00008F14 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: 0x0600027F RID: 639 RVA: 0x0000AD20 File Offset: 0x00008F20 char IConvertible.ToChar(IFormatProvider provider) { return Convert.ToChar(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: 0x06000280 RID: 640 RVA: 0x0000AD2C File Offset: 0x00008F2C DateTime IConvertible.ToDateTime(IFormatProvider provider) { return Convert.ToDateTime(this); } /// For a description of this member, see . /// The value of the current instance, converted to a . /// This parameter is ignored. // Token: 0x06000281 RID: 641 RVA: 0x0000AD38 File Offset: 0x00008F38 decimal IConvertible.ToDecimal(IFormatProvider provider) { return Convert.ToDecimal(this); } /// For a description of this member, see . /// The value of the current instance, converted to a . /// This parameter is ignored. // Token: 0x06000282 RID: 642 RVA: 0x0000AD44 File Offset: 0x00008F44 double IConvertible.ToDouble(IFormatProvider provider) { return Convert.ToDouble(this); } /// For a description of this member, see . /// The value of the current instance, converted to an . /// This parameter is ignored. // Token: 0x06000283 RID: 643 RVA: 0x0000AD50 File Offset: 0x00008F50 short IConvertible.ToInt16(IFormatProvider provider) { return Convert.ToInt16(this); } /// For a description of this member, see . /// The value of the current instance, converted to an . /// This parameter is ignored. // Token: 0x06000284 RID: 644 RVA: 0x0000AD5C File Offset: 0x00008F5C int IConvertible.ToInt32(IFormatProvider provider) { return Convert.ToInt32(this); } /// For a description of this member, see . /// The value of the current instance, converted to an . /// This parameter is ignored. // Token: 0x06000285 RID: 645 RVA: 0x0000AD68 File Offset: 0x00008F68 long IConvertible.ToInt64(IFormatProvider provider) { return Convert.ToInt64(this); } /// For a description of this member, see . /// The value of the current instance, converted to an . /// This parameter is ignored. // Token: 0x06000286 RID: 646 RVA: 0x0000AD74 File Offset: 0x00008F74 sbyte IConvertible.ToSByte(IFormatProvider provider) { return Convert.ToSByte(this); } /// For a description of this member, see . /// The value of the current instance, unchanged. /// This parameter is ignored. // Token: 0x06000287 RID: 647 RVA: 0x0000AD80 File Offset: 0x00008F80 float IConvertible.ToSingle(IFormatProvider provider) { return Convert.ToSingle(this); } /// For a description of this member, see . /// The value of the current instance, converted to . /// The type to which to convert this value. /// An implementation that supplies information about the format of the returned value. // Token: 0x06000288 RID: 648 RVA: 0x0000AD8C File Offset: 0x00008F8C 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 . /// The value of the current instance, converted to a . /// This parameter is ignored. // Token: 0x06000289 RID: 649 RVA: 0x0000ADBC File Offset: 0x00008FBC 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. // Token: 0x0600028A RID: 650 RVA: 0x0000ADC8 File Offset: 0x00008FC8 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. // Token: 0x0600028B RID: 651 RVA: 0x0000ADD4 File Offset: 0x00008FD4 ulong IConvertible.ToUInt64(IFormatProvider provider) { return Convert.ToUInt64(this); } /// Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object. /// A signed number indicating the relative values of this instance and .Return Value Description Less than zero This instance is less than .-or- This instance is not a number () and is a number. Zero This instance is equal to .-or- This instance and value are both not a number (), , or . Greater than zero This instance is greater than .-or- This instance is a number and is not a number ().-or- is null. /// An object to compare, or null. /// /// is not a . /// 2 // Token: 0x0600028C RID: 652 RVA: 0x0000ADE0 File Offset: 0x00008FE0 public int CompareTo(object value) { if (value == null) { return 1; } if (!(value is float)) { throw new ArgumentException(Locale.GetText("Value is not a System.Single.")); } float num = (float)value; if (float.IsPositiveInfinity(this) && float.IsPositiveInfinity(num)) { return 0; } if (float.IsNegativeInfinity(this) && float.IsNegativeInfinity(num)) { return 0; } if (float.IsNaN(num)) { if (float.IsNaN(this)) { return 0; } return 1; } else if (float.IsNaN(this)) { if (float.IsNaN(num)) { return 0; } return -1; } else { if (this == num) { return 0; } if (this > num) { return 1; } return -1; } } /// Returns a value indicating whether this instance is equal to a specified object. /// true if is an instance of and equals the value of this instance; otherwise, false. /// An object to compare with this instance. /// 2 // Token: 0x0600028D RID: 653 RVA: 0x0000AE94 File Offset: 0x00009094 public override bool Equals(object obj) { if (!(obj is float)) { return false; } float num = (float)obj; if (float.IsNaN(num)) { return float.IsNaN(this); } return num == this; } /// Compares this instance to a specified single-precision floating-point number and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified single-precision floating-point number. /// A signed number indicating the relative values of this instance and .Return Value Description Less than zero This instance is less than .-or- This instance is not a number () and is a number. Zero This instance is equal to .-or- Both this instance and are not a number (), , or . Greater than zero This instance is greater than .-or- This instance is a number and is not a number (). /// A single-precision floating-point number to compare. /// 2 // Token: 0x0600028E RID: 654 RVA: 0x0000AED0 File Offset: 0x000090D0 public int CompareTo(float value) { if (float.IsPositiveInfinity(this) && float.IsPositiveInfinity(value)) { return 0; } if (float.IsNegativeInfinity(this) && float.IsNegativeInfinity(value)) { return 0; } if (float.IsNaN(value)) { if (float.IsNaN(this)) { return 0; } return 1; } else if (float.IsNaN(this)) { if (float.IsNaN(value)) { return 0; } return -1; } else { if (this == value) { return 0; } if (this > value) { return 1; } return -1; } } /// 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: 0x0600028F RID: 655 RVA: 0x0000AF5C File Offset: 0x0000915C public bool Equals(float obj) { if (float.IsNaN(obj)) { return float.IsNaN(this); } return obj == this; } /// Returns the hash code for this instance. /// A 32-bit signed integer hash code. /// 2 // Token: 0x06000290 RID: 656 RVA: 0x0000AF78 File Offset: 0x00009178 public override int GetHashCode() { return (int)this; } /// Returns a value indicating whether the specified number evaluates to negative or positive infinity. /// true if evaluates to or ; otherwise, false. /// A single-precision floating-point number. /// 1 // Token: 0x06000291 RID: 657 RVA: 0x0000AF8C File Offset: 0x0000918C public static bool IsInfinity(float f) { return f == float.PositiveInfinity || f == float.NegativeInfinity; } /// Returns a value indicating whether the specified number evaluates to not a number (). /// true if evaluates to not a number (); otherwise, false. /// A single-precision floating-point number. /// 1 // Token: 0x06000292 RID: 658 RVA: 0x0000AFA4 File Offset: 0x000091A4 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static bool IsNaN(float f) { return f != f; } /// Returns a value indicating whether the specified number evaluates to negative infinity. /// true if evaluates to ; otherwise, false. /// A single-precision floating-point number. /// 1 // Token: 0x06000293 RID: 659 RVA: 0x0000AFB0 File Offset: 0x000091B0 public static bool IsNegativeInfinity(float f) { return f < 0f && (f == float.NegativeInfinity || f == float.PositiveInfinity); } /// Returns a value indicating whether the specified number evaluates to positive infinity. /// true if evaluates to ; otherwise, false. /// A single-precision floating-point number. /// 1 // Token: 0x06000294 RID: 660 RVA: 0x0000AFE4 File Offset: 0x000091E4 public static bool IsPositiveInfinity(float f) { return f > 0f && (f == float.NegativeInfinity || f == float.PositiveInfinity); } /// Converts the string representation of a number to its single-precision floating-point number equivalent. /// A single-precision floating-point number equivalent to the numeric value or symbol specified in . /// A string that contains a number to convert. /// /// is null. /// /// is not a number in a valid format. /// /// represents a number less than or greater than . /// 1 // Token: 0x06000295 RID: 661 RVA: 0x0000B018 File Offset: 0x00009218 public static float Parse(string s) { double num = double.Parse(s, NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite | NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands | NumberStyles.AllowExponent, null); if (num - 3.4028234663852886E+38 > 3.6147112457961776E+29 && !double.IsPositiveInfinity(num)) { throw new OverflowException(); } return (float)num; } /// Converts the string representation of a number in a specified culture-specific format to its single-precision floating-point number equivalent. /// A single-precision floating-point number equivalent to the numeric value or symbol specified in . /// A string that contains a number to convert. /// An object that supplies culture-specific formatting information about . /// /// is null. /// /// is not a number in a valid format. /// /// represents a number less than or greater than . /// 1 // Token: 0x06000296 RID: 662 RVA: 0x0000B060 File Offset: 0x00009260 public static float Parse(string s, IFormatProvider provider) { double num = double.Parse(s, NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite | NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands | NumberStyles.AllowExponent, provider); if (num - 3.4028234663852886E+38 > 3.6147112457961776E+29 && !double.IsPositiveInfinity(num)) { throw new OverflowException(); } return (float)num; } /// Converts the string representation of a number in a specified style to its single-precision floating-point number equivalent. /// A single-precision floating-point number that is equivalent to the numeric value or symbol specified in . /// A string that contains a number to convert. /// A bitwise combination of enumeration values that indicates the permitted format of . A typical value to specify is combined with . /// /// is null. /// /// is not a number in a valid format. /// /// represents a number less than or greater than . /// /// is not a value. -or- is the value. /// 1 // Token: 0x06000297 RID: 663 RVA: 0x0000B0A8 File Offset: 0x000092A8 public static float Parse(string s, NumberStyles style) { double num = double.Parse(s, style, null); if (num - 3.4028234663852886E+38 > 3.6147112457961776E+29 && !double.IsPositiveInfinity(num)) { throw new OverflowException(); } return (float)num; } /// Converts the string representation of a number in a specified style and culture-specific format to its single-precision floating-point number equivalent. /// A single-precision floating-point number equivalent to the numeric value or symbol specified in . /// A string that contains a number to convert. /// A bitwise combination of values that indicates the permitted format of . A typical value to specify is combined with . /// An object that supplies culture-specific formatting information about . /// /// is null. /// /// is not a numeric value. /// /// is not a value. -or- is the value. /// 1 // Token: 0x06000298 RID: 664 RVA: 0x0000B0EC File Offset: 0x000092EC public static float Parse(string s, NumberStyles style, IFormatProvider provider) { double num = double.Parse(s, style, provider); if (num - 3.4028234663852886E+38 > 3.6147112457961776E+29 && !double.IsPositiveInfinity(num)) { throw new OverflowException(); } return (float)num; } /// Converts the string representation of a number in a specified style and culture-specific format to its single-precision floating-point number equivalent. A return value indicates whether the conversion succeeded or failed. /// true if was converted successfully; otherwise, false. /// A string representing a number to convert. /// A bitwise combination of enumeration values that indicates the permitted format of . A typical value to specify is combined with . /// An object object that supplies culture-specific formatting information about . /// When this method returns, contains the single-precision floating-point number equivalent to the numeric value or symbol contained in , if the conversion succeeded, or zero if the conversion failed. The conversion fails if the parameter is null, is not in a format compliant with , represents a number less than or greater than , or is not a valid combination of enumerated constants. This parameter is passed uninitialized. /// /// is not a value. -or- is the value. /// 1 // Token: 0x06000299 RID: 665 RVA: 0x0000B130 File Offset: 0x00009330 public static bool TryParse(string s, NumberStyles style, IFormatProvider provider, out float result) { double num; Exception ex; if (!double.Parse(s, style, provider, true, out num, out ex)) { result = 0f; return false; } if (num - 3.4028234663852886E+38 > 3.6147112457961776E+29 && !double.IsPositiveInfinity(num)) { result = 0f; return false; } result = (float)num; return true; } /// Converts the string representation of a number to its single-precision floating-point number equivalent. A return value indicates whether the conversion succeeded or failed. /// true if was converted successfully; otherwise, false. /// A string representing a number to convert. /// When this method returns, contains single-precision floating-point number equivalent to the numeric value or symbol contained in , if the conversion succeeded, or 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: 0x0600029A RID: 666 RVA: 0x0000B18C File Offset: 0x0000938C public static bool TryParse(string s, out float result) { return float.TryParse(s, NumberStyles.Any, null, out result); } /// Converts the numeric value of this instance to its equivalent string representation. /// The string representation of the value of this instance. /// 1 // Token: 0x0600029B RID: 667 RVA: 0x0000B19C File Offset: 0x0000939C public override string ToString() { return NumberFormatter.NumberToString(this, 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: 0x0600029C RID: 668 RVA: 0x0000B1A8 File Offset: 0x000093A8 public string ToString(IFormatProvider provider) { return NumberFormatter.NumberToString(this, provider); } /// 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: 0x0600029D RID: 669 RVA: 0x0000B1B4 File Offset: 0x000093B4 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 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. /// 1 // Token: 0x0600029E RID: 670 RVA: 0x0000B1C0 File Offset: 0x000093C0 public string ToString(string format, IFormatProvider provider) { return NumberFormatter.NumberToString(format, this, provider); } /// Returns the for value type . /// The enumerated constant, . /// 2 // Token: 0x0600029F RID: 671 RVA: 0x0000B1CC File Offset: 0x000093CC public TypeCode GetTypeCode() { return TypeCode.Single; } /// Represents the smallest positive value greater than zero. This field is constant. /// 1 // Token: 0x0400002C RID: 44 public const float Epsilon = 1E-45f; /// Represents the largest possible value of . This field is constant. /// 1 // Token: 0x0400002D RID: 45 public const float MaxValue = 3.4028235E+38f; /// Represents the smallest possible value of . This field is constant. /// 1 // Token: 0x0400002E RID: 46 public const float MinValue = -3.4028235E+38f; /// Represents not a number (NaN). This field is constant. /// 1 // Token: 0x0400002F RID: 47 public const float NaN = float.NaN; /// Represents positive infinity. This field is constant. /// 1 // Token: 0x04000030 RID: 48 public const float PositiveInfinity = float.PositiveInfinity; /// Represents negative infinity. This field is constant. /// 1 // Token: 0x04000031 RID: 49 public const float NegativeInfinity = float.NegativeInfinity; // Token: 0x04000032 RID: 50 private const double MaxValueEpsilon = 3.6147112457961776E+29; // Token: 0x04000033 RID: 51 internal float m_value; } }