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

math.mad

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 int mad(int mulA, int mulB, int addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

int The multiply-add of the inputs.

Description

Returns the result of a multiply-add operation (a * b + c) on 3 int values.


Declaration

public static int2 mad(int2 mulA, int2 mulB, int2 addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

int2 The componentwise multiply-add of the inputs.

Description

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 int2 vectors.


Declaration

public static int3 mad(int3 mulA, int3 mulB, int3 addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

int3 The componentwise multiply-add of the inputs.

Description

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 int3 vectors.


Declaration

public static int4 mad(int4 mulA, int4 mulB, int4 addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

int4 The componentwise multiply-add of the inputs.

Description

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 int4 vectors.


Declaration

public static uint mad(uint mulA, uint mulB, uint addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

uint The multiply-add of the inputs.

Description

Returns the result of a multiply-add operation (a * b + c) on 3 uint values.


Declaration

public static uint2 mad(uint2 mulA, uint2 mulB, uint2 addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

uint2 The componentwise multiply-add of the inputs.

Description

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 uint2 vectors.


Declaration

public static uint3 mad(uint3 mulA, uint3 mulB, uint3 addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

uint3 The componentwise multiply-add of the inputs.

Description

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 uint3 vectors.


Declaration

public static uint4 mad(uint4 mulA, uint4 mulB, uint4 addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

uint4 The componentwise multiply-add of the inputs.

Description

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 uint4 vectors.


Declaration

public static long mad(long mulA, long mulB, long addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

long The multiply-add of the inputs.

Description

Returns the result of a multiply-add operation (a * b + c) on 3 long values.


Declaration

public static ulong mad(ulong mulA, ulong mulB, ulong addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

ulong The multiply-add of the inputs.

Description

Returns the result of a multiply-add operation (a * b + c) on 3 ulong values.


Declaration

public static float mad(float mulA, float mulB, float addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

float The multiply-add of the inputs.

Description

Returns the result of a multiply-add operation (a * b + c) on 3 float values.

When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA). FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when this computation is not fused.


Declaration

public static float2 mad(float2 mulA, float2 mulB, float2 addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

float2 The componentwise multiply-add of the inputs.

Description

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 float2 vectors.

When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA). FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when this computation is not fused.


Declaration

public static float3 mad(float3 mulA, float3 mulB, float3 addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

float3 The componentwise multiply-add of the inputs.

Description

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 float3 vectors.

When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA). FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when this computation is not fused.


Declaration

public static float4 mad(float4 mulA, float4 mulB, float4 addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

float4 The componentwise multiply-add of the inputs.

Description

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 float4 vectors.

When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA). FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when this computation is not fused.


Declaration

public static double mad(double mulA, double mulB, double addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

double The multiply-add of the inputs.

Description

Returns the result of a multiply-add operation (a * b + c) on 3 double values.

When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA). FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when this computation is not fused.


Declaration

public static double2 mad(double2 mulA, double2 mulB, double2 addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

double2 The componentwise multiply-add of the inputs.

Description

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 double2 vectors.

When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA). FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when this computation is not fused.


Declaration

public static double3 mad(double3 mulA, double3 mulB, double3 addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

double3 The componentwise multiply-add of the inputs.

Description

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 double3 vectors.

When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA). FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when this computation is not fused.


Declaration

public static double4 mad(double4 mulA, double4 mulB, double4 addC);

Parameters

Parameter Description
mulA First value to multiply.
mulB Second value to multiply.
addC Third value to add to the product of a and b.

Returns

double4 The componentwise multiply-add of the inputs.

Description

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 double4 vectors.

When Burst compiled with fast math enabled on some architectures, this could be converted to a fused multiply add (FMA). FMA is more accurate due to rounding once at the end of the computation rather than twice that is required when this computation is not fused.