blob: 5a4d16eb9511b5ad92282a248c7f5b0f12f19e25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
using System;
class MainClass
{
public struct Decimal2
{
public Decimal2 (double d)
{
value = new Decimal (d);
}
public Decimal2 (Decimal d)
{
value = d;
}
public static explicit operator Decimal2 (Decimal d)
{
return new Decimal2 (d);
}
public static explicit operator Decimal2 (double d)
{
return new Decimal2 (d);
}
public static implicit operator Decimal (Decimal2 d)
{
return d.value;
}
private Decimal value;
}
public static void Main (string [] args)
{
Console.WriteLine ("double = {0}", 1.1367 * 11.9767 - 0.6);
Console.WriteLine ("Decimal2 = {0}", ((Decimal2) 1.1367 * (Decimal2) 11.9767 - (Decimal2) 0.6));
Console.WriteLine ("Decimal2 = {0}", new Decimal2 (1.1367) * (Decimal2) 11.9767 - (Decimal2) 0.6);
Console.WriteLine ("Decimal2 = {0}", (Decimal2) 11.9767 * new Decimal2 (1.1367) - (Decimal2) 0.6);
Console.WriteLine ("Decimal2 = {0}", (new Decimal2 (1.1367) * (Decimal2) 11.9767 - (Decimal2) 0.6));
Console.WriteLine ("Decimal2 = {0}", ((Decimal2) 1.1367 * (Decimal2) 11.9767 - (Decimal) 0.6));
Console.WriteLine ("Decimal2 = {0}", (1.14 * 11.9767 - 0.6));
Console.WriteLine ("Decimal2 = {0}", ((Decimal2) 1.1367 * (Decimal) 11.9767 - (Decimal2) 0.6));
Console.WriteLine ("Decimal2 = {0}", ((Decimal2) 1.1367 * (Decimal2) 11.9767 - (Decimal2) 0.6));
}
}
|