Table of Contents

Class BitMath

Namespace
Zyl.VectorTraits
Assembly
VectorTraits.dll

Provides constants and static methods for binary operations, and other common mathematical functions (为二进制运算和其他通用数学函数提供常数和静态方法).

public abstract class BitMath : BitMathCore
Inheritance
BitMath
Inherited Members

Remarks

It contains functions from Math/BitConverter, and generic math interfaces such as INumber. For math functions in classes such as BitOperations, you can use the classes (它包含了 Math/BitConverter, 与 INumber 等泛型数学接口中的函数. 而对于 BitOperations 等类中的数学函数, 可使用这些类):

Methods

Abs(short)

Returns the absolute value of a 16-bit signed integer (返回 16 位有符号整数的绝对值). No exception, Abs(MinValue) := MinValue .

Abs(int)

Returns the absolute value of a 32-bit signed integer (返回 32 位有符号整数的绝对值). No exception, Abs(MinValue) := MinValue .

Abs(long)

Returns the absolute value of a 64-bit signed integer (返回 64 位有符号整数的绝对值). No exception, Abs(MinValue) := MinValue .

Abs(nint)

Returns the absolute value of a native signed integer (返回本机有符号整数的绝对值). No exception, Abs(MinValue) := MinValue .

Abs(sbyte)

Returns the absolute value of a 8-bit signed integer (返回 8 位有符号整数的绝对值). No exception, Abs(MinValue) := MinValue .

BigMul(long, long, out long)

Produces the full product of two signed 64-bit numbers (生成两个有符号 64 位数的完整乘积).

BigMul(ulong, ulong, out ulong)

Produces the full product of two unsigned 64-bit numbers (生成两个无符号 64 位数的完整乘积).

BigMulHigh(long, long)

Computes the product of two signed 64-bit numbers and returns the higher 64 bits (计算两个有符号 64 位数的乘积,并返回较高的64位).

BigMulHigh(ulong, ulong)

Computes the product of two unsigned 64-bit numbers and returns the higher 64 bits (计算两个无符号 64 位数的乘积,并返回较高的64位).

BigMulLow(long, long)

Computes the product of two signed 64-bit numbers and returns the lower 64 bits (计算两个有符号 64 位数的乘积,并返回较低的64位).

BigMulLow(ulong, ulong)

Computes the product of two unsigned 64-bit numbers and returns the lower 64 bits (计算两个无符号 64 位数的乘积,并返回较低的64位).

BigMul_BigNum(long, long, out long)

Produces the full product of two signed 64-bit numbers - BigNum (生成两个有符号 64 位数的完整乘积 - 大数算法).

BigMul_BigNum(ulong, ulong, out ulong)

Produces the full product of two unsigned 64-bit numbers - BigNum (生成两个无符号 64 位数的完整乘积 - 大数算法).

BigMul_Two(long, long, out long)

Produces the full product of two signed 64-bit numbers - Two word (生成两个有符号 64 位数的完整乘积 - 双字).

BigMul_Two(ulong, ulong, out ulong)

Produces the full product of two unsigned 64-bit numbers - Two word (生成两个无符号 64 位数的完整乘积 - 双字).

BigNumMultiplySigned(Span<uint>, ReadOnlySpan<uint>, ReadOnlySpan<uint>)

Produces the full product of signed big numbers (产生有符号大数字的完整乘积) (w = u * v). Use little endian to store (使用小端存储).

BigNumMultiplyUnsigned(Span<uint>, ReadOnlySpan<uint>, ReadOnlySpan<uint>)

Produces the full product of unsigned big numbers (产生无符号大数字的完整乘积) (w = u * v). Use little endian to store (使用小端存储).

Clamp(byte, byte, byte)

Returns value clamped to the inclusive range of amin and amax (返回限制在 aminamax 范围内的 value).

Clamp(double, double, double)

Returns value clamped to the inclusive range of amin and amax (返回限制在 aminamax 范围内的 value).

Clamp(Half, Half, Half)

Returns value clamped to the inclusive range of amin and amax (返回限制在 aminamax 范围内的 value).

Clamp(short, short, short)

Returns value clamped to the inclusive range of amin and amax (返回限制在 aminamax 范围内的 value).

Clamp(int, int, int)

Returns value clamped to the inclusive range of amin and amax (返回限制在 aminamax 范围内的 value).

Clamp(long, long, long)

Returns value clamped to the inclusive range of amin and amax (返回限制在 aminamax 范围内的 value).

Clamp(nint, nint, nint)

Returns value clamped to the inclusive range of amin and amax (返回限制在 aminamax 范围内的 value).

Clamp(sbyte, sbyte, sbyte)

