Math.BigMul 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| BigMul(UInt64, UInt64, UInt64) |
產生兩個無符號 64 位元數字的完整乘積。 |
| BigMul(Int64, Int64, Int64) |
產生兩個 64 位元數字的全積。 |
| BigMul(UInt64, UInt64) |
產生兩個無符號 64 位元數字的完整乘積。 |
| BigMul(Int32, Int32) |
產生兩個 32 位元數字的全積。 |
| BigMul(Int64, Int64) |
產生兩個 64 位元數字的全積。 |
| BigMul(UInt32, UInt32) |
產生兩個無符號 32 位元數字的完整乘積。 |
BigMul(UInt64, UInt64, UInt64)
- 來源:
- Math.cs
- 來源:
- Math.cs
- 來源:
- Math.cs
- 來源:
- Math.cs
- 來源:
- Math.cs
重要
此 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位元。
- 屬性
適用於
BigMul(Int64, Int64, Int64)
- 來源:
- Math.cs
- 來源:
- Math.cs
- 來源:
- Math.cs
- 來源:
- Math.cs
- 來源:
- Math.cs
產生兩個 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)
- 來源:
- Math.cs
- 來源:
- Math.cs
- 來源:
- Math.cs
重要
此 API 不符合 CLS 規範。
產生兩個無符號 64 位元數字的完整乘積。
public:
static UInt128 BigMul(System::UInt64 a, System::UInt64 b);
[System.CLSCompliant(false)]
public static UInt128 BigMul(ulong a, ulong b);
[<System.CLSCompliant(false)>]
static member BigMul : uint64 * uint64 -> UInt128
Public Shared Function BigMul (a As ULong, b As ULong) As UInt128
參數
- a
- UInt64
第一個乘以的數字。
- b
- UInt64
第二個要乘的數字。
傳回
指定數字的全積。
- 屬性
適用於
BigMul(Int32, Int32)
- 來源:
- Math.cs
- 來源:
- Math.cs
- 來源:
- Math.cs
- 來源:
- Math.cs
- 來源:
- Math.cs
產生兩個 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 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)
- 來源:
- Math.cs
- 來源:
- Math.cs
- 來源:
- Math.cs
產生兩個 64 位元數字的全積。
public:
static Int128 BigMul(long a, long b);
public static Int128 BigMul(long a, long b);
static member BigMul : int64 * int64 -> Int128
Public Shared Function BigMul (a As Long, b As Long) As Int128
參數
- a
- Int64
第一個乘以的數字。
- b
- Int64
第二個要乘的數字。
傳回
指定數字的全積。
適用於
BigMul(UInt32, UInt32)
- 來源:
- Math.cs
- 來源:
- Math.cs
- 來源:
- Math.cs
重要
此 API 不符合 CLS 規範。
產生兩個無符號 32 位元數字的完整乘積。
public:
static System::UInt64 BigMul(System::UInt32 a, System::UInt32 b);
[System.CLSCompliant(false)]
public static ulong BigMul(uint a, uint b);
[<System.CLSCompliant(false)>]
static member BigMul : uint32 * uint32 -> uint64
Public Shared Function BigMul (a As UInteger, b As UInteger) As ULong
參數
- a
- UInt32
第一個乘以的數字。
- b
- UInt32
第二個要乘的數字。
傳回
包含指定數字乘積的數字。
- 屬性