author | psandoz |
Tue, 13 Aug 2013 11:16:37 +0200 | |
changeset 19424 | c4524285927f |
parent 16242 | c928b16d6ccd |
permissions | -rw-r--r-- |
16242
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
1 |
/* |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
2 |
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
4 |
* |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
8 |
* |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
13 |
* accompanied this code). |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
14 |
* |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
18 |
* |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
21 |
* questions. |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
22 |
*/ |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
23 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
24 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
25 |
/** |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
26 |
* JDK-8008298: Add tests to cover specialized versions of Math functions. |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
27 |
* Excerise all specialized Math functions with various literal values. |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
28 |
* |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
29 |
* @test |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
30 |
* @run |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
31 |
*/ |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
32 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
33 |
if (Math.abs(-88) != 88) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
34 |
fail("Math.abs for int value"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
35 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
36 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
37 |
if (Math.abs(-2147483648) != 2147483648) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
38 |
fail("Math.abs failed for long value"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
39 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
40 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
41 |
if (Math.acos(1.0) != 0) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
42 |
fail("Math.acos failed on double value"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
43 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
44 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
45 |
if (Math.asin(0.0) != 0) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
46 |
fail("Math.asin failed on double value"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
47 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
48 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
49 |
if (Math.atan(0.0) != 0) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
50 |
fail("Math.atan failed on double value"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
51 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
52 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
53 |
if (Math.ceil(1) != 1) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
54 |
fail("Math.ceil failed on int value"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
55 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
56 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
57 |
if (Math.ceil(2147483648) != 2147483648) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
58 |
fail("Math.ceil failed on long value"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
59 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
60 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
61 |
if (Math.ceil(-0.3) != 0) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
62 |
fail("Math.ceil failed on double value"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
63 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
64 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
65 |
if (Math.floor(1) != 1) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
66 |
fail("Math.floor failed on int value"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
67 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
68 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
69 |
if (Math.floor(2147483648) != 2147483648) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
70 |
fail("Math.floor failed on long value"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
71 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
72 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
73 |
if (Math.floor(0.3) != 0) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
74 |
fail("Math.floor failed on double value"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
75 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
76 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
77 |
if (Math.log(1.0) != 0) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
78 |
fail("Math.log failed on double value"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
79 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
80 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
81 |
if (Math.max(2, 28) != 28) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
82 |
fail("Math.max failed for int values"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
83 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
84 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
85 |
if (Math.max(2147483649, 2147483648) != 2147483649) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
86 |
fail("Math.max failed for long values"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
87 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
88 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
89 |
if (Math.max(0.0, -2.5) != 0.0) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
90 |
fail("Math.max failed for double values"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
91 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
92 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
93 |
if (Math.min(2, 28) != 2) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
94 |
fail("Math.min failed for int values"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
95 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
96 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
97 |
if (Math.min(2147483649, 2147483648) != 2147483648) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
98 |
fail("Math.min failed for long values"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
99 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
100 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
101 |
if (Math.min(0.0, 2.5) != 0.0) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
102 |
fail("Math.min failed for double values"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
103 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
104 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
105 |
if (Math.sqrt(4) != 2) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
106 |
fail("Math.sqrt failed for int value"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
107 |
} |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
108 |
|
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
109 |
if (Math.tan(0.0) != 0.0) { |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
110 |
fail("Math.tan failed for double value"); |
c928b16d6ccd
8008298: Add tests to cover specialized versions of Math functions.
sundar
parents:
diff
changeset
|
111 |
} |