Returns value clamped to the inclusive range of amin and amax (返回限制在 aminamax 范围内的 value).

Clamp(float, float, float)

Returns value clamped to the inclusive range of amin and amax (返回限制在 aminamax 范围内的 value).

Clamp(ushort, ushort, ushort)

Returns value clamped to the inclusive range of amin and amax (返回限制在 aminamax 范围内的 value).

Clamp(uint, uint, uint)

Returns value clamped to the inclusive range of amin and amax (返回限制在 aminamax 范围内的 value).

Clamp(ulong, ulong, ulong)

Returns value clamped to the inclusive range of amin and amax (返回限制在 aminamax 范围内的 value).

Clamp(nuint, nuint, nuint)

Returns value clamped to the inclusive range of amin and amax (返回限制在 aminamax 范围内的 value).

CopySign(double, double)

Copies the sign of a value to the sign of another value (将一个值的符号复制到另一个值).

CopySign(Half, Half)

Copies the sign of a value to the sign of another value (将一个值的符号复制到另一个值).

CopySign(short, short)

Copies the sign of a value to the sign of another value (将一个值的符号复制到另一个值).

CopySign(int, int)

Copies the sign of a value to the sign of another value (将一个值的符号复制到另一个值).

CopySign(long, long)

Copies the sign of a value to the sign of another value (将一个值的符号复制到另一个值).

CopySign(sbyte, sbyte)

Copies the sign of a value to the sign of another value (将一个值的符号复制到另一个值).

CopySign(float, float)

Copies the sign of a value to the sign of another value (将一个值的符号复制到另一个值).

DivRem(byte, byte)

Produces the quotient and the remainder of two unsigned 8-bit numbers (生成两个 无符号8位数字 的商和余数).

DivRem(short, short)

Produces the quotient and the remainder of two signed 16-bit numbers (生成两个 有符号16位数字 的商和余数).

DivRem(int, int)

Produces the quotient and the remainder of two signed 32-bit numbers (生成两个 有符号32位数字 的商和余数).

DivRem(int, int, out int)

Calculates the quotient of two 32-bit signed integers and also returns the remainder in an output parameter (计算两个 32 位有符号整数的商,并通过输出参数返回余数).

DivRem(long, long)

Produces the quotient and the remainder of two signed 64-bit numbers (生成两个 有符号64位数字 的商和余数).

DivRem(long, long, out long)

Calculates the quotient of two 64-bit signed integers and also returns the remainder in an output parameter (计算两个 32 位有符号整数的商,并通过输出参数返回余数).

DivRem(sbyte, sbyte)

Produces the quotient and the remainder of two signed 8-bit numbers (生成两个 有符号8位数字 的商和余数).

DivRem(ushort, ushort)

Produces the quotient and the remainder of two unsigned 16-bit numbers (生成两个 无符号16位数字 的商和余数).

DivRem(uint, uint)

Produces the quotient and the remainder of two unsigned 32-bit numbers (生成两个 无符号32位数字 的商和余数).

DivRem(ulong, ulong)

Produces the quotient and the remainder of two unsigned 64-bit numbers (生成两个 无符号64位数字 的商和余数).

DoubleToInt64Bits(double)

Converts a double-precision floating-point value into a 64-bit integer (将单精度浮点值转换为 64 位整数).

DoubleToUInt64Bits(double)

Converts a double-precision floating-point value into a 64-bit unsigned integer (将指定的单精度浮点数转换为 64 位无符号整数).

HalfToInt16Bits(Half)

Converts a half-precision floating-point value into a 16-bit integer (将半精度浮点值转换为 16 位整数).

HalfToUInt16Bits(Half)

Converts a half-precision floating-point value into a 16-bit unsigned integer (将指定的半精度浮点数转换为 16 位无符号整数).

Int16BitsToHalf(short)

Reinterprets the specified 16-bit signed integer value as a half-precision floating-point value (将指定的 16 位有符号整数值重新解释为半精度浮点值).

Int32BitsToSingle(int)

Reinterprets the specified 32-bit signed integer value as a single-precision floating-point value (将指定的 32 位有符号整数值重新解释为单精度浮点值).

Int64BitsToDouble(long)

Reinterprets the specified 64-bit signed integer value as a double-precision floating-point value (将指定的 64 位有符号整数值重新解释为单精度浮点值).

IsEvenInteger(byte)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsEvenInteger(double)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsEvenInteger(Half)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsEvenInteger(short)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsEvenInteger(int)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsEvenInteger(long)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsEvenInteger(sbyte)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsEvenInteger(float)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsEvenInteger(ushort)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsEvenInteger(uint)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsEvenInteger(ulong)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsFinite(double)

