'Declaration Public Operator *( _ ByVal left As TdDecimal, _ ByVal right As TdDecimal _ ) As TdDecimal
'Usage
Parameters
- left
- A TdDecimal structure
- right
- A TdDecimal structure
'Declaration Public Operator *( _ ByVal left As TdDecimal, _ ByVal right As TdDecimal _ ) As TdDecimal
'Usage
Exception | Description |
---|---|
System.OverflowException | The scale of the result is greater than the TdDecimal.MaxScale. The result is greater than TdDecimal.MaxValue. The result is less than TdDecimal.MinValue. |
The result will be TdDecimal.Null if one of the parameter is TdDecimal.Null.
The Precision
of the result will be set to the mininum value between TdDecimal.MaxPrecision
and the sum of the precisions between the left and right operands.
The Scale
of the result will be the sum of the scales of the left and right operands. An OverflowException will be thrown if the sum of the scales are greater than the TdDecimal.MaxScale
.
// left = TdDecimal.MaxValue, right = 0.00000000000000000000000000000000000001 // result = 0.99999999999999999999999999999999999999 TdDecimal right01 = new TdDecimal(1, 0, 0, 0, 38, 38); TdDecimal result01 = TdDecimal.MaxValue * right01; Console.WriteLine("{0} * {1} = {2}", TdDecimal.MaxValue, right01, result01); // left = 7922816253271108167.1548469249, right = 50 // result = 396140812663555408357.742346245 TdDecimal left02 = new TdDecimal(0x00000001, 0x00000001, 0x00000001, 0x00000001, 38, 10); TdDecimal right02 = new TdDecimal(0x00000032, 0, 0, 0, 10, 0); TdDecimal result02 = left02 * right02; Console.WriteLine("{0} * {1} = {2}", left02, right02, result02); // left = 1001056.454, right = 89583732.32 // result = 89678373412344.39328 TdDecimal left03 = new TdDecimal(0x3BAAE8C6, 0, 0, 0, 38, 3); TdDecimal right03 = new TdDecimal(0x15F5ED70, 0x00000002, 0, 0, 38, 2); TdDecimal result03 = left03 * right03; Console.WriteLine("{0} * {1} = {2}", left03, right03, result03); // The following examples will throw OverflowExceptions // left = 0.0000000000347685438, right = 3.04857693086438675947 // An Exception will be thrown because left03.Scale + right03.Scale is greater than the MaxScale. TdDecimal left04 = new TdDecimal(0x14B9423E, 0, 0, 0, 19, 19); TdDecimal right04 = new TdDecimal(0x263C55EB, 0x86C018A8, 0x00000010, 0, 21, 20); TdDecimal result04 = left04 * right04; // left = 45698476950985.76239, right = 5649658503494856.7545 TdDecimal left05 = new TdDecimal(0x3FFCFD6F, 0x3F6B5C44 , 0, 0, 19, 5); TdDecimal right05 = new TdDecimal(0xEEC261F9, 0x100C30C1 , 0x00000003, 0, 20, 4); // An OverflowException will be thrown because the result will be greater than MaxValue. TdDecimal result05 = left05 * right05;
Target Platforms: Windows 7, Windows 8, Windows 8.1, Windows 10, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2