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
value
floatThe value whose magnitude is used in the result (结果中使用的幅度).
sign
floatThe 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
value
doubleThe value whose magnitude is used in the result (结果中使用的幅度).
sign
doubleThe 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
value
HalfThe value whose magnitude is used in the result (结果中使用的幅度).
sign
HalfThe 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
value
sbyteThe value whose magnitude is used in the result (结果中使用的幅度).
sign
sbyteThe 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
value
shortThe value whose magnitude is used in the result (结果中使用的幅度).
sign
shortThe 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
value
intThe value whose magnitude is used in the result (结果中使用的幅度).
sign
intThe 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
value
longThe value whose magnitude is used in the result (结果中使用的幅度).
sign
longThe 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)