Merge pull request #5428 from kumpera/wasm-support-p2
[mono.git] / mcs / tests / test-649.cs
1 using System;
2
3 class MainClass
4 {
5         public struct Decimal2
6         {
7                 public Decimal2 (double d)
8                 {
9                         value = new Decimal (d);
10                 }
11
12                 public Decimal2 (Decimal d)
13                 {
14                         value = d;
15                 }
16
17                 public static explicit operator Decimal2 (Decimal d)
18                 {
19                         return new Decimal2 (d);
20                 }
21
22                 public static explicit operator Decimal2 (double d)
23                 {
24                         return new Decimal2 (d); 
25                 }
26
27                 public static implicit operator Decimal (Decimal2 d)
28                 {
29                         return d.value;
30                 }
31
32                 private Decimal value;
33         }
34
35         public static void Main (string [] args)
36         {
37                 Console.WriteLine ("double   = {0}", 1.1367 * 11.9767 - 0.6);
38                 Console.WriteLine ("Decimal2 = {0}", ((Decimal2) 1.1367 * (Decimal2) 11.9767 - (Decimal2) 0.6));
39                 Console.WriteLine ("Decimal2 = {0}", new Decimal2 (1.1367) * (Decimal2) 11.9767 - (Decimal2) 0.6);
40                 Console.WriteLine ("Decimal2 = {0}", (Decimal2) 11.9767 * new Decimal2 (1.1367) - (Decimal2) 0.6);
41                 Console.WriteLine ("Decimal2 = {0}", (new Decimal2 (1.1367) * (Decimal2) 11.9767 - (Decimal2) 0.6));
42                 Console.WriteLine ("Decimal2 = {0}", ((Decimal2) 1.1367 * (Decimal2) 11.9767 - (Decimal) 0.6));
43                 Console.WriteLine ("Decimal2 = {0}", (1.14 * 11.9767 - 0.6));
44                 Console.WriteLine ("Decimal2 = {0}", ((Decimal2) 1.1367 * (Decimal) 11.9767 - (Decimal2) 0.6));
45                 Console.WriteLine ("Decimal2 = {0}", ((Decimal2) 1.1367 * (Decimal2) 11.9767 - (Decimal2) 0.6));
46         }
47 }