Determines if a element is finite. It contains zero, subnormal, and normal. It does not contain infinity, NaN (确定元素是否为有限值. 它包含 零、次正规数、正规数. 它不含无穷大、非数).

IsFinite(Half)

Determines if a element is finite. It contains zero, subnormal, and normal. It does not contain infinity, NaN (确定元素是否为有限值. 它包含 零、次正规数、正规数. 它不含无穷大、非数).

IsFinite(float)

Determines if a element is finite. It contains zero, subnormal, and normal. It does not contain infinity, NaN (确定元素是否为有限值. 它包含 零、次正规数、正规数. 它不含无穷大、非数).

IsInfinity(double)

Determines if a element is negative or positive infinite (确定元素是否为负数或正数的无穷大).

IsInfinity(Half)

Determines if a element is negative or positive infinite (确定元素是否为负数或正数的无穷大).

IsInfinity(float)

Determines if a element is negative or positive infinite (确定元素是否为负数或正数的无穷大).

IsInfinityOrNaN(double)

Determines if a element is infinite or NaN (确定元素是否为无穷大或非数).

IsInfinityOrNaN(Half)

Determines if a element is infinite or NaN (确定元素是否为无穷大或非数).

IsInfinityOrNaN(float)

Determines if a element is infinite or NaN (确定元素是否为无穷大或非数).

IsInteger(double)

Determines if a element represents an integral number (确定元素是否为整数).

IsInteger(Half)

Determines if a element represents an integral number (确定元素是否为整数).

IsInteger(float)

Determines if a element represents an integral number (确定元素是否为整数).

IsNaN(double)

Determines if a element is NaN (确定元素是否为非数).

IsNaN(Half)

Determines if a element is NaN (确定元素是否为非数).

IsNaN(float)

Determines if a element is NaN (确定元素是否为非数).

IsNegative(double)

Determines if a element represents a negative number (确定元素是否为负数).

IsNegative(Half)

Determines if a element represents a negative number (确定元素是否为负数).

IsNegative(short)

Determines if a element represents a negative number (确定元素是否为负数).

IsNegative(int)

Determines if a element represents a negative number (确定元素是否为负数).

IsNegative(long)

Determines if a element represents a negative number (确定元素是否为负数).

IsNegative(sbyte)

Determines if a element represents a negative number (确定元素是否为负数).

IsNegative(float)

Determines if a element represents a negative number (确定元素是否为负数).

IsNegativeInfinity(double)

Determines if a element is negative infinity (确定元素是否为负无穷大).

IsNegativeInfinity(Half)

Determines if a element is negative infinity (确定元素是否为负无穷大).

IsNegativeInfinity(float)

Determines if a element is negative infinity (确定元素是否为负无穷大).

IsNegativeZero(double)

Determines if a element represents a negative zero (确定元素是否为负零).

IsNegativeZero(Half)

Determines if a element represents a negative zero (确定元素是否为负零).

IsNegativeZero(float)

Determines if a element represents a negative zero (确定元素是否为负零).

IsNormal(double)

Determines if a element is normal (确定元素是否为正规数).

IsNormal(Half)

Determines if a element is normal (确定元素是否为正规数).

IsNormal(float)

Determines if a element is normal (确定元素是否为正规数).

IsNotNaN(double)

Determines if a element is not NaN (确定元素是否不为非数).

IsNotNaN(Half)

Determines if a element is not NaN (确定元素是否不为非数).

IsNotNaN(float)

Determines if a element is not NaN (确定元素是否不为非数).

IsOddInteger(byte)

Determines if a element represents an odd integral number (确定元素是否为奇数整数).

IsOddInteger(double)

Determines if a element represents an odd integral number (确定元素是否为奇数整数).

IsOddInteger(Half)

Determines if a element represents an odd integral number (确定元素是否为奇数整数).

IsOddInteger(short)

Determines if a element represents an odd integral number (确定元素是否为奇数整数).

IsOddInteger(int)

Determines if a element represents an odd integral number (确定元素是否为奇数整数).

IsOddInteger(long)

Determines if a element represents an odd integral number (确定元素是否为奇数整数).

IsOddInteger(sbyte)

Determines if a element represents an odd integral number (确定元素是否为奇数整数).

IsOddInteger(float)

Determines if a element represents an odd integral number (确定元素是否为奇数整数).

IsOddInteger(ushort)

Determines if a element represents an odd integral number (确定元素是否为奇数整数).

IsOddInteger(uint)

Determines if a element represents an odd integral number (确定元素是否为奇数整数).

IsOddInteger(ulong)

