Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


mad

Returns the result of a multiply-add operation (a * b + c) on 3 int values.
Read time 7 minutesLast updated 4 days ago

Definition

mad(int, int, int)

Returns the result of a multiply-add operation (a * b + c) on 3 int values.
public static int mad(int mulA, int mulB, int addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

intThe multiply-add of the inputs.

mad(int2, int2, int2)

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 int2 vectors.
public static int2 mad(int2 mulA, int2 mulB, int2 addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

int2The componentwise multiply-add of the inputs.

mad(int3, int3, int3)

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 int3 vectors.
public static int3 mad(int3 mulA, int3 mulB, int3 addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

int3The componentwise multiply-add of the inputs.

mad(int4, int4, int4)

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 int4 vectors.
public static int4 mad(int4 mulA, int4 mulB, int4 addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

int4The componentwise multiply-add of the inputs.

mad(uint, uint, uint)

Returns the result of a multiply-add operation (a * b + c) on 3 uint values.
public static uint mad(uint mulA, uint mulB, uint addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

uintThe multiply-add of the inputs.

mad(uint2, uint2, uint2)

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 uint2 vectors.
public static uint2 mad(uint2 mulA, uint2 mulB, uint2 addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

uint2The componentwise multiply-add of the inputs.

mad(uint3, uint3, uint3)

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 uint3 vectors.
public static uint3 mad(uint3 mulA, uint3 mulB, uint3 addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

uint3The componentwise multiply-add of the inputs.

mad(uint4, uint4, uint4)

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 uint4 vectors.
public static uint4 mad(uint4 mulA, uint4 mulB, uint4 addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

uint4The componentwise multiply-add of the inputs.

mad(long, long, long)

Returns the result of a multiply-add operation (a * b + c) on 3 long values.
public static long mad(long mulA, long mulB, long addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

longThe multiply-add of the inputs.

mad(ulong, ulong, ulong)

Returns the result of a multiply-add operation (a * b + c) on 3 ulong values.
public static ulong mad(ulong mulA, ulong mulB, ulong addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

ulongThe multiply-add of the inputs.

mad(float, float, float)

Returns the result of a multiply-add operation (a * b + c) on 3 float values.
public static float mad(float mulA, float mulB, float addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

floatThe multiply-add of the inputs.

Remarks

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.

mad(float2, float2, float2)

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 float2 vectors.
public static float2 mad(float2 mulA, float2 mulB, float2 addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

float2The componentwise multiply-add of the inputs.

Remarks

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.

mad(float3, float3, float3)

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 float3 vectors.
public static float3 mad(float3 mulA, float3 mulB, float3 addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

float3The componentwise multiply-add of the inputs.

Remarks

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.

mad(float4, float4, float4)

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 float4 vectors.
public static float4 mad(float4 mulA, float4 mulB, float4 addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

float4The componentwise multiply-add of the inputs.

Remarks

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.

mad(double, double, double)

Returns the result of a multiply-add operation (a * b + c) on 3 double values.
public static double mad(double mulA, double mulB, double addC)

Parameters

mulA

First value to multiply.

mulB

Second value to multiply.

addC

Third value to add to the product of a and b.

Returns

Type

Description

doubleThe multiply-add of the inputs.

Remarks

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.

mad(double2, double2, double2)

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 double2 vectors.
public static double2 mad(double2 mulA, double2 mulB, double2 addC)

Parameters

First value to multiply.

Second value to multiply.

Third value to add to the product of a and b.

Returns

Type

Description

double2The componentwise multiply-add of the inputs.

Remarks

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.

mad(double3, double3, double3)

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 double3 vectors.
public static double3 mad(double3 mulA, double3 mulB, double3 addC)

Parameters

First value to multiply.

Second value to multiply.

Third value to add to the product of a and b.

Returns

Type

Description

double3The componentwise multiply-add of the inputs.

Remarks

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.

mad(double4, double4, double4)

Returns the result of a componentwise multiply-add operation (a * b + c) on 3 double4 vectors.
public static double4 mad(double4 mulA, double4 mulB, double4 addC)

Parameters

First value to multiply.

Second value to multiply.

Third value to add to the product of a and b.

Returns

Type

Description

double4The componentwise multiply-add of the inputs.

Remarks

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.