Version: Unity 6.5 Alpha (6000.5)
LanguageEnglish
  • C#

math.square

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static float square(float x);

Parameters

Parameter Description
x Value to square.

Returns

float Returns the square of the input.

Description

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


Declaration

public static float2 square(float2 x);

Parameters

Parameter Description
x Value to square.

Returns

float2 Returns the square of the input.

Description

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


Declaration

public static float3 square(float3 x);

Parameters

Parameter Description
x Value to square.

Returns

float3 Returns the square of the input.

Description

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


Declaration

public static float4 square(float4 x);

Parameters

Parameter Description
x Value to square.

Returns

float4 Returns the square of the input.

Description

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


Declaration

public static double square(double x);

Parameters

Parameter Description
x Value to square.

Returns

double Returns the square of the input.

Description

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


Declaration

public static double2 square(double2 x);

Parameters

Parameter Description
x Value to square.

Returns

double2 Returns the square of the input.

Description

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


Declaration

public static double3 square(double3 x);

Parameters

Parameter Description
x Value to square.

Returns

double3 Returns the square of the input.

Description

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


Declaration

public static double4 square(double4 x);

Parameters

Parameter Description
x Value to square.

Returns

double4 Returns the square of the input.

Description

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


Declaration

public static int square(int x);

Parameters

Parameter Description
x Value to square.

Returns

int Returns the square of the input.

Description

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

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


Declaration

public static int2 square(int2 x);

Parameters

Parameter Description
x Value to square.

Returns

int2 Returns the square of the input.

Description

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

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


Declaration

public static int3 square(int3 x);

Parameters

Parameter Description
x Value to square.

Returns

int3 Returns the square of the input.

Description

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

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


Declaration

public static int4 square(int4 x);

Parameters

Parameter Description
x Value to square.

Returns

int4 Returns the square of the input.

Description

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

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


Declaration

public static uint square(uint x);

Parameters

Parameter Description
x Value to square.

Returns

uint Returns the square of the input.

Description

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

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


Declaration

public static uint2 square(uint2 x);

Parameters

Parameter Description
x Value to square.

Returns

uint2 Returns the square of the input.

Description

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

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


Declaration

public static uint3 square(uint3 x);

Parameters

Parameter Description
x Value to square.

Returns

uint3 Returns the square of the input.

Description

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

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


Declaration

public static uint4 square(uint4 x);

Parameters

Parameter Description
x Value to square.

Returns

uint4 Returns the square of the input.

Description

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

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