docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method mad

    mad(int, int, int)

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

    Declaration
    public static int mad(int mulA, int mulB, int addC)
    Parameters
    Type Name Description
    int mulA

    First value to multiply.

    int mulB

    Second value to multiply.

    int addC

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

    Returns
    Type Description
    int

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

    Declaration
    public static int2 mad(int2 mulA, int2 mulB, int2 addC)
    Parameters
    Type Name Description
    int2 mulA

    First value to multiply.

    int2 mulB

    Second value to multiply.

    int2 addC

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

    Returns
    Type Description
    int2

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

    Declaration
    public static int3 mad(int3 mulA, int3 mulB, int3 addC)
    Parameters
    Type Name Description
    int3 mulA

    First value to multiply.

    int3 mulB

    Second value to multiply.

    int3 addC

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

    Returns
    Type Description
    int3

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

    Declaration
    public static int4 mad(int4 mulA, int4 mulB, int4 addC)
    Parameters
    Type Name Description
    int4 mulA

    First value to multiply.

    int4 mulB

    Second value to multiply.

    int4 addC

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

    Returns
    Type Description
    int4

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

    Declaration
    public static uint mad(uint mulA, uint mulB, uint addC)
    Parameters
    Type Name Description
    uint mulA

    First value to multiply.

    uint mulB

    Second value to multiply.

    uint addC

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

    Returns
    Type Description
    uint

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

    Declaration
    public static uint2 mad(uint2 mulA, uint2 mulB, uint2 addC)
    Parameters
    Type Name Description
    uint2 mulA

    First value to multiply.

    uint2 mulB

    Second value to multiply.

    uint2 addC

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

    Returns
    Type Description
    uint2

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

    Declaration
    public static uint3 mad(uint3 mulA, uint3 mulB, uint3 addC)
    Parameters
    Type Name Description
    uint3 mulA

    First value to multiply.

    uint3 mulB

    Second value to multiply.

    uint3 addC

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

    Returns
    Type Description
    uint3

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

    Declaration
    public static uint4 mad(uint4 mulA, uint4 mulB, uint4 addC)
    Parameters
    Type Name Description
    uint4 mulA

    First value to multiply.

    uint4 mulB

    Second value to multiply.

    uint4 addC

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

    Returns
    Type Description
    uint4

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

    Declaration
    public static long mad(long mulA, long mulB, long addC)
    Parameters
    Type Name Description
    long mulA

    First value to multiply.

    long mulB

    Second value to multiply.

    long addC

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

    Returns
    Type Description
    long

    The multiply-add of the inputs.

    mad(ulong, ulong, ulong)

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

    Declaration
    public static ulong mad(ulong mulA, ulong mulB, ulong addC)
    Parameters
    Type Name Description
    ulong mulA

    First value to multiply.

    ulong mulB

    Second value to multiply.

    ulong addC

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

    Returns
    Type Description
    ulong

    The multiply-add of the inputs.

    mad(float, float, float)

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

    Declaration
    public static float mad(float mulA, float mulB, float addC)
    Parameters
    Type Name Description
    float mulA

    First value to multiply.

    float mulB

    Second value to multiply.

    float addC

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

    Returns
    Type Description
    float

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

    Declaration
    public static float2 mad(float2 mulA, float2 mulB, float2 addC)
    Parameters
    Type Name Description
    float2 mulA

    First value to multiply.

    float2 mulB

    Second value to multiply.

    float2 addC

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

    Returns
    Type Description
    float2

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

    Declaration
    public static float3 mad(float3 mulA, float3 mulB, float3 addC)
    Parameters
    Type Name Description
    float3 mulA

    First value to multiply.

    float3 mulB

    Second value to multiply.

    float3 addC

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

    Returns
    Type Description
    float3

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

    Declaration
    public static float4 mad(float4 mulA, float4 mulB, float4 addC)
    Parameters
    Type Name Description
    float4 mulA

    First value to multiply.

    float4 mulB

    Second value to multiply.

    float4 addC

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

    Returns
    Type Description
    float4

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

    Declaration
    public static double mad(double mulA, double mulB, double addC)
    Parameters
    Type Name Description
    double mulA

    First value to multiply.

    double mulB

    Second value to multiply.

    double addC

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

    Returns
    Type Description
    double

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

    Declaration
    public static double2 mad(double2 mulA, double2 mulB, double2 addC)
    Parameters
    Type Name Description
    double2 mulA

    First value to multiply.

    double2 mulB

    Second value to multiply.

    double2 addC

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

    Returns
    Type Description
    double2

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

    Declaration
    public static double3 mad(double3 mulA, double3 mulB, double3 addC)
    Parameters
    Type Name Description
    double3 mulA

    First value to multiply.

    double3 mulB

    Second value to multiply.

    double3 addC

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

    Returns
    Type Description
    double3

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

    Declaration
    public static double4 mad(double4 mulA, double4 mulB, double4 addC)
    Parameters
    Type Name Description
    double4 mulA

    First value to multiply.

    double4 mulB

    Second value to multiply.

    double4 addC

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

    Returns
    Type Description
    double4

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

    In This Article
    • mad(int, int, int)
    • mad(int2, int2, int2)
    • mad(int3, int3, int3)
    • mad(int4, int4, int4)
    • mad(uint, uint, uint)
    • mad(uint2, uint2, uint2)
    • mad(uint3, uint3, uint3)
    • mad(uint4, uint4, uint4)
    • mad(long, long, long)
    • mad(ulong, ulong, ulong)
    • mad(float, float, float)
    • mad(float2, float2, float2)
    • mad(float3, float3, float3)
    • mad(float4, float4, float4)
    • mad(double, double, double)
    • mad(double2, double2, double2)
    • mad(double3, double3, double3)
    • mad(double4, double4, double4)
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)