Table of Contents

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 float

The value whose magnitude is used in the result (结果中使用的幅度).

sign float

The 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 double

The value whose magnitude is used in the result (结果中使用的幅度).

sign double

The 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 Half

The value whose magnitude is used in the result (结果中使用的幅度).

sign Half

The 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 sbyte

The value whose magnitude is used in the result (结果中使用的幅度).

sign sbyte

The 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 short

The value whose magnitude is used in the result (结果中使用的幅度).

sign short

The 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 int

The value whose magnitude is used in the result (结果中使用的幅度).

sign int

The 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 long

The value whose magnitude is used in the result (结果中使用的幅度).

sign long

The 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)