Math.BigMul Метод

Определение

Перегрузки

BigMul(Int32, Int32)

Умножает два 32-битовых числа.

BigMul(Int64, Int64, Int64)

Формирует полное произведение двух 64-битовых чисел.

BigMul(UInt64, UInt64, UInt64)

Формирует полное произведение двух 64-битовых чисел без знака.

BigMul(Int32, Int32)

Умножает два 32-битовых числа.

public:
 static long BigMul(int a, int b);
public static long BigMul (int a, int b);
static member BigMul : int * int -> int64
Public Shared Function BigMul (a As Integer, b As Integer) As Long

Параметры

a
Int32

Первое число для умножения.

b
Int32

Второе число для умножения.

Возвращаемое значение

Число, являющееся произведением указанных чисел.

Примеры

В следующем примере показано использование метода для BigMul вычисления продукта из двух целых значений.

// This example demonstrates Math.BigMul()
using namespace System;
int main()
{
   int int1 = Int32::MaxValue;
   int int2 = Int32::MaxValue;
   Int64 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
*/
// 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
*/
// This example demonstrates Math.BigMul()
open System

let int1 = Int32.MaxValue
let int2 = Int32.MaxValue

let longResult = Math.BigMul(int1, int2)
printfn "Calculate the product of two Int32 values:"
printfn $"{int1} * {int2} = {longResult}"

// This example produces the following results:
// Calculate the product of two Int32 values:
// 2147483647 * 2147483647 = 4611686014132420609
' This example demonstrates Math.BigMul()
Class Sample
   Public Shared Sub Main()
      Dim int1 As Integer = Int32.MaxValue
      Dim int2 As Integer = Int32.MaxValue
      Dim longResult As Long
      '
      longResult = Math.BigMul(int1, int2)
      Console.WriteLine("Calculate the product of two Int32 values:")
      Console.WriteLine("{0} * {1} = {2}", int1, int2, longResult)
   End Sub
End Class
'
'This example produces the following results:
'Calculate the product of two Int32 values:
'2147483647 * 2147483647 = 4611686014132420609
'

Применяется к

BigMul(Int64, Int64, Int64)

Формирует полное произведение двух 64-битовых чисел.

public:
 static long BigMul(long a, long b, [Runtime::InteropServices::Out] long % low);
public static long BigMul (long a, long b, out long low);
static member BigMul : int64 * int64 * int64 -> int64
Public Shared Function BigMul (a As Long, b As Long, ByRef low As Long) As Long

Параметры

a
Int64

Первое число для умножения.

b
Int64

Второе число для умножения.

low
Int64

При возврате этого метода содержит низкое 64-разрядное произведение указанных чисел.

Возвращаемое значение

Высокая 64-разрядная часть произведения указанных чисел.

Применяется к

BigMul(UInt64, UInt64, UInt64)

Важно!

Этот API несовместим с CLS.

Формирует полное произведение двух 64-битовых чисел без знака.

public:
 static System::UInt64 BigMul(System::UInt64 a, System::UInt64 b, [Runtime::InteropServices::Out] System::UInt64 % low);
[System.CLSCompliant(false)]
public static ulong BigMul (ulong a, ulong b, out ulong low);
[<System.CLSCompliant(false)>]
static member BigMul : uint64 * uint64 * uint64 -> uint64
Public Shared Function BigMul (a As ULong, b As ULong, ByRef low As ULong) As ULong

Параметры

a
UInt64

Первое число для умножения.

b
UInt64

Второе число для умножения.

low
UInt64

При возврате этого метода содержит низкое 64-разрядное произведение указанных чисел.

Возвращаемое значение

Высокая 64-разрядная часть произведения указанных чисел.

Атрибуты

Применяется к