using System;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
namespace System
{
/// Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.
/// 1
// Token: 0x02000682 RID: 1666
public static class Math
{
/// Returns the absolute value of a number.
/// A , x, such that 0 ≤ x ≤.
/// A number that is greater than or equal to , but less than or equal to .
/// 1
// Token: 0x06003EFC RID: 16124 RVA: 0x000D542C File Offset: 0x000D362C
public static decimal Abs(decimal value)
{
return (!(value < 0m)) ? value : (-value);
}
/// Returns the absolute value of a double-precision floating-point number.
/// A double-precision floating-point number, x, such that 0 ≤ x ≤.
/// A number that is greater than or equal to , but less than or equal to .
/// 1
// Token: 0x06003EFD RID: 16125 RVA: 0x000D544C File Offset: 0x000D364C
public static double Abs(double value)
{
return (value >= 0.0) ? value : (-value);
}
/// Returns the absolute value of a single-precision floating-point number.
/// A single-precision floating-point number, x, such that 0 ≤ x ≤.
/// A number that is greater than or equal to , but less than or equal to .
/// 1
// Token: 0x06003EFE RID: 16126 RVA: 0x000D5468 File Offset: 0x000D3668
public static float Abs(float value)
{
return (value >= 0f) ? value : (-value);
}
/// Returns the absolute value of a 32-bit signed integer.
/// A 32-bit signed integer, x, such that 0 ≤ x ≤.
/// A number that is greater than , but less than or equal to .
///
/// equals .
/// 1
// Token: 0x06003EFF RID: 16127 RVA: 0x000D5480 File Offset: 0x000D3680
public static int Abs(int value)
{
if (value == -2147483648)
{
throw new OverflowException(Locale.GetText("Value is too small."));
}
return (value >= 0) ? value : (-value);
}
/// Returns the absolute value of a 64-bit signed integer.
/// A 64-bit signed integer, x, such that 0 ≤ x ≤.
/// A number that is greater than , but less than or equal to .
///
/// equals .
/// 1
// Token: 0x06003F00 RID: 16128 RVA: 0x000D54B8 File Offset: 0x000D36B8
public static long Abs(long value)
{
if (value == -9223372036854775808L)
{
throw new OverflowException(Locale.GetText("Value is too small."));
}
return (value >= 0L) ? value : (-value);
}
/// Returns the absolute value of an 8-bit signed integer.
/// An 8-bit signed integer, x, such that 0 ≤ x ≤.
/// A number that is greater than , but less than or equal to .
///
/// equals .
/// 1
// Token: 0x06003F01 RID: 16129 RVA: 0x000D54EC File Offset: 0x000D36EC
[CLSCompliant(false)]
public static sbyte Abs(sbyte value)
{
if ((int)value == -128)
{
throw new OverflowException(Locale.GetText("Value is too small."));
}
return (sbyte)(((int)value >= 0) ? ((int)value) : (-(sbyte)((int)value)));
}
/// Returns the absolute value of a 16-bit signed integer.
/// A 16-bit signed integer, x, such that 0 ≤ x ≤.
/// A number that is greater than , but less than or equal to .
///
/// equals .
/// 1
// Token: 0x06003F02 RID: 16130 RVA: 0x000D5528 File Offset: 0x000D3728
public static short Abs(short value)
{
if (value == -32768)
{
throw new OverflowException(Locale.GetText("Value is too small."));
}
return (value >= 0) ? value : (-value);
}
/// Returns the smallest integral value that is greater than or equal to the specified decimal number.
/// The smallest integer that is greater than or equal to . Note that the method returns a type instead of an integral type.
/// A decimal number.
/// 1
// Token: 0x06003F03 RID: 16131 RVA: 0x000D5558 File Offset: 0x000D3758
public static decimal Ceiling(decimal d)
{
decimal num = Math.Floor(d);
if (num != d)
{
num += 1m;
}
return num;
}
/// Returns the smallest integral value that is greater than or equal to the specified double-precision floating-point number.
/// The smallest integral value that is greater than or equal to . If is equal to , , or , that value is returned. Note that this method returns a type instead of an integral type.
/// A double-precision floating-point number.
/// 1
// Token: 0x06003F04 RID: 16132 RVA: 0x000D5580 File Offset: 0x000D3780
public static double Ceiling(double a)
{
double num = Math.Floor(a);
if (num != a)
{
num += 1.0;
}
return num;
}
/// Produces the full product of two 32-bit numbers.
/// The containing the product of the specified numbers.
/// The first to multiply.
/// The second to multiply.
/// 1
// Token: 0x06003F05 RID: 16133 RVA: 0x000D55A8 File Offset: 0x000D37A8
public static long BigMul(int a, int b)
{
return (long)a * (long)b;
}
/// Calculates the quotient of two 32-bit signed integers and also returns the remainder in an output parameter.
/// The quotient of the specified numbers.
/// The dividend.
/// The divisor.
/// The remainder.
///
/// is zero.
/// 1
// Token: 0x06003F06 RID: 16134 RVA: 0x000D55B0 File Offset: 0x000D37B0
public static int DivRem(int a, int b, out int result)
{
result = a % b;
return a / b;
}
/// Calculates the quotient of two 64-bit signed integers and also returns the remainder in an output parameter.
/// The quotient of the specified numbers.
/// The dividend.
/// The divisor.
/// The remainder.
///
/// is zero.
/// 1
// Token: 0x06003F07 RID: 16135 RVA: 0x000D55BC File Offset: 0x000D37BC
public static long DivRem(long a, long b, out long result)
{
result = a % b;
return a / b;
}
/// Returns the largest integer less than or equal to the specified double-precision floating-point number.
/// The largest integer less than or equal to . If is equal to , , or , that value is returned.
/// A double-precision floating-point number.
/// 1
// Token: 0x06003F08 RID: 16136
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Floor(double d);
/// Returns the remainder resulting from the division of a specified number by another specified number.
/// A number equal to - ( Q), where Q is the quotient of / rounded to the nearest integer (if / falls halfway between two integers, the even integer is returned).If - ( Q) is zero, the value +0 is returned if is positive, or -0 if is negative.If = 0, is returned.
/// A dividend.
/// A divisor.
/// 1
// Token: 0x06003F09 RID: 16137 RVA: 0x000D55C8 File Offset: 0x000D37C8
public static double IEEERemainder(double x, double y)
{
if (y == 0.0)
{
return double.NaN;
}
double num = x - y * Math.Round(x / y);
if (num != 0.0)
{
return num;
}
return (x <= 0.0) ? BitConverter.Int64BitsToDouble(long.MinValue) : 0.0;
}
/// Returns the logarithm of a specified number in a specified base.
/// In the following table +Infinity denotes , -Infinity denotes , and NaN denotes .Return Value> 0(0 << 1) -or-(> 1)lognewBase(a)< 0(any value)NaN(any value)< 0NaN != 1 = 0NaN != 1 = +InfinityNaN = NaN(any value)NaN(any value) = NaNNaN(any value) = 1NaN = 00 << 1 +Infinity = 0> 1-Infinity = +Infinity0 << 1-Infinity = +Infinity> 1+Infinity = 1 = 00 = 1 = +Infinity0
/// A number whose logarithm is to be found.
/// The base of the logarithm.
/// 1
// Token: 0x06003F0A RID: 16138 RVA: 0x000D5638 File Offset: 0x000D3838
public static double Log(double a, double newBase)
{
double num = Math.Log(a) / Math.Log(newBase);
return (num != 0.0) ? num : 0.0;
}
/// Returns the larger of two 8-bit unsigned integers.
/// Parameter or , whichever is larger.
/// The first of two 8-bit unsigned integers to compare.
/// The second of two 8-bit unsigned integers to compare.
/// 1
// Token: 0x06003F0B RID: 16139 RVA: 0x000D5674 File Offset: 0x000D3874
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static byte Max(byte val1, byte val2)
{
return (val1 <= val2) ? val2 : val1;
}
/// Returns the larger of two decimal numbers.
/// Parameter or , whichever is larger.
/// The first of two numbers to compare.
/// The second of two numbers to compare.
/// 1
// Token: 0x06003F0C RID: 16140 RVA: 0x000D5684 File Offset: 0x000D3884
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static decimal Max(decimal val1, decimal val2)
{
return (!(val1 > val2)) ? val2 : val1;
}
/// Returns the larger of two double-precision floating-point numbers.
/// Parameter or , whichever is larger. If , , or both and are equal to , is returned.
/// The first of two double-precision floating-point numbers to compare.
/// The second of two double-precision floating-point numbers to compare.
/// 1
// Token: 0x06003F0D RID: 16141 RVA: 0x000D569C File Offset: 0x000D389C
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static double Max(double val1, double val2)
{
if (double.IsNaN(val1) || double.IsNaN(val2))
{
return double.NaN;
}
return (val1 <= val2) ? val2 : val1;
}
/// Returns the larger of two single-precision floating-point numbers.
/// Parameter or , whichever is larger. If , or , or both and are equal to , is returned.
/// The first of two single-precision floating-point numbers to compare.
/// The second of two single-precision floating-point numbers to compare.
/// 1
// Token: 0x06003F0E RID: 16142 RVA: 0x000D56D8 File Offset: 0x000D38D8
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static float Max(float val1, float val2)
{
if (float.IsNaN(val1) || float.IsNaN(val2))
{
return float.NaN;
}
return (val1 <= val2) ? val2 : val1;
}
/// Returns the larger of two 32-bit signed integers.
/// Parameter or , whichever is larger.
/// The first of two 32-bit signed integers to compare.
/// The second of two 32-bit signed integers to compare.
/// 1
// Token: 0x06003F0F RID: 16143 RVA: 0x000D5710 File Offset: 0x000D3910
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static int Max(int val1, int val2)
{
return (val1 <= val2) ? val2 : val1;
}
/// Returns the larger of two 64-bit signed integers.
/// Parameter or , whichever is larger.
/// The first of two 64-bit signed integers to compare.
/// The second of two 64-bit signed integers to compare.
/// 1
// Token: 0x06003F10 RID: 16144 RVA: 0x000D5720 File Offset: 0x000D3920
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static long Max(long val1, long val2)
{
return (val1 <= val2) ? val2 : val1;
}
/// Returns the larger of two 8-bit signed integers.
/// Parameter or , whichever is larger.
/// The first of two 8-bit signed integers to compare.
/// The second of two 8-bit signed integers to compare.
/// 1
// Token: 0x06003F11 RID: 16145 RVA: 0x000D5730 File Offset: 0x000D3930
[CLSCompliant(false)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static sbyte Max(sbyte val1, sbyte val2)
{
return ((int)val1 <= (int)val2) ? val2 : val1;
}
/// Returns the larger of two 16-bit signed integers.
/// Parameter or , whichever is larger.
/// The first of two 16-bit signed integers to compare.
/// The second of two 16-bit signed integers to compare.
/// 1
// Token: 0x06003F12 RID: 16146 RVA: 0x000D5744 File Offset: 0x000D3944
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static short Max(short val1, short val2)
{
return (val1 <= val2) ? val2 : val1;
}
/// Returns the larger of two 32-bit unsigned integers.
/// Parameter or , whichever is larger.
/// The first of two 32-bit unsigned integers to compare.
/// The second of two 32-bit unsigned integers to compare.
/// 1
// Token: 0x06003F13 RID: 16147 RVA: 0x000D5754 File Offset: 0x000D3954
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[CLSCompliant(false)]
public static uint Max(uint val1, uint val2)
{
return (val1 <= val2) ? val2 : val1;
}
/// Returns the larger of two 64-bit unsigned integers.
/// Parameter or , whichever is larger.
/// The first of two 64-bit unsigned integers to compare.
/// The second of two 64-bit unsigned integers to compare.
/// 1
// Token: 0x06003F14 RID: 16148 RVA: 0x000D5764 File Offset: 0x000D3964
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[CLSCompliant(false)]
public static ulong Max(ulong val1, ulong val2)
{
return (val1 <= val2) ? val2 : val1;
}
/// Returns the larger of two 16-bit unsigned integers.
/// Parameter or , whichever is larger.
/// The first of two 16-bit unsigned integers to compare.
/// The second of two 16-bit unsigned integers to compare.
/// 1
// Token: 0x06003F15 RID: 16149 RVA: 0x000D5774 File Offset: 0x000D3974
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[CLSCompliant(false)]
public static ushort Max(ushort val1, ushort val2)
{
return (val1 <= val2) ? val2 : val1;
}
/// Returns the smaller of two 8-bit unsigned integers.
/// Parameter or , whichever is smaller.
/// The first of two 8-bit unsigned integers to compare.
/// The second of two 8-bit unsigned integers to compare.
/// 1
// Token: 0x06003F16 RID: 16150 RVA: 0x000D5784 File Offset: 0x000D3984
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static byte Min(byte val1, byte val2)
{
return (val1 >= val2) ? val2 : val1;
}
/// Returns the smaller of two decimal numbers.
/// Parameter or , whichever is smaller.
/// The first of two numbers to compare.
/// The second of two numbers to compare.
/// 1
// Token: 0x06003F17 RID: 16151 RVA: 0x000D5794 File Offset: 0x000D3994
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static decimal Min(decimal val1, decimal val2)
{
return (!(val1 < val2)) ? val2 : val1;
}
/// Returns the smaller of two double-precision floating-point numbers.
/// Parameter or , whichever is smaller. If , , or both and are equal to , is returned.
/// The first of two double-precision floating-point numbers to compare.
/// The second of two double-precision floating-point numbers to compare.
/// 1
// Token: 0x06003F18 RID: 16152 RVA: 0x000D57AC File Offset: 0x000D39AC
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static double Min(double val1, double val2)
{
if (double.IsNaN(val1) || double.IsNaN(val2))
{
return double.NaN;
}
return (val1 >= val2) ? val2 : val1;
}
/// Returns the smaller of two single-precision floating-point numbers.
/// Parameter or , whichever is smaller. If , , or both and are equal to , is returned.
/// The first of two single-precision floating-point numbers to compare.
/// The second of two single-precision floating-point numbers to compare.
/// 1
// Token: 0x06003F19 RID: 16153 RVA: 0x000D57E8 File Offset: 0x000D39E8
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static float Min(float val1, float val2)
{
if (float.IsNaN(val1) || float.IsNaN(val2))
{
return float.NaN;
}
return (val1 >= val2) ? val2 : val1;
}
/// Returns the smaller of two 32-bit signed integers.
/// Parameter or , whichever is smaller.
/// The first of two 32-bit signed integers to compare.
/// The second of two 32-bit signed integers to compare.
/// 1
// Token: 0x06003F1A RID: 16154 RVA: 0x000D5820 File Offset: 0x000D3A20
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static int Min(int val1, int val2)
{
return (val1 >= val2) ? val2 : val1;
}
/// Returns the smaller of two 64-bit signed integers.
/// Parameter or , whichever is smaller.
/// The first of two 64-bit signed integers to compare.
/// The second of two 64-bit signed integers to compare.
/// 1
// Token: 0x06003F1B RID: 16155 RVA: 0x000D5830 File Offset: 0x000D3A30
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static long Min(long val1, long val2)
{
return (val1 >= val2) ? val2 : val1;
}
/// Returns the smaller of two 8-bit signed integers.
/// Parameter or , whichever is smaller.
/// The first of two 8-bit signed integers to compare.
/// The second of two 8-bit signed integers to compare.
/// 1
// Token: 0x06003F1C RID: 16156 RVA: 0x000D5840 File Offset: 0x000D3A40
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[CLSCompliant(false)]
public static sbyte Min(sbyte val1, sbyte val2)
{
return ((int)val1 >= (int)val2) ? val2 : val1;
}
/// Returns the smaller of two 16-bit signed integers.
/// Parameter or , whichever is smaller.
/// The first of two 16-bit signed integers to compare.
/// The second of two 16-bit signed integers to compare.
/// 1
// Token: 0x06003F1D RID: 16157 RVA: 0x000D5854 File Offset: 0x000D3A54
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static short Min(short val1, short val2)
{
return (val1 >= val2) ? val2 : val1;
}
/// Returns the smaller of two 32-bit unsigned integers.
/// Parameter or , whichever is smaller.
/// The first of two 32-bit unsigned integers to compare.
/// The second of two 32-bit unsigned integers to compare.
/// 1
// Token: 0x06003F1E RID: 16158 RVA: 0x000D5864 File Offset: 0x000D3A64
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[CLSCompliant(false)]
public static uint Min(uint val1, uint val2)
{
return (val1 >= val2) ? val2 : val1;
}
/// Returns the smaller of two 64-bit unsigned integers.
/// Parameter or , whichever is smaller.
/// The first of two 64-bit unsigned integers to compare.
/// The second of two 64-bit unsigned integers to compare.
/// 1
// Token: 0x06003F1F RID: 16159 RVA: 0x000D5874 File Offset: 0x000D3A74
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[CLSCompliant(false)]
public static ulong Min(ulong val1, ulong val2)
{
return (val1 >= val2) ? val2 : val1;
}
/// Returns the smaller of two 16-bit unsigned integers.
/// Parameter or , whichever is smaller.
/// The first of two 16-bit unsigned integers to compare.
/// The second of two 16-bit unsigned integers to compare.
/// 1
// Token: 0x06003F20 RID: 16160 RVA: 0x000D5884 File Offset: 0x000D3A84
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[CLSCompliant(false)]
public static ushort Min(ushort val1, ushort val2)
{
return (val1 >= val2) ? val2 : val1;
}
/// Rounds a decimal value to the nearest integral value.
/// The integer nearest parameter . If the fractional component of is halfway between two integers, one of which is even and the other odd, the even number is returned. Note that this method returns a instead of an integral type.
/// A decimal number to be rounded.
/// The result is outside the range of a .
/// 1
// Token: 0x06003F21 RID: 16161 RVA: 0x000D5894 File Offset: 0x000D3A94
public static decimal Round(decimal d)
{
decimal num = decimal.Floor(d);
decimal num2 = d - num;
if ((num2 == 0.5m && 2.0m * (num / 2.0m - decimal.Floor(num / 2.0m)) != 0m) || num2 > 0.5m)
{
num += 1m;
}
return num;
}
/// Rounds a decimal value to a specified number of fractional digits.
/// The number nearest to that contains a number of fractional digits equal to .
/// A decimal number to be rounded.
/// The number of decimal places in the return value.
///
/// is less than 0 or greater than 28.
/// The result is outside the range of a .
/// 1
// Token: 0x06003F22 RID: 16162 RVA: 0x000D5930 File Offset: 0x000D3B30
public static decimal Round(decimal d, int decimals)
{
return decimal.Round(d, decimals);
}
/// 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 nearest . If is halfway between two numbers, one of which is even and the other odd, then determines which of the two is returned.
/// A decimal number to be rounded.
/// Specification for how to round if it is midway between two other numbers.
///
/// is not a valid value of .
/// The result is outside the range of a .
/// 1
// Token: 0x06003F23 RID: 16163 RVA: 0x000D593C File Offset: 0x000D3B3C
public static decimal Round(decimal d, 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 (mode == MidpointRounding.ToEven)
{
return Math.Round(d);
}
return Math.RoundAwayFromZero(d);
}
// Token: 0x06003F24 RID: 16164 RVA: 0x000D598C File Offset: 0x000D3B8C
private static decimal RoundAwayFromZero(decimal d)
{
decimal num = decimal.Floor(d);
decimal num2 = d - num;
if (num >= 0m && num2 >= 0.5m)
{
num += 1m;
}
else if (num < 0m && num2 > 0.5m)
{
num += 1m;
}
return num;
}
/// Rounds a decimal value to a specified number of fractional digits. A parameter specifies how to round the value if it is midway between two other numbers.
/// The number nearest to that contains a number of fractional digits equal to . If the number of fractional digits in is less than , is returned unchanged.
/// A decimal number to be rounded.
/// The number of decimal places in the return value.
/// Specification for how to round if it is midway between two other numbers.
///
/// is less than 0 or greater than 28.
///
/// is not a valid value of .
/// The result is outside the range of a .
/// 1
// Token: 0x06003F25 RID: 16165 RVA: 0x000D5A08 File Offset: 0x000D3C08
public static decimal Round(decimal d, int decimals, MidpointRounding mode)
{
return decimal.Round(d, decimals, mode);
}
/// Rounds a double-precision floating-point value to the nearest integral value.
/// The integer nearest . If the fractional component of is halfway between two integers, one of which is even and the other odd, then the even number is returned. Note that this method returns a instead of an integral type.
/// A double-precision floating-point number to be rounded.
/// 1
// Token: 0x06003F26 RID: 16166
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Round(double a);
/// Rounds a double-precision floating-point value to a specified number of fractional digits.
/// The number nearest to that contains a number of fractional digits equal to .
/// A double-precision floating-point number to be rounded.
/// The number of fractional digits in the return value.
///
/// is less than 0 or greater than 15.
/// 1
// Token: 0x06003F27 RID: 16167 RVA: 0x000D5A14 File Offset: 0x000D3C14
public static double Round(double value, int digits)
{
if (digits < 0 || digits > 15)
{
throw new ArgumentOutOfRangeException(Locale.GetText("Value is too small or too big."));
}
return Math.Round2(value, digits, false);
}
// Token: 0x06003F28 RID: 16168
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern double Round2(double value, int digits, bool away_from_zero);
/// Rounds a double-precision floating-point value to the nearest integer. A parameter specifies how to round the value if it is midway between two other numbers.
/// The integer nearest . If is halfway between two integers, one of which is even and the other odd, then determines which of the two is returned.
/// A double-precision floating-point number to be rounded.
/// Specification for how to round if it is midway between two other numbers.
///
/// is not a valid value of .
/// 1
// Token: 0x06003F29 RID: 16169 RVA: 0x000D5A40 File Offset: 0x000D3C40
public static double Round(double value, 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 (mode == MidpointRounding.ToEven)
{
return Math.Round(value);
}
if (value > 0.0)
{
return Math.Floor(value + 0.5);
}
return Math.Ceiling(value - 0.5);
}
/// Rounds a double-precision floating-point value to the specified number of fractional digits. A parameter specifies how to round the value if it is midway between two other numbers.
/// The number nearest to that has a number of fractional digits equal to . If the number of fractional digits in is less than , is returned unchanged.
/// A double-precision floating-point number to be rounded.
/// The number of fractional digits in the return value.
/// Specification for how to round if it is midway between two other numbers.
///
/// is less than 0 or greater than 15.
///
/// is not a valid value of .
/// 1
// Token: 0x06003F2A RID: 16170 RVA: 0x000D5AB8 File Offset: 0x000D3CB8
public static double Round(double value, int digits, 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 (mode == MidpointRounding.ToEven)
{
return Math.Round(value, digits);
}
return Math.Round2(value, digits, true);
}
/// Calculates the integral part of a specified double-precision floating-point number.
/// The integral part of ; that is, the number that remains after any fractional digits have been discarded, or one of the values listed in the following table. Return value
/// A number to truncate.
/// 1
// Token: 0x06003F2B RID: 16171 RVA: 0x000D5B08 File Offset: 0x000D3D08
public static double Truncate(double d)
{
if (d > 0.0)
{
return Math.Floor(d);
}
if (d < 0.0)
{
return Math.Ceiling(d);
}
return d;
}
/// Calculates the integral part of a specified decimal number.
/// The integral part of ; that is, the number that remains after any fractional digits have been discarded.
/// A number to truncate.
/// 1
// Token: 0x06003F2C RID: 16172 RVA: 0x000D5B38 File Offset: 0x000D3D38
public static decimal Truncate(decimal d)
{
return decimal.Truncate(d);
}
/// Returns the largest integer less than or equal to the specified decimal number.
/// The largest integer less than or equal to .
/// A decimal number.
/// 1
// Token: 0x06003F2D RID: 16173 RVA: 0x000D5B40 File Offset: 0x000D3D40
public static decimal Floor(decimal d)
{
return decimal.Floor(d);
}
/// Returns a value indicating the sign of a decimal number.
/// A number indicating the sign of .Number Description -1 is less than zero. 0 is equal to zero. 1 is greater than zero.
/// A signed number.
/// 1
// Token: 0x06003F2E RID: 16174 RVA: 0x000D5B48 File Offset: 0x000D3D48
public static int Sign(decimal value)
{
if (value > 0m)
{
return 1;
}
return (!(value == 0m)) ? (-1) : 0;
}
/// Returns a value indicating the sign of a double-precision floating-point number.
/// A number indicating the sign of .Number Description -1 is less than zero. 0 is equal to zero. 1 is greater than zero.
/// A signed number.
///
/// is equal to .
/// 1
// Token: 0x06003F2F RID: 16175 RVA: 0x000D5B78 File Offset: 0x000D3D78
public static int Sign(double value)
{
if (double.IsNaN(value))
{
throw new ArithmeticException("NAN");
}
if (value > 0.0)
{
return 1;
}
return (value != 0.0) ? (-1) : 0;
}
/// Returns a value indicating the sign of a single-precision floating-point number.
/// A number indicating the sign of .Number Description -1 is less than zero. 0 is equal to zero. 1 is greater than zero.
/// A signed number.
///
/// is equal to .
/// 1
// Token: 0x06003F30 RID: 16176 RVA: 0x000D5BB8 File Offset: 0x000D3DB8
public static int Sign(float value)
{
if (float.IsNaN(value))
{
throw new ArithmeticException("NAN");
}
if (value > 0f)
{
return 1;
}
return (value != 0f) ? (-1) : 0;
}
/// Returns a value indicating the sign of a 32-bit signed integer.
/// A number indicating the sign of .Number Description -1 is less than zero. 0 is equal to zero. 1 is greater than zero.
/// A signed number.
/// 1
// Token: 0x06003F31 RID: 16177 RVA: 0x000D5BF0 File Offset: 0x000D3DF0
public static int Sign(int value)
{
if (value > 0)
{
return 1;
}
return (value != 0) ? (-1) : 0;
}
/// Returns a value indicating the sign of a 64-bit signed integer.
/// A number indicating the sign of .Number Description -1 is less than zero. 0 is equal to zero. 1 is greater than zero.
/// A signed number.
/// 1
// Token: 0x06003F32 RID: 16178 RVA: 0x000D5C08 File Offset: 0x000D3E08
public static int Sign(long value)
{
if (value > 0L)
{
return 1;
}
return (value != 0L) ? (-1) : 0;
}
/// Returns a value indicating the sign of an 8-bit signed integer.
/// A number indicating the sign of .Number Description -1 is less than zero. 0 is equal to zero. 1 is greater than zero.
/// A signed number.
/// 1
// Token: 0x06003F33 RID: 16179 RVA: 0x000D5C24 File Offset: 0x000D3E24
[CLSCompliant(false)]
public static int Sign(sbyte value)
{
if ((int)value > 0)
{
return 1;
}
return ((int)value != 0) ? (-1) : 0;
}
/// Returns a value indicating the sign of a 16-bit signed integer.
/// A number indicating the sign of .Number Description -1 is less than zero. 0 is equal to zero. 1 is greater than zero.
/// A signed number.
/// 1
// Token: 0x06003F34 RID: 16180 RVA: 0x000D5C40 File Offset: 0x000D3E40
public static int Sign(short value)
{
if (value > 0)
{
return 1;
}
return (value != 0) ? (-1) : 0;
}
/// Returns the sine of the specified angle.
/// The sine of . If is equal to , , or , this method returns .
/// An angle, measured in radians.
/// 1
// Token: 0x06003F35 RID: 16181
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Sin(double a);
/// Returns the cosine of the specified angle.
/// The cosine of . If is equal to , , or , this method returns .
/// An angle, measured in radians.
/// 1
// Token: 0x06003F36 RID: 16182
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Cos(double d);
/// Returns the tangent of the specified angle.
/// The tangent of . If is equal to , , or , this method returns .
/// An angle, measured in radians.
/// 1
// Token: 0x06003F37 RID: 16183
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Tan(double a);
/// Returns the hyperbolic sine of the specified angle.
/// The hyperbolic sine of . If is equal to , , or , this method returns a equal to .
/// An angle, measured in radians.
/// 1
// Token: 0x06003F38 RID: 16184
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Sinh(double value);
/// Returns the hyperbolic cosine of the specified angle.
/// The hyperbolic cosine of . If is equal to or , is returned. If is equal to , is returned.
/// An angle, measured in radians.
/// 1
// Token: 0x06003F39 RID: 16185
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Cosh(double value);
/// Returns the hyperbolic tangent of the specified angle.
/// The hyperbolic tangent of . If is equal to , this method returns -1. If value is equal to , this method returns 1. If is equal to , this method returns .
/// An angle, measured in radians.
/// 1
// Token: 0x06003F3A RID: 16186
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Tanh(double value);
/// Returns the angle whose cosine is the specified number.
/// An angle, θ, measured in radians, such that 0 ≤θ≤π-or- if < -1 or > 1 or equals .
/// A number representing a cosine, where must be greater than or equal to -1, but less than or equal to 1.
/// 1
// Token: 0x06003F3B RID: 16187
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Acos(double d);
/// Returns the angle whose sine is the specified number.
/// An angle, θ, measured in radians, such that -π/2 ≤θ≤π/2 -or- if < -1 or > 1 or equals .
/// A number representing a sine, where must be greater than or equal to -1.
/// 1
// Token: 0x06003F3C RID: 16188
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Asin(double d);
/// Returns the angle whose tangent is the specified number.
/// An angle, θ, measured in radians, such that -π/2 ≤θ≤π/2.-or- if equals , -π/2 rounded to double precision (-1.5707963267949) if equals , or π/2 rounded to double precision (1.5707963267949) if equals .
/// A number representing a tangent.
/// 1
// Token: 0x06003F3D RID: 16189
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Atan(double d);
/// Returns the angle whose tangent is the quotient of two specified numbers.
/// An angle, θ, measured in radians, such that -π≤θ≤π, and tan(θ) = / , where (, ) is a point in the Cartesian plane. Observe the following: For (, ) in quadrant 1, 0 < θ < π/2.For (, ) in quadrant 2, π/2 < θ≤π.For (, ) in quadrant 3, -π < θ < -π/2.For (, ) in quadrant 4, -π/2 < θ < 0.For points on the boundaries of the quadrants, the return value is the following:If y is 0 and x is not negative, θ = 0.If y is 0 and x is negative, θ = π.If y is positive and x is 0, θ = π/2.If y is negative and x is 0, θ = -π/2.If or is , or if and are either or , the method returns .
/// The y coordinate of a point.
/// The x coordinate of a point.
/// 1
// Token: 0x06003F3E RID: 16190
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Atan2(double y, double x);
/// Returns e raised to the specified power.
/// The number e raised to the power . If equals or , that value is returned. If equals , 0 is returned.
/// A number specifying a power.
/// 1
// Token: 0x06003F3F RID: 16191
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Exp(double d);
/// Returns the natural (base e) logarithm of a specified number.
/// Sign of Returns Positive The natural logarithm of ; that is, ln , or log eZero Negative If is equal to , returns . If is equal to , returns .
/// A number whose logarithm is to be found.
/// 1
// Token: 0x06003F40 RID: 16192
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Log(double d);
/// Returns the base 10 logarithm of a specified number.
/// Sign of Returns Positive The base 10 log of ; that is, log 10. Zero Negative If is equal to , this method returns . If is equal to , this method returns .
/// A number whose logarithm is to be found.
/// 1
// Token: 0x06003F41 RID: 16193
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Log10(double d);
/// Returns a specified number raised to the specified power.
/// The number raised to the power .
/// A double-precision floating-point number to be raised to a power.
/// A double-precision floating-point number that specifies a power.
/// 1
// Token: 0x06003F42 RID: 16194
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Pow(double x, double y);
/// Returns the square root of a specified number.
/// Value of Returns Zero, or positive The positive square root of . Negative If is equal to or , that value is returned.
/// A number.
/// 1
// Token: 0x06003F43 RID: 16195
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Sqrt(double d);
/// Represents the natural logarithmic base, specified by the constant, e.
/// 1
// Token: 0x0400192A RID: 6442
public const double E = 2.718281828459045;
/// Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π.
/// 1
// Token: 0x0400192B RID: 6443
public const double PI = 3.141592653589793;
}
}