Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


sign

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.
Read time 3 minutesLast updated 11 days ago

Definition

sign(int)

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.
public static int sign(int x)

Parameters

Input value.

Returns

Type

Description

intThe sign of the input.

sign(int2)

Returns the componentwise sign of a int2 value. 1 for positive components, 0 for zero components and -1 for negative components.
public static int2 sign(int2 x)

Parameters

Input value.

Returns

Type

Description

int2The componentwise sign of the input.

sign(int3)

Returns the componentwise sign of a int3 value. 1 for positive components, 0 for zero components and -1 for negative components.
public static int3 sign(int3 x)

Parameters

Input value.

Returns

Type

Description

int3The componentwise sign of the input.

sign(int4)

Returns the componentwise sign of a int4 value. 1 for positive components, 0 for zero components and -1 for negative components.
public static int4 sign(int4 x)

Parameters

Input value.

Returns

Type

Description

int4The componentwise sign of the input.

sign(float)

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.
public static float sign(float x)

Parameters

Input value.

Returns

Type

Description

floatThe sign of the input.

sign(float2)

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

Parameters

Input value.

Returns

Type

Description

float2The componentwise sign of the input.

sign(float3)

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

Parameters

Input value.

Returns

Type

Description

float3The componentwise sign of the input.

sign(float4)

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

Parameters

Input value.

Returns

Type

Description

float4The componentwise sign of the input.

sign(double)

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.
public static double sign(double x)

Parameters

Input value.

Returns

Type

Description

doubleThe sign of the input.

sign(double2)

Returns the componentwise sign of a double2 value. 1.0 for positive components, 0.0 for zero components and -1.0 for negative components.
public static double2 sign(double2 x)

Parameters

Input value.

Returns

Type

Description

double2The componentwise sign of the input.

sign(double3)

Returns the componentwise sign of a double3 value. 1.0 for positive components, 0.0 for zero components and -1.0 for negative components.
public static double3 sign(double3 x)

Parameters

Input value.

Returns

Type

Description

double3The componentwise sign of the input.

sign(double4)

Returns the componentwise sign of a double4 value. 1.0 for positive components, 0.0 for zero components and -1.0 for negative components.
public static double4 sign(double4 x)

Parameters

Input value.

Returns

Type

Description

double4The componentwise sign of the input.