Method CopySign
- Namespace
- Zyl.VectorTraits.Numerics
- Assembly
- VectorTraits.dll
CopySign(float, float)
Copies the sign of a value to the sign of another value (将一个值的符号复制到另一个值).
public static float CopySign(float value, float sign)
Parameters
valuefloatThe value whose magnitude is used in the result (结果中使用的幅度).
signfloatThe value whose sign is used in the result (结果中使用符号的值).
Returns
- float
A value with the magnitude of value and the sign of sign (根据 value的幅度和sign的符号而生成的值).
Remarks
No exception is thrown. For the MinValue of integer types, the source value is returned.(不会抛出异常. 对于整数类型的 MinValue, 会返回源值).
But CopySign_Bcl behaves differently. Throws an exception for the MinValue of integer types (而 CopySign_Bcl 的行为有所不同. 对于整数类型的 MinValue, 会抛出异常): System.OverflowException : Negating the minimum value of a twos complement number is invalid.
- See Also
-
CopySign(TSelf, TSelf)
CopySign(double, double)
Copies the sign of a value to the sign of another value (将一个值的符号复制到另一个值).
public static double CopySign(double value, double sign)
Parameters
valuedoubleThe value whose magnitude is used in the result (结果中使用的幅度).
signdoubleThe value whose sign is used in the result (结果中使用符号的值).
Returns
- double
A value with the magnitude of value and the sign of sign (根据 value的幅度和sign的符号而生成的值).
Remarks
No exception is thrown. For the MinValue of integer types, the source value is returned.(不会抛出异常. 对于整数类型的 MinValue, 会返回源值).
But CopySign_Bcl behaves differently. Throws an exception for the MinValue of integer types (而 CopySign_Bcl 的行为有所不同. 对于整数类型的 MinValue, 会抛出异常): System.OverflowException : Negating the minimum value of a twos complement number is invalid.
- See Also
-
CopySign(TSelf, TSelf)
CopySign(Half, Half)
Copies the sign of a value to the sign of another value (将一个值的符号复制到另一个值).
public static Half CopySign(Half value, Half sign)
Parameters
valueHalfThe value whose magnitude is used in the result (结果中使用的幅度).
signHalfThe value whose sign is used in the result (结果中使用符号的值).
Returns
- Half
A value with the magnitude of value and the sign of sign (根据 value的幅度和sign的符号而生成的值).
Remarks
No exception is thrown. For the MinValue of integer types, the source value is returned.(不会抛出异常. 对于整数类型的 MinValue, 会返回源值).
But CopySign_Bcl behaves differently. Throws an exception for the MinValue of integer types (而 CopySign_Bcl 的行为有所不同. 对于整数类型的 MinValue, 会抛出异常): System.OverflowException : Negating the minimum value of a twos complement number is invalid.
- See Also
-
CopySign(TSelf, TSelf)
CopySign(sbyte, sbyte)
Copies the sign of a value to the sign of another value (将一个值的符号复制到另一个值).
[CLSCompliant(false)]
public static sbyte CopySign(sbyte value, sbyte sign)
Parameters
valuesbyteThe value whose magnitude is used in the result (结果中使用的幅度).
signsbyteThe value whose sign is used in the result (结果中使用符号的值).
Returns
- sbyte
A value with the magnitude of value and the sign of sign (根据 value的幅度和sign的符号而生成的值).
Remarks
No exception is thrown. For the MinValue of integer types, the source value is returned.(不会抛出异常. 对于整数类型的 MinValue, 会返回源值).
But CopySign_Bcl behaves differently. Throws an exception for the MinValue of integer types (而 CopySign_Bcl 的行为有所不同. 对于整数类型的 MinValue, 会抛出异常): System.OverflowException : Negating the minimum value of a twos complement number is invalid.
- See Also
-
CopySign(TSelf, TSelf)
CopySign(short, short)
Copies the sign of a value to the sign of another value (将一个值的符号复制到另一个值).
public static short CopySign(short value, short sign)
Parameters
valueshortThe value whose magnitude is used in the result (结果中使用的幅度).
signshortThe value whose sign is used in the result (结果中使用符号的值).
Returns
- short
A value with the magnitude of value and the sign of sign (根据 value的幅度和sign的符号而生成的值).
Remarks
No exception is thrown. For the MinValue of integer types, the source value is returned.(不会抛出异常. 对于整数类型的 MinValue, 会返回源值).
But CopySign_Bcl behaves differently. Throws an exception for the MinValue of integer types (而 CopySign_Bcl 的行为有所不同. 对于整数类型的 MinValue, 会抛出异常): System.OverflowException : Negating the minimum value of a twos complement number is invalid.
- See Also
-
CopySign(TSelf, TSelf)
CopySign(int, int)
Copies the sign of a value to the sign of another value (将一个值的符号复制到另一个值).
public static int CopySign(int value, int sign)
Parameters
valueintThe value whose magnitude is used in the result (结果中使用的幅度).
signintThe value whose sign is used in the result (结果中使用符号的值).
Returns
- int
A value with the magnitude of value and the sign of sign (根据 value的幅度和sign的符号而生成的值).
Remarks
No exception is thrown. For the MinValue of integer types, the source value is returned.(不会抛出异常. 对于整数类型的 MinValue, 会返回源值).
But CopySign_Bcl behaves differently. Throws an exception for the MinValue of integer types (而 CopySign_Bcl 的行为有所不同. 对于整数类型的 MinValue, 会抛出异常): System.OverflowException : Negating the minimum value of a twos complement number is invalid.
- See Also
-
CopySign(TSelf, TSelf)
CopySign(long, long)
Copies the sign of a value to the sign of another value (将一个值的符号复制到另一个值).
public static long CopySign(long value, long sign)
Parameters
valuelongThe value whose magnitude is used in the result (结果中使用的幅度).
signlongThe value whose sign is used in the result (结果中使用符号的值).
Returns
- long
A value with the magnitude of value and the sign of sign (根据 value的幅度和sign的符号而生成的值).
Remarks
No exception is thrown. For the MinValue of integer types, the source value is returned.(不会抛出异常. 对于整数类型的 MinValue, 会返回源值).
But CopySign_Bcl behaves differently. Throws an exception for the MinValue of integer types (而 CopySign_Bcl 的行为有所不同. 对于整数类型的 MinValue, 会抛出异常): System.OverflowException : Negating the minimum value of a twos complement number is invalid.
- See Also
-
CopySign(TSelf, TSelf)