docs.unity.cn
    Show / Hide Table of Contents

    Method sign

    sign(Single)

    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
    Single x

    Input value.

    Returns
    Type Description
    Single

    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.

    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on Tuesday, March 29, 2022
    Terms of use