docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method sign

    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.

    Declaration
    public static int sign(int x)
    Parameters
    Type Name Description
    int x

    Input value.

    Returns
    Type Description
    int

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

    Declaration
    public static int2 sign(int2 x)
    Parameters
    Type Name Description
    int2 x

    Input value.

    Returns
    Type Description
    int2

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

    Declaration
    public static int3 sign(int3 x)
    Parameters
    Type Name Description
    int3 x

    Input value.

    Returns
    Type Description
    int3

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

    Declaration
    public static int4 sign(int4 x)
    Parameters
    Type Name Description
    int4 x

    Input value.

    Returns
    Type Description
    int4

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

    Declaration
    public static float sign(float x)
    Parameters
    Type Name Description
    float x

    Input value.

    Returns
    Type Description
    float

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

    Declaration
    public static float2 sign(float2 x)
    Parameters
    Type Name Description
    float2 x

    Input value.

    Returns
    Type Description
    float2

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

    Declaration
    public static float3 sign(float3 x)
    Parameters
    Type Name Description
    float3 x

    Input value.

    Returns
    Type Description
    float3

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

    Declaration
    public static float4 sign(float4 x)
    Parameters
    Type Name Description
    float4 x

    Input value.

    Returns
    Type Description
    float4

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

    Declaration
    public static double sign(double x)
    Parameters
    Type Name Description
    double x

    Input value.

    Returns
    Type Description
    double

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

    Declaration
    public static double2 sign(double2 x)
    Parameters
    Type Name Description
    double2 x

    Input value.

    Returns
    Type Description
    double2

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

    Declaration
    public static double3 sign(double3 x)
    Parameters
    Type Name Description
    double3 x

    Input value.

    Returns
    Type Description
    double3

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

    Declaration
    public static double4 sign(double4 x)
    Parameters
    Type Name Description
    double4 x

    Input value.

    Returns
    Type Description
    double4

    The componentwise sign of the input.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)