Edit

Share via


Math.BigMul Method

Definition

Overloads

BigMul(UInt64, UInt64, UInt64)

Produces the full product of two unsigned 64-bit numbers.

BigMul(Int64, Int64, Int64)

Produces the full product of two 64-bit numbers.

BigMul(UInt64, UInt64)

Produces the full product of two unsigned 64-bit numbers.

BigMul(Int32, Int32)

Produces the full product of two 32-bit numbers.

BigMul(Int64, Int64)

Produces the full product of two 64-bit numbers.

BigMul(UInt32, UInt32)

Produces the full product of two unsigned 32-bit numbers.

BigMul(UInt64, UInt64, UInt64)

Source:
Math.cs
Source:
Math.cs
Source:
Math.cs

Important

This API is not CLS-compliant.

Produces the full product of two unsigned 64-bit numbers.

C#
[System.CLSCompliant(false)]
public static ulong BigMul(ulong a, ulong b, out ulong low);

Parameters

a
UInt64

The first number to multiply.

b
UInt64

The second number to multiply.

low
UInt64

When this method returns, contains the low 64-bit of the product of the specified numbers.

Returns

The high 64-bit of the product of the specified numbers.

Attributes

Applies to

.NET 10 and other versions
Product Versions
.NET 5, 6, 7, 8, 9, 10

BigMul(Int64, Int64, Int64)

Source:
Math.cs
Source:
Math.cs
Source:
Math.cs

Produces the full product of two 64-bit numbers.

C#
public static long BigMul(long a, long b, out long low);

Parameters

a
Int64

The first number to multiply.

b
Int64

The second number to multiply.

low
Int64

When this method returns, contains the low 64-bit of the product of the specified numbers.

Returns

The high 64-bit of the product of the specified numbers.

Applies to

.NET 10 and other versions
Product Versions
.NET 5, 6, 7, 8, 9, 10

BigMul(UInt64, UInt64)

Important

This API is not CLS-compliant.

Produces the full product of two unsigned 64-bit numbers.

C#
[System.CLSCompliant(false)]
public static UInt128 BigMul(ulong a, ulong b);

Parameters

a
UInt64

The first number to multiply.

b
UInt64

The second number to multiply.

Returns

The full product of the specified numbers.

Attributes

Applies to

.NET 10 and .NET 9
Product Versions
.NET 9, 10

BigMul(Int32, Int32)

Source:
Math.cs
Source:
Math.cs
Source:
Math.cs

Produces the full product of two 32-bit numbers.

C#
public static long BigMul(int a, int b);

Parameters

a
Int32

The first number to multiply.

b
Int32

The second number to multiply.

Returns

The number containing the product of the specified numbers.

Examples

The following example demonstrates the use of the BigMul method to calculate the product of two integer values.

C#
// This example demonstrates Math.BigMul()
using System;

class Sample
{
    public static void Main()
    {
    int int1 = Int32.MaxValue;
    int int2 = Int32.MaxValue;
    long longResult;
//
    longResult = Math.BigMul(int1, int2);
    Console.WriteLine("Calculate the product of two Int32 values:");
    Console.WriteLine("{0} * {1} = {2}", int1, int2, longResult);
    }
}
/*
This example produces the following results:
Calculate the product of two Int32 values:
2147483647 * 2147483647 = 4611686014132420609
*/

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

BigMul(Int64, Int64)

Produces the full product of two 64-bit numbers.

C#
public static Int128 BigMul(long a, long b);

Parameters

a
Int64

The first number to multiply.

b
Int64

The second number to multiply.

Returns

The full product of the specified numbers.

Applies to

.NET 10 and .NET 9
Product Versions
.NET 9, 10

BigMul(UInt32, UInt32)

Important

This API is not CLS-compliant.

Produces the full product of two unsigned 32-bit numbers.

C#
[System.CLSCompliant(false)]
public static ulong BigMul(uint a, uint b);

Parameters

a
UInt32

The first number to multiply.

b
UInt32

The second number to multiply.

Returns

The number containing the product of the specified numbers.

Attributes

Applies to

.NET 10 and .NET 9
Product Versions
.NET 9, 10