docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method square

    square(float)

    Computes the square (x * x) of the input argument x.

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

    Value to square.

    Returns
    Type Description
    float

    Returns the square of the input.

    square(float2)

    Computes the component-wise square (x * x) of the input argument x.

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

    Value to square.

    Returns
    Type Description
    float2

    Returns the square of the input.

    square(float3)

    Computes the component-wise square (x * x) of the input argument x.

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

    Value to square.

    Returns
    Type Description
    float3

    Returns the square of the input.

    square(float4)

    Computes the component-wise square (x * x) of the input argument x.

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

    Value to square.

    Returns
    Type Description
    float4

    Returns the square of the input.

    square(double)

    Computes the square (x * x) of the input argument x.

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

    Value to square.

    Returns
    Type Description
    double

    Returns the square of the input.

    square(double2)

    Computes the component-wise square (x * x) of the input argument x.

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

    Value to square.

    Returns
    Type Description
    double2

    Returns the square of the input.

    square(double3)

    Computes the component-wise square (x * x) of the input argument x.

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

    Value to square.

    Returns
    Type Description
    double3

    Returns the square of the input.

    square(double4)

    Computes the component-wise square (x * x) of the input argument x.

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

    Value to square.

    Returns
    Type Description
    double4

    Returns the square of the input.

    square(int)

    Computes the square (x * x) of the input argument x.

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

    Value to square.

    Returns
    Type Description
    int

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) is positive. For example, square(46341) will return -2147479015.

    square(int2)

    Computes the component-wise square (x * x) of the input argument x.

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

    Value to square.

    Returns
    Type Description
    int2

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) is positive. For example, square(new int2(46341)) will return new int2(-2147479015).

    square(int3)

    Computes the component-wise square (x * x) of the input argument x.

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

    Value to square.

    Returns
    Type Description
    int3

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) is positive. For example, square(new int3(46341)) will return new int3(-2147479015).

    square(int4)

    Computes the component-wise square (x * x) of the input argument x.

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

    Value to square.

    Returns
    Type Description
    int4

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) is positive. For example, square(new int4(46341)) will return new int4(-2147479015).

    square(uint)

    Computes the square (x * x) of the input argument x.

    Declaration
    public static uint square(uint x)
    Parameters
    Type Name Description
    uint x

    Value to square.

    Returns
    Type Description
    uint

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) >= x. For example, square(4294967295u) will return 1u.

    square(uint2)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static uint2 square(uint2 x)
    Parameters
    Type Name Description
    uint2 x

    Value to square.

    Returns
    Type Description
    uint2

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) >= x. For example, square(new uint2(4294967295u)) will return new uint2(1u).

    square(uint3)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static uint3 square(uint3 x)
    Parameters
    Type Name Description
    uint3 x

    Value to square.

    Returns
    Type Description
    uint3

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) >= x. For example, square(new uint3(4294967295u)) will return new uint3(1u).

    square(uint4)

    Computes the component-wise square (x * x) of the input argument x.

    Declaration
    public static uint4 square(uint4 x)
    Parameters
    Type Name Description
    uint4 x

    Value to square.

    Returns
    Type Description
    uint4

    Returns the square of the input.

    Remarks

    Due to integer overflow, it's not always guaranteed that square(x) >= x. For example, square(new uint4(4294967295u)) will return new uint4(1u).

    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)