Determines if a element represents an odd integral number (确定元素是否为奇数整数).

IsPositive(double)

Determines if a element represents zero or a positive number (确定元素是否为正零或正数).

IsPositive(Half)

Determines if a element represents zero or a positive number (确定元素是否为正零或正数).

IsPositive(short)

Determines if a element represents zero or a positive number (确定元素是否为正零或正数).

IsPositive(int)

Determines if a element represents zero or a positive number (确定元素是否为正零或正数).

IsPositive(long)

Determines if a element represents zero or a positive number (确定元素是否为正零或正数).

IsPositive(sbyte)

Determines if a element represents zero or a positive number (确定元素是否为正零或正数).

IsPositive(float)

Determines if a element represents zero or a positive number (确定元素是否为正零或正数).

IsPositiveInfinity(double)

Determines if a element is positive infinity (确定元素是否为正无穷大).

IsPositiveInfinity(Half)

Determines if a element is positive infinity (确定元素是否为正无穷大).

IsPositiveInfinity(float)

Determines if a element is positive infinity (确定元素是否为正无穷大).

IsSubnormal(double)

Determines if a element is subnormal (确定元素是否为次正规数).

IsSubnormal(Half)

Determines if a element is subnormal (确定元素是否为次正规数).

IsSubnormal(float)

Determines if a element is subnormal (确定元素是否为次正规数).

IsZero(byte)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsZero(double)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsZero(Half)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsZero(short)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsZero(int)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsZero(long)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsZero(sbyte)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsZero(float)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsZero(ushort)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsZero(uint)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsZero(ulong)

Determines if a element represents an even integral number (确定元素是否为偶数整数).

IsZeroOrSubnormal(double)

Determines if a element is subnormal (确定元素是否为次正规数).

IsZeroOrSubnormal(Half)

Determines if a element is subnormal (确定元素是否为次正规数).

IsZeroOrSubnormal(float)

Determines if a element is subnormal (确定元素是否为次正规数).

Max(byte, byte)

Get the larger of two variables (取得两个变量中较大的一个).

Max(double, double)

Get the larger of two variables (取得两个变量中较大的一个).

Max(Half, Half)

Get the larger of two variables (取得两个变量中较大的一个).

Max(Int128, Int128)

Get the larger of two variables (取得两个变量中较大的一个).

Max(short, short)

Get the larger of two variables (取得两个变量中较大的一个).

Max(int, int)

Get the larger of two variables (取得两个变量中较大的一个).

Max(long, long)

Get the larger of two variables (取得两个变量中较大的一个).

Max(nint, nint)

Get the larger of two variables (取得两个变量中较大的一个).

Max(sbyte, sbyte)

Get the larger of two variables (取得两个变量中较大的一个).

Max(float, float)

Get the larger of two variables (取得两个变量中较大的一个).

Max(UInt128, UInt128)

Get the larger of two variables (取得两个变量中较大的一个).

Max(ushort, ushort)

Get the larger of two variables (取得两个变量中较大的一个).

Max(uint, uint)

Get the larger of two variables (取得两个变量中较大的一个).

Max(ulong, ulong)

Get the larger of two variables (取得两个变量中较大的一个).

Max(nuint, nuint)

Get the larger of two variables (取得两个变量中较大的一个).

Max(ExInt128, ExInt128)

Get the larger of two variables (取得两个变量中较大的一个).

Max(ExUInt128, ExUInt128)

Get the larger of two variables (取得两个变量中较大的一个).

MaxNumber(double, double)

Compares two values to compute which is greater and returning the other value if an input is NaN (取得两个值中较大的数字. 若其中一个是NaN, 则会返回另一个值).

MaxNumber(Half, Half)

Compares two values to compute which is greater and returning the other value if an input is NaN (取得两个值中较大的数字. 若其中一个是NaN, 则会返回另一个值).

MaxNumber(float, float)

Compares two values to compute which is greater and returning the other value if an input is NaN (取得两个值中较大的数字. 若其中一个是NaN, 则会返回另一个值).

Min(byte, byte)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(double, double)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(Half, Half)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(Int128, Int128)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(short, short)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(int, int)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(long, long)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(nint, nint)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(sbyte, sbyte)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(float, float)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(UInt128, UInt128)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(ushort, ushort)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(uint, uint)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(ulong, ulong)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(nuint, nuint)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(ExInt128, ExInt128)

Get the smaller of two variables (取得两个变量中较小的一个).

Min(ExUInt128, ExUInt128)

Get the smaller of two variables (取得两个变量中较小的一个).

MinNumber(double, double)

Compares two values to compute which is lesser and returning the other value if an input is NaN (取得两个值中较小的数字. 若其中一个是NaN, 则会返回另一个值).

