Version: Unity 6.5 Alpha (6000.5)
LanguageEnglish
  • C#

math.sign

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static int sign(int x);

Parameters

Parameter Description
x Input value.

Returns

int The sign of the input.

Description

Returns the sign of a int value. -1 if it is less than zero, 0 if it is zero and 1 if it greater than zero.


Declaration

public static int2 sign(int2 x);

Parameters

Parameter Description
x Input value.

Returns

int2 The componentwise sign of the input.

Description

Returns the componentwise sign of a int2 value. 1 for positive components, 0 for zero components and -1 for negative components.


Declaration

public static int3 sign(int3 x);

Parameters

Parameter Description
x Input value.

Returns

int3 The componentwise sign of the input.

Description

Returns the componentwise sign of a int3 value. 1 for positive components, 0 for zero components and -1 for negative components.


Declaration

public static int4 sign(int4 x);

Parameters

Parameter Description
x Input value.

Returns

int4 The componentwise sign of the input.

Description

Returns the componentwise sign of a int4 value. 1 for positive components, 0 for zero components and -1 for negative components.


Declaration

public static float sign(float x);

Parameters

Parameter Description
x Input value.

Returns

float The sign of the input.

Description

Returns the sign of a float value. -1.0f if it is less than zero, 0.0f if it is zero and 1.0f if it greater than zero.


Declaration

public static float2 sign(float2 x);

Parameters

Parameter Description
x Input value.

Returns

float2 The componentwise sign of the input.

Description

Returns the componentwise sign of a float2 value. 1.0f for positive components, 0.0f for zero components and -1.0f for negative components.


Declaration

public static float3 sign(float3 x);

Parameters

Parameter Description
x Input value.

Returns

float3 The componentwise sign of the input.

Description

Returns the componentwise sign of a float3 value. 1.0f for positive components, 0.0f for zero components and -1.0f for negative components.


Declaration

public static float4 sign(float4 x);

Parameters

Parameter Description
x Input value.

Returns

float4 The componentwise sign of the input.

Description

Returns the componentwise sign of a float4 value. 1.0f for positive components, 0.0f for zero components and -1.0f for negative components.


Declaration

public static double sign(double x);

Parameters

Parameter Description
x Input value.

Returns

double The sign of the input.

Description

Returns the sign of a double value. -1.0 if it is less than zero, 0.0 if it is zero and 1.0 if it greater than zero.


Declaration

public static double2 sign(double2 x);

Parameters

Parameter Description
x Input value.

Returns

double2 The componentwise sign of the input.

Description

Returns the componentwise sign of a double2 value. 1.0 for positive components, 0.0 for zero components and -1.0 for negative components.


Declaration

public static double3 sign(double3 x);

Parameters

Parameter Description
x Input value.

Returns

double3 The componentwise sign of the input.

Description

Returns the componentwise sign of a double3 value. 1.0 for positive components, 0.0 for zero components and -1.0 for negative components.


Declaration

public static double4 sign(double4 x);

Parameters

Parameter Description
x Input value.

Returns

double4 The componentwise sign of the input.

Description

Returns the componentwise sign of a double4 value. 1.0 for positive components, 0.0 for zero components and -1.0 for negative components.