Classes for all types Int32
, UInt32
, Int64
And UInt64
Provide each new method to each BigMul()
As a result for multiplication Int64
And UInt64
Or Int128
And UInt128
Back (without overflow) was given.
Dr. Holgar Schwichtenberg is the technical manager of experts to www.it-vistions.de, which supports many medium sizes and large companies through advice and training with 53 famous experts as well as software development. Through his appearance in many national and international expert conferences as well as his appearance in more than 90 expert books and more than 1,500 expert articles, Holgar Schwichtanberg is one of the most famous experts for .NET and web techniques in Germany.
public void BigMul()
{
CUI.Demo();
long Value1 = long.MaxValue;
ulong Value2 = ulong.MaxValue;
Console.WriteLine("Value1: " + Value1.ToString("#,0"));
Console.WriteLine("Value2: " + Value2.ToString("#,0"));
CUI.H1("Normale Multiplikation");
Int128 e1 = Value1 * 2; // Überlauf! -2
UInt128 e2 = Value2 * 2; // Überlauf! 18446744073709551614
Console.WriteLine(e1.ToString("#,0")); // Überlauf! -2
Console.WriteLine(e2.ToString("#,0")); // Überlauf! 18446744073709551614
CUI.H1("Multiplikation mit BigMul()");
Int128 e3 = Int64.BigMul(Value1, 2); // 18.446.744.073.709.551.614
UInt128 e4 = UInt64.BigMul(Value2, 2); // 36.893.488.147.419.103.230
Console.WriteLine(e3.ToString("#,0")); // 18.446.744.073.709.551.614
Console.WriteLine(e4.ToString("#,0")); // 36.893.488.147.419.103.230
}
(RME)