Method Sign
- Namespace
- Zyl.VectorTraits.Numerics
- Assembly
- VectorTraits.dll
Sign(float)
Computes the sign of a value (计算值的符号).
public static int Sign(float value)
Parameters
value
floatThe value whose sign is to be computed (要计算其符号的值)
Returns
- int
Returns 1 if the value is positive, 0 if the value is zero, and -1 if the value is negative (值为正数时返回1, 值为0时返回0, 值为负数时返回-1).
Remarks
No exception is thrown. For the NaN
of float types, returns 0.(不会抛出异常. 对于浮点类型的 NaN
, 会返回0).
But Sign_Bcl behaves differently. Throws an exception for the NaN
of float types (而 Sign_Bcl 的行为有所不同. 对于浮点类型的 NaN
, 会抛出异常): System.ArithmeticException: Function does not accept floating point Not-a-Number values.
- See Also
-
Sign(TSelf)
Sign(double)
Computes the sign of a value (计算值的符号).
public static int Sign(double value)
Parameters
value
doubleThe value whose sign is to be computed (要计算其符号的值)
Returns
- int
Returns 1 if the value is positive, 0 if the value is zero, and -1 if the value is negative (值为正数时返回1, 值为0时返回0, 值为负数时返回-1).
Remarks
No exception is thrown. For the NaN
of float types, returns 0.(不会抛出异常. 对于浮点类型的 NaN
, 会返回0).
But Sign_Bcl behaves differently. Throws an exception for the NaN
of float types (而 Sign_Bcl 的行为有所不同. 对于浮点类型的 NaN
, 会抛出异常): System.ArithmeticException: Function does not accept floating point Not-a-Number values.
- See Also
-
Sign(TSelf)
Sign(Half)
Computes the sign of a value (计算值的符号).
public static int Sign(Half value)
Parameters
value
HalfThe value whose sign is to be computed (要计算其符号的值)
Returns
- int
Returns 1 if the value is positive, 0 if the value is zero, and -1 if the value is negative (值为正数时返回1, 值为0时返回0, 值为负数时返回-1).
Remarks
No exception is thrown. For the NaN
of float types, returns 0.(不会抛出异常. 对于浮点类型的 NaN
, 会返回0).
But Sign_Bcl behaves differently. Throws an exception for the NaN
of float types (而 Sign_Bcl 的行为有所不同. 对于浮点类型的 NaN
, 会抛出异常): System.ArithmeticException: Function does not accept floating point Not-a-Number values.
- See Also
-
Sign(TSelf)
Sign(sbyte)
Computes the sign of a value (计算值的符号).
[CLSCompliant(false)]
public static int Sign(sbyte value)
Parameters
value
sbyteThe value whose sign is to be computed (要计算其符号的值)
Returns
- int
Returns 1 if the value is positive, 0 if the value is zero, and -1 if the value is negative (值为正数时返回1, 值为0时返回0, 值为负数时返回-1).
Remarks
No exception is thrown. For the NaN
of float types, returns 0.(不会抛出异常. 对于浮点类型的 NaN
, 会返回0).
But Sign_Bcl behaves differently. Throws an exception for the NaN
of float types (而 Sign_Bcl 的行为有所不同. 对于浮点类型的 NaN
, 会抛出异常): System.ArithmeticException: Function does not accept floating point Not-a-Number values.
- See Also
-
Sign(TSelf)
Sign(short)
Computes the sign of a value (计算值的符号).
public static int Sign(short value)
Parameters
value
shortThe value whose sign is to be computed (要计算其符号的值)
Returns
- int
Returns 1 if the value is positive, 0 if the value is zero, and -1 if the value is negative (值为正数时返回1, 值为0时返回0, 值为负数时返回-1).
Remarks
No exception is thrown. For the NaN
of float types, returns 0.(不会抛出异常. 对于浮点类型的 NaN
, 会返回0).
But Sign_Bcl behaves differently. Throws an exception for the NaN
of float types (而 Sign_Bcl 的行为有所不同. 对于浮点类型的 NaN
, 会抛出异常): System.ArithmeticException: Function does not accept floating point Not-a-Number values.
- See Also
-
Sign(TSelf)
Sign(int)
Computes the sign of a value (计算值的符号).
public static int Sign(int value)
Parameters
value
intThe value whose sign is to be computed (要计算其符号的值)
Returns
- int
Returns 1 if the value is positive, 0 if the value is zero, and -1 if the value is negative (值为正数时返回1, 值为0时返回0, 值为负数时返回-1).
Remarks
No exception is thrown. For the NaN
of float types, returns 0.(不会抛出异常. 对于浮点类型的 NaN
, 会返回0).
But Sign_Bcl behaves differently. Throws an exception for the NaN
of float types (而 Sign_Bcl 的行为有所不同. 对于浮点类型的 NaN
, 会抛出异常): System.ArithmeticException: Function does not accept floating point Not-a-Number values.
- See Also
-
Sign(TSelf)
Sign(long)
Computes the sign of a value (计算值的符号).
public static int Sign(long value)
Parameters
value
longThe value whose sign is to be computed (要计算其符号的值)
Returns
- int
Returns 1 if the value is positive, 0 if the value is zero, and -1 if the value is negative (值为正数时返回1, 值为0时返回0, 值为负数时返回-1).
Remarks
No exception is thrown. For the NaN
of float types, returns 0.(不会抛出异常. 对于浮点类型的 NaN
, 会返回0).
But Sign_Bcl behaves differently. Throws an exception for the NaN
of float types (而 Sign_Bcl 的行为有所不同. 对于浮点类型的 NaN
, 会抛出异常): System.ArithmeticException: Function does not accept floating point Not-a-Number values.
- See Also
-
Sign(TSelf)