TdDecimal enumerator;
TdDecimal denominator;
TdDecimal result;
enumerator = TdDecimal.Parse("1");
denominator = TdDecimal.Parse("3");
// Going to perform the operation 1 / 3.
// result = 0, Precision = 38, Scale = 0.
// The reason for this is that both the enumerator and denominator have a scale of 0.
result = enumerator / denominator;
Console.WriteLine("{0} / {1} = {3}", enumerator, denominator, result);
enumerator = new TdDecimal(1, 0, 0, 0, 4, 3);
denominator = new TdDecimal(3, 0, 0, 0, 3, 2);
// Going to perform the operation 1.000 / 2.00.
// result = 0.333, Precision = 38, Scale = 3
// The enumerator has the largest scale.
result = enumerator / denominator
Console.WriteLine("{0} / {1} = {3}", enumerator, denominator, result);
enumerator = new TdDecimal(1, 0, 0, 0, 1, 0);
denominator = new TdDecimal(4, 0, 0, 0, 2, 1);
// Going to perform the operation 1 / 4.0.
// result = 0.2, Precision = 38, Scale = 1
// The largest scale between the enumerator and denominator is 1.
// Therefore, the result will only have a scale of 1.
// The result has been truncated.
result = enumerator / denominator;
Console.WriteLine("{0} / {1} = {3}", enumerator, denominator, result);
enumerator = new TdDecimal(1, 0, 0, 0, 10, 5);
denominator = new TdDecimal(4, 0, 0, 0, 10, 7);
// Going to perform the operation 1.00000 / 4.0000000
// result = 0.2500000, Precision = 38, Scale = 7
// The largest scale between the enumerator and denominator is 7.
result = enumerator / denominator;
Console.WriteLine("{0} / {1} = {3}", enumerator, denominator, result);