square
Computes the square (x * x) of the input argument x.
Read time 4 minutesLast updated 4 days ago
Definition
- Type: Method
- Namespace: Unity.Mathematics
- Assembly: UnityEngine.MathematicsModule
square(float)
Computes the square (x * x) of the input argument x.
public static float square(float x)
Parameters
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.
public static float2 square(float2 x)
Parameters
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.
public static float3 square(float3 x)
Parameters
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.
public static float4 square(float4 x)
Parameters
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.
public static double square(double x)
Parameters
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.
public static double2 square(double2 x)
Parameters
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.
public static double3 square(double3 x)
Parameters
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.
public static double4 square(double4 x)
Parameters
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.
public static int square(int x)
Parameters
Value to square.
Returns
Type | Description |
|---|---|
| int | Returns the square of the input. |
Remarks
Due to integer overflow, it's not always guaranteed that is positive. For example, will return .
square(x)square(46341)-2147479015square(int2)
Computes the component-wise square (x * x) of the input argument x.
public static int2 square(int2 x)
Parameters
Value to square.
Returns
Type | Description |
|---|---|
| int2 | Returns the square of the input. |
Remarks
Due to integer overflow, it's not always guaranteed that is positive. For example, will return .
square(x)square(new int2(46341))new int2(-2147479015)square(int3)
Computes the component-wise square (x * x) of the input argument x.
public static int3 square(int3 x)
Parameters
Value to square.
Returns
Type | Description |
|---|---|
| int3 | Returns the square of the input. |
Remarks
Due to integer overflow, it's not always guaranteed that is positive. For example, will return .
square(x)square(new int3(46341))new int3(-2147479015)square(int4)
Computes the component-wise square (x * x) of the input argument x.
public static int4 square(int4 x)
Parameters
Value to square.
Returns
Type | Description |
|---|---|
| int4 | Returns the square of the input. |
Remarks
Due to integer overflow, it's not always guaranteed that is positive. For example, will return .
square(x)square(new int4(46341))new int4(-2147479015)square(uint)
Computes the square (x * x) of the input argument x.
public static uint square(uint x)
Parameters
Value to square.
Returns
Type | Description |
|---|---|
| uint | Returns the square of the input. |
Remarks
Due to integer overflow, it's not always guaranteed that . For example, will return .
square(x) >= xsquare(4294967295u)1usquare(uint2)
Computes the component-wise square (x * x) of the input argument x.
public static uint2 square(uint2 x)
Parameters
Value to square.
Returns
Type | Description |
|---|---|
| uint2 | Returns the square of the input. |
Remarks
Due to integer overflow, it's not always guaranteed that . For example, will return .
square(x) >= xsquare(new uint2(4294967295u))new uint2(1u)square(uint3)
Computes the component-wise square (x * x) of the input argument x.
public static uint3 square(uint3 x)
Parameters
Value to square.
Returns
Type | Description |
|---|---|
| uint3 | Returns the square of the input. |
Remarks
Due to integer overflow, it's not always guaranteed that . For example, will return .
square(x) >= xsquare(new uint3(4294967295u))new uint3(1u)square(uint4)
Computes the component-wise square (x * x) of the input argument x.
public static uint4 square(uint4 x)
Parameters
Value to square.
Returns
Type | Description |
|---|---|
| uint4 | Returns the square of the input. |
Remarks
Due to integer overflow, it's not always guaranteed that . For example, will return .
square(x) >= xsquare(new uint4(4294967295u))new uint4(1u)