Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2014-01-26 14:32:03 +0400
committerMarek Safar <marek.safar@gmail.com>2014-01-26 14:35:08 +0400
commit280f85db70b76e0f80605c9574a3bb3e17101a99 (patch)
tree316fb4121503b64d75f954679c1a2e38c00ad87b /mcs/tests/test-885.cs
parentacccf24cca3db0578d1b64104a824d18d9075d34 (diff)
[mcs] Do underlying float constant operation on double values. Fixes #15463
Diffstat (limited to 'mcs/tests/test-885.cs')
-rw-r--r--mcs/tests/test-885.cs42
1 files changed, 42 insertions, 0 deletions
diff --git a/mcs/tests/test-885.cs b/mcs/tests/test-885.cs
new file mode 100644
index 00000000000..2bd07100606
--- /dev/null
+++ b/mcs/tests/test-885.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Reflection;
+
+[AttributeUsage(System.AttributeTargets.All)]
+class A : Attribute
+{
+ public double D;
+
+ public A (double d)
+ {
+ this.D = d;
+ }
+}
+
+
+class C
+{
+ [A (0.7f * 100.0f)]
+ static int Main ()
+ {
+ if ((int) (0.7f * 100.0f) != 69)
+ return 1;
+
+ if ((double) (0.7f * 100.0f) != 69.9999988079071)
+ return 2;
+
+ if (!Foo (0.7f * 100.0f))
+ return 3;
+
+ A attr = (A)MethodBase.GetCurrentMethod ().GetCustomAttributes (false) [0];
+ if (attr.D != 69.9999988079071)
+ return 4;
+
+ Console.WriteLine ("ok");
+ return 0;
+ }
+
+ static bool Foo (double d)
+ {
+ return d == 69.9999988079071;
+ }
+} \ No newline at end of file