MinNumber(Half, Half)

Compares two values to compute which is lesser and returning the other value if an input is NaN (取得两个值中较小的数字. 若其中一个是NaN, 则会返回另一个值).

MinNumber(float, float)

Compares two values to compute which is lesser and returning the other value if an input is NaN (取得两个值中较小的数字. 若其中一个是NaN, 则会返回另一个值).

Sign(double)

Computes the sign of a value (计算值的符号).

Sign(Half)

Computes the sign of a value (计算值的符号).

Sign(short)

Computes the sign of a value (计算值的符号).

Sign(int)

Computes the sign of a value (计算值的符号).

Sign(long)

Computes the sign of a value (计算值的符号).

Sign(sbyte)

Computes the sign of a value (计算值的符号).

Sign(float)

Computes the sign of a value (计算值的符号).

SignFloat(double)

Computes the sign of a value and returns a floating point number (计算值的符号并返回浮点数).

SignFloat(Half)

Computes the sign of a value and returns a floating point number (计算值的符号并返回浮点数).

SignFloat(float)

Computes the sign of a value and returns a floating point number (计算值的符号并返回浮点数).

SingleToInt32Bits(float)

Converts a single-precision floating-point value into a 32-bit integer (将单精度浮点值转换为 32 位整数).

SingleToUInt32Bits(float)

Converts a single-precision floating-point value into a 32-bit unsigned integer (将指定的单精度浮点数转换为 32 位无符号整数).

Sqrt(byte)

Computes the square-root of a value (计算值的平方根). Mnemonic: Sqrt(x) = Pow(x, 1.0/2). When x is less than 0, floating-point types return NaN, integer types return 0.

Sqrt(double)

Computes the square-root of a value (计算值的平方根). Mnemonic: Sqrt(x) = Pow(x, 1.0/2). When x is less than 0, floating-point types return NaN, integer types return 0.

Sqrt(short)

Computes the square-root of a value (计算值的平方根). Mnemonic: Sqrt(x) = Pow(x, 1.0/2). When x is less than 0, floating-point types return NaN, integer types return 0.

Sqrt(int)

Computes the square-root of a value (计算值的平方根). Mnemonic: Sqrt(x) = Pow(x, 1.0/2). When x is less than 0, floating-point types return NaN, integer types return 0.

Sqrt(long)

Computes the square-root of a value (计算值的平方根). Mnemonic: Sqrt(x) = Pow(x, 1.0/2). When x is less than 0, floating-point types return NaN, integer types return 0.

Sqrt(sbyte)

Computes the square-root of a value (计算值的平方根). Mnemonic: Sqrt(x) = Pow(x, 1.0/2). When x is less than 0, floating-point types return NaN, integer types return 0.

Sqrt(float)

Computes the square-root of a value (计算值的平方根). Mnemonic: Sqrt(x) = Pow(x, 1.0/2). When x is less than 0, floating-point types return NaN, integer types return 0.

Sqrt(ushort)

Computes the square-root of a value (计算值的平方根). Mnemonic: Sqrt(x) = Pow(x, 1.0/2). When x is less than 0, floating-point types return NaN, integer types return 0.

Sqrt(uint)

Computes the square-root of a value (计算值的平方根). Mnemonic: Sqrt(x) = Pow(x, 1.0/2). When x is less than 0, floating-point types return NaN, integer types return 0.

Sqrt(ulong)

Computes the square-root of a value (计算值的平方根). Mnemonic: Sqrt(x) = Pow(x, 1.0/2). When x is less than 0, floating-point types return NaN, integer types return 0.

Truncate(double)

Computes the round to zero of value (计算值的向零舍入). It is also known as truncate (它也被称作截断取整). See more: ToZero.

Truncate(Half)

Computes the round to zero of value (计算值的向零舍入). It is also known as truncate (它也被称作截断取整). See more: ToZero.

Truncate(float)

Computes the round to zero of value (计算值的向零舍入). It is also known as truncate (它也被称作截断取整). See more: ToZero.

UInt16BitsToHalf(ushort)

Reinterprets the specified 16-bit unsigned integer value as a half-precision floating-point value (将指定的 16 位无符号整数转换为半精度浮点数).

UInt32BitsToSingle(uint)

Reinterprets the specified 32-bit unsigned integer value as a single-precision floating-point value (将指定的 32 位无符号整数转换为单精度浮点数).

UInt64BitsToDouble(ulong)

Reinterprets the specified 64-bit unsigned integer value as a double-precision floating-point value (将指定的 64 位无符号整数转换为单精度浮点数).

See Also