Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


square

Computes the square (x * x) of the input argument x.
Read time 4 minutesLast updated 4 days ago

Definition

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

floatReturns 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

float2Returns 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

float3Returns 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

float4Returns 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

doubleReturns 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

double2Returns 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

double3Returns 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

double4Returns 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

intReturns 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.
public static int2 square(int2 x)

Parameters

Value to square.

Returns

Type

Description

int2Returns 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.
public static int3 square(int3 x)

Parameters

Value to square.

Returns

Type

Description

int3Returns 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.
public static int4 square(int4 x)

Parameters

Value to square.

Returns

Type

Description

int4Returns 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.
public static uint square(uint x)

Parameters

Value to square.

Returns

Type

Description

uintReturns 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.
public static uint2 square(uint2 x)

Parameters

Value to square.

Returns

Type

Description

uint2Returns 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.
public static uint3 square(uint3 x)

Parameters

Value to square.

Returns

Type

Description

uint3Returns 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.
public static uint4 square(uint4 x)

Parameters

Value to square.

Returns

Type

Description

uint4Returns 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)
.