StrictMathTest.java revision 89c1feb0a69a7707b271086e749975b3f7acacf7
1/*
2 *  Licensed to the Apache Software Foundation (ASF) under one or more
3 *  contributor license agreements.  See the NOTICE file distributed with
4 *  this work for additional information regarding copyright ownership.
5 *  The ASF licenses this file to You under the Apache License, Version 2.0
6 *  (the "License"); you may not use this file except in compliance with
7 *  the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *  Unless required by applicable law or agreed to in writing, software
12 *  distributed under the License is distributed on an "AS IS" BASIS,
13 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *  See the License for the specific language governing permissions and
15 *  limitations under the License.
16 */
17
18package org.apache.harmony.luni.tests.java.lang;
19
20import dalvik.annotation.TestInfo;
21import dalvik.annotation.TestLevel;
22import dalvik.annotation.TestTarget;
23import dalvik.annotation.TestTargetClass;
24
25@TestTargetClass(StrictMath.class)
26public class StrictMathTest extends junit.framework.TestCase {
27
28    double HYP = StrictMath.sqrt(2.0);
29
30    double OPP = 1.0;
31
32    double ADJ = 1.0;
33
34    /* Required to make previous preprocessor flags work - do not remove */
35    int unused = 0;
36
37    /**
38     * @tests java.lang.StrictMath#pow(double)
39     */
40    @TestInfo(
41      level = TestLevel.PARTIAL,
42      purpose = "Doesn't check boundary values.",
43      targets = {
44        @TestTarget(
45          methodName = "pow",
46          methodArgs = {double.class, double.class}
47        )
48    })
49    public void test_pow() {
50        // tests changes in fdlibm5.3
51        assertTrue(Double.longBitsToDouble(-4610068591539890326L) == StrictMath.pow(-1.0000000000000002e+00,4.5035996273704970e+15));
52        assertTrue(Double.longBitsToDouble( 4601023824101950163L) == StrictMath.pow(-9.9999999999999978e-01,4.035996273704970e+15));
53    }
54
55    /**
56     * @tests java.lang.StrictMath#tan(double)
57     */
58    @TestInfo(
59      level = TestLevel.PARTIAL,
60      purpose = "Doesn't check boundary values.",
61      targets = {
62        @TestTarget(
63          methodName = "tan",
64          methodArgs = {double.class}
65        )
66    })
67    public void test_tan(){
68        // tests changes in fdlibm5.3
69        assertTrue(Double.longBitsToDouble( 4850236541654588678L) == StrictMath.tan( 1.7765241907548024E+269));
70    }
71
72    /**
73     * @tests java.lang.StrictMath#asin(double)
74     * @tests java.lang.StrictMath#exp(double)
75     * @tests java.lang.StrictMath#sinh(double)
76     * @tests java.lang.StrictMath#expm1(double)
77     */
78    @TestInfo(
79      level = TestLevel.PARTIAL,
80      purpose = "Checks one value.",
81      targets = {
82        @TestTarget(
83          methodName = "asin",
84          methodArgs = {double.class}
85        ),
86        @TestTarget(
87          methodName = "exp",
88          methodArgs = {double.class}
89        ),
90        @TestTarget(
91          methodName = "sinh",
92          methodArgs = {double.class}
93        ),
94        @TestTarget(
95          methodName = "expm1",
96          methodArgs = {double.class}
97        )
98    })
99    public void test_inexact(){
100        assertTrue( 4485585228743840298L == Double.doubleToRawLongBits(StrictMath.asin(7.4505805E-9)));
101        assertTrue( 4607182418816794624L == Double.doubleToRawLongBits(StrictMath.exp(3.7252902E-9)));
102        assertTrue( 4481081628995577220L == Double.doubleToRawLongBits(StrictMath.sinh(3.7252902E-9)));
103        assertTrue(-4616189618054758400L == Double.doubleToRawLongBits(StrictMath.expm1(-40)));
104    }
105
106    /**
107     * @tests java.lang.StrictMath#abs(double)
108     */
109    @TestInfo(
110      level = TestLevel.PARTIAL,
111      purpose = "Doesn't check boundary values.",
112      targets = {
113        @TestTarget(
114          methodName = "abs",
115          methodArgs = {double.class}
116        )
117    })
118    public void test_absD() {
119        // Test for method double java.lang.StrictMath.abs(double)
120
121        assertTrue("Incorrect double abs value",
122                (StrictMath.abs(-1908.8976) == 1908.8976));
123        assertTrue("Incorrect double abs value",
124                (StrictMath.abs(1908.8976) == 1908.8976));
125    }
126
127    /**
128     * @tests java.lang.StrictMath#abs(float)
129     */
130    @TestInfo(
131      level = TestLevel.PARTIAL,
132      purpose = "Doesn't check boundary values.",
133      targets = {
134        @TestTarget(
135          methodName = "abs",
136          methodArgs = {float.class}
137        )
138    })
139    public void test_absF() {
140        // Test for method float java.lang.StrictMath.abs(float)
141        assertTrue("Incorrect float abs value",
142                (StrictMath.abs(-1908.8976f) == 1908.8976f));
143        assertTrue("Incorrect float abs value",
144                (StrictMath.abs(1908.8976f) == 1908.8976f));
145    }
146
147    /**
148     * @tests java.lang.StrictMath#abs(int)
149     */
150    @TestInfo(
151      level = TestLevel.PARTIAL,
152      purpose = "Doesn't check boundary values.",
153      targets = {
154        @TestTarget(
155          methodName = "abs",
156          methodArgs = {int.class}
157        )
158    })
159    public void test_absI() {
160        // Test for method int java.lang.StrictMath.abs(int)
161        assertTrue("Incorrect int abs value",
162                (StrictMath.abs(-1908897) == 1908897));
163        assertTrue("Incorrect int abs value",
164                (StrictMath.abs(1908897) == 1908897));
165    }
166
167    /**
168     * @tests java.lang.StrictMath#abs(long)
169     */
170    @TestInfo(
171      level = TestLevel.PARTIAL,
172      purpose = "Doesn't check boundary values.",
173      targets = {
174        @TestTarget(
175          methodName = "abs",
176          methodArgs = {long.class}
177        )
178    })
179    public void test_absJ() {
180        // Test for method long java.lang.StrictMath.abs(long)
181        assertTrue("Incorrect long abs value", (StrictMath
182                .abs(-19088976000089L) == 19088976000089L));
183        assertTrue("Incorrect long abs value",
184                (StrictMath.abs(19088976000089L) == 19088976000089L));
185    }
186
187    /**
188     * @tests java.lang.StrictMath#acos(double)
189     */
190    @TestInfo(
191      level = TestLevel.PARTIAL,
192      purpose = "Doesn't check boundary values.",
193      targets = {
194        @TestTarget(
195          methodName = "acos",
196          methodArgs = {double.class}
197        )
198    })
199    public void test_acosD() {
200        // Test for method double java.lang.StrictMath.acos(double)
201        assertTrue("Returned incorrect arc cosine", StrictMath.cos(StrictMath
202                .acos(ADJ / HYP)) == ADJ / HYP);
203    }
204
205    /**
206     * @tests java.lang.StrictMath#asin(double)
207     */
208    @TestInfo(
209      level = TestLevel.PARTIAL,
210      purpose = "Doesn't check boundary values.",
211      targets = {
212        @TestTarget(
213          methodName = "asin",
214          methodArgs = {double.class}
215        )
216    })
217    public void test_asinD() {
218        // Test for method double java.lang.StrictMath.asin(double)
219        assertTrue("Returned incorrect arc sine", StrictMath.sin(StrictMath
220                .asin(OPP / HYP)) == OPP / HYP);
221    }
222
223    /**
224     * @tests java.lang.StrictMath#atan(double)
225     */
226    @TestInfo(
227      level = TestLevel.COMPLETE,
228      purpose = "Doesn't check boundary values.",
229      targets = {
230        @TestTarget(
231          methodName = "atan",
232          methodArgs = {double.class}
233        )
234    })
235    public void test_atanD() {
236        // Test for method double java.lang.StrictMath.atan(double)
237        double answer = StrictMath.tan(StrictMath.atan(1.0));
238        assertTrue("Returned incorrect arc tangent: " + answer, answer <= 1.0
239                && answer >= 9.9999999999999983E-1);
240    }
241
242    /**
243     * @tests java.lang.StrictMath#atan2(double, double)
244     */
245    @TestInfo(
246      level = TestLevel.PARTIAL,
247      purpose = "Doesn't check boundary values.",
248      targets = {
249        @TestTarget(
250          methodName = "atan2",
251          methodArgs = {double.class, double.class}
252        )
253    })
254    public void test_atan2DD() {
255        // Test for method double java.lang.StrictMath.atan2(double, double)
256        double answer = StrictMath.atan(StrictMath.tan(1.0));
257        assertTrue("Returned incorrect arc tangent: " + answer, answer <= 1.0
258                && answer >= 9.9999999999999983E-1);
259    }
260
261    /**
262     * @tests java.lang.StrictMath#cbrt(double)
263     */
264    @TestInfo(
265      level = TestLevel.PARTIAL,
266      purpose = "Doesn't check boundary values.",
267      targets = {
268        @TestTarget(
269          methodName = "cbrt",
270          methodArgs = {double.class}
271        )
272    })
273    @SuppressWarnings("boxing")
274    public void test_cbrt_D() {
275        // Test for special situations
276        assertTrue("Should return Double.NaN", Double.isNaN(StrictMath
277                .cbrt(Double.NaN)));
278        assertEquals("Should return Double.POSITIVE_INFINITY",
279                Double.POSITIVE_INFINITY, StrictMath
280                        .cbrt(Double.POSITIVE_INFINITY));
281        assertEquals("Should return Double.NEGATIVE_INFINITY",
282                Double.NEGATIVE_INFINITY, StrictMath
283                        .cbrt(Double.NEGATIVE_INFINITY));
284        assertEquals(Double.doubleToLongBits(0.0), Double
285                .doubleToLongBits(StrictMath.cbrt(0.0)));
286        assertEquals(Double.doubleToLongBits(+0.0), Double
287                .doubleToLongBits(StrictMath.cbrt(+0.0)));
288        assertEquals(Double.doubleToLongBits(-0.0), Double
289                .doubleToLongBits(StrictMath.cbrt(-0.0)));
290
291        assertEquals("Should return 3.0", 3.0, StrictMath.cbrt(27.0));
292        assertEquals("Should return 23.111993172558684", 23.111993172558684,
293                StrictMath.cbrt(12345.6));
294        assertEquals("Should return 5.643803094122362E102",
295                5.643803094122362E102, StrictMath.cbrt(Double.MAX_VALUE));
296        assertEquals("Should return 0.01", 0.01, StrictMath.cbrt(0.000001));
297
298        assertEquals("Should return -3.0", -3.0, StrictMath.cbrt(-27.0));
299        assertEquals("Should return -23.111993172558684", -23.111993172558684,
300                StrictMath.cbrt(-12345.6));
301        assertEquals("Should return 1.7031839360032603E-108",
302                1.7031839360032603E-108, StrictMath.cbrt(Double.MIN_VALUE));
303        assertEquals("Should return -0.01", -0.01, StrictMath.cbrt(-0.000001));
304
305        try{
306            StrictMath.cbrt((Double)null);
307            fail("Should throw NullPointerException");
308        }catch(NullPointerException e){
309            //expected
310        }
311    }
312
313    /**
314     * @tests java.lang.StrictMath#ceil(double)
315     */
316    @TestInfo(
317      level = TestLevel.PARTIAL,
318      purpose = "Doesn't check boundary values.",
319      targets = {
320        @TestTarget(
321          methodName = "ceil",
322          methodArgs = {double.class}
323        )
324    })
325    public void test_ceilD() {
326        // Test for method double java.lang.StrictMath.ceil(double)
327                assertEquals("Incorrect ceiling for double",
328                             79, StrictMath.ceil(78.89), 0.0);
329        assertEquals("Incorrect ceiling for double",
330                             -78, StrictMath.ceil(-78.89), 0.0);
331    }
332
333    /**
334     * @tests java.lang.StrictMath#cos(double)
335     */
336    @TestInfo(
337      level = TestLevel.PARTIAL,
338      purpose = "Doesn't check boundary values.",
339      targets = {
340        @TestTarget(
341          methodName = "cos",
342          methodArgs = {double.class}
343        )
344    })
345    public void test_cosD() {
346        // Test for method double java.lang.StrictMath.cos(double)
347
348        assertTrue("Returned incorrect cosine", StrictMath.cos(StrictMath
349                .acos(ADJ / HYP)) == ADJ / HYP);
350    }
351
352    /**
353     * @tests java.lang.StrictMath#cosh(double)
354     */
355    @TestInfo(
356      level = TestLevel.COMPLETE,
357      purpose = "",
358      targets = {
359        @TestTarget(
360          methodName = "cosh",
361          methodArgs = {double.class}
362        )
363    })
364    @SuppressWarnings("boxing")
365    public void test_cosh_D() {
366        // Test for special situations
367        assertTrue("Should return NaN", Double.isNaN(StrictMath
368                .cosh(Double.NaN)));
369        assertEquals("Should return POSITIVE_INFINITY",
370                Double.POSITIVE_INFINITY, StrictMath
371                        .cosh(Double.POSITIVE_INFINITY));
372        assertEquals("Should return POSITIVE_INFINITY",
373                Double.POSITIVE_INFINITY, StrictMath
374                        .cosh(Double.NEGATIVE_INFINITY));
375        assertEquals("Should return 1.0", 1.0, StrictMath.cosh(+0.0));
376        assertEquals("Should return 1.0", 1.0, StrictMath.cosh(-0.0));
377
378        assertEquals("Should return POSITIVE_INFINITY",
379                Double.POSITIVE_INFINITY, StrictMath.cosh(1234.56));
380        assertEquals("Should return POSITIVE_INFINITY",
381                Double.POSITIVE_INFINITY, StrictMath.cosh(-1234.56));
382        assertEquals("Should return 1.0000000000005", 1.0000000000005,
383                StrictMath.cosh(0.000001));
384        assertEquals("Should return 1.0000000000005", 1.0000000000005,
385                StrictMath.cosh(-0.000001));
386        assertEquals("Should return 5.212214351945598", 5.212214351945598,
387                StrictMath.cosh(2.33482));
388
389        assertEquals("Should return POSITIVE_INFINITY",
390                Double.POSITIVE_INFINITY, StrictMath.cosh(Double.MAX_VALUE));
391        assertEquals("Should return 1.0", 1.0, StrictMath
392                .cosh(Double.MIN_VALUE));
393    }
394
395    /**
396     * @tests java.lang.StrictMath#exp(double)
397     */
398    @TestInfo(
399      level = TestLevel.PARTIAL,
400      purpose = "Doesn't check boundary values.",
401      targets = {
402        @TestTarget(
403          methodName = "exp",
404          methodArgs = {double.class}
405        )
406    })
407    public void test_expD() {
408        // Test for method double java.lang.StrictMath.exp(double)
409        assertTrue("Incorrect answer returned for simple power", StrictMath
410                .abs(StrictMath.exp(4D) - StrictMath.E * StrictMath.E
411                        * StrictMath.E * StrictMath.E) < 0.1D);
412        assertTrue("Incorrect answer returned for larger power", StrictMath
413                .log(StrictMath.abs(StrictMath.exp(5.5D)) - 5.5D) < 10.0D);
414    }
415
416    /**
417     * @tests java.lang.StrictMath#expm1(double)
418     */
419    @TestInfo(
420      level = TestLevel.COMPLETE,
421      purpose = "",
422      targets = {
423        @TestTarget(
424          methodName = "expm1",
425          methodArgs = {double.class}
426        )
427    })
428    @SuppressWarnings("boxing")
429    public void test_expm1_D() {
430        //Test for special cases
431        assertTrue("Should return NaN", Double.isNaN(StrictMath.expm1(Double.NaN)));
432        assertEquals("Should return POSITIVE_INFINITY",
433                Double.POSITIVE_INFINITY, StrictMath.expm1(Double.POSITIVE_INFINITY));
434        assertEquals("Should return -1.0", -1.0, StrictMath
435                .expm1(Double.NEGATIVE_INFINITY));
436        assertEquals(Double.doubleToLongBits(0.0), Double
437                .doubleToLongBits(StrictMath.expm1(0.0)));
438        assertEquals(Double.doubleToLongBits(+0.0), Double
439                .doubleToLongBits(StrictMath.expm1(+0.0)));
440        assertEquals(Double.doubleToLongBits(-0.0), Double
441                .doubleToLongBits(StrictMath.expm1(-0.0)));
442
443        assertEquals("Should return -9.999950000166666E-6",
444                -9.999950000166666E-6, StrictMath.expm1(-0.00001));
445        assertEquals("Should return 1.0145103074469635E60",
446                1.0145103074469635E60, StrictMath.expm1(138.16951162));
447        assertEquals("Should return POSITIVE_INFINITY",
448                Double.POSITIVE_INFINITY, StrictMath
449                        .expm1(123456789123456789123456789.4521584223));
450        assertEquals("Should return POSITIVE_INFINITY",
451                Double.POSITIVE_INFINITY, StrictMath.expm1(Double.MAX_VALUE));
452        assertEquals("Should return MIN_VALUE", Double.MIN_VALUE, StrictMath
453                .expm1(Double.MIN_VALUE));
454
455    }
456
457    /**
458     * @tests java.lang.StrictMath#floor(double)
459     */
460    @TestInfo(
461      level = TestLevel.PARTIAL,
462      purpose = "Doesn't check boundary values.",
463      targets = {
464        @TestTarget(
465          methodName = "floor",
466          methodArgs = {double.class}
467        )
468    })
469    public void test_floorD() {
470        // Test for method double java.lang.StrictMath.floor(double)
471                assertEquals("Incorrect floor for double",
472                             78, StrictMath.floor(78.89), 0.0);
473        assertEquals("Incorrect floor for double",
474                             -79, StrictMath.floor(-78.89), 0.0);
475    }
476
477    /**
478     * @tests java.lang.StrictMath#hypot(double, double)
479     */
480    @TestInfo(
481      level = TestLevel.COMPLETE,
482      purpose = "",
483      targets = {
484        @TestTarget(
485          methodName = "hypot",
486          methodArgs = {double.class, double.class}
487        )
488    })
489    @SuppressWarnings("boxing")
490    public void test_hypot_DD() {
491        // Test for special cases
492        assertEquals("Should return POSITIVE_INFINITY",
493                Double.POSITIVE_INFINITY, StrictMath.hypot(Double.POSITIVE_INFINITY,
494                        1.0));
495        assertEquals("Should return POSITIVE_INFINITY",
496                Double.POSITIVE_INFINITY, StrictMath.hypot(Double.NEGATIVE_INFINITY,
497                        123.324));
498        assertEquals("Should return POSITIVE_INFINITY",
499                Double.POSITIVE_INFINITY, StrictMath.hypot(-758.2587,
500                        Double.POSITIVE_INFINITY));
501        assertEquals("Should return POSITIVE_INFINITY",
502                Double.POSITIVE_INFINITY, StrictMath.hypot(5687.21,
503                        Double.NEGATIVE_INFINITY));
504        assertEquals("Should return POSITIVE_INFINITY",
505                Double.POSITIVE_INFINITY, StrictMath.hypot(Double.POSITIVE_INFINITY,
506                        Double.NEGATIVE_INFINITY));
507        assertEquals("Should return POSITIVE_INFINITY",
508                Double.POSITIVE_INFINITY, StrictMath.hypot(Double.NEGATIVE_INFINITY,
509                        Double.POSITIVE_INFINITY));
510        assertTrue("Should return NaN",Double.isNaN(StrictMath.hypot(Double.NaN,
511                2342301.89843)));
512        assertTrue("Should return NaN",Double.isNaN(StrictMath.hypot(-345.2680,
513                Double.NaN)));
514
515        assertEquals("Should return 2396424.905416697", 2396424.905416697, StrictMath
516                .hypot(12322.12, -2396393.2258));
517        assertEquals("Should return 138.16958070558556", 138.16958070558556,
518                StrictMath.hypot(-138.16951162, 0.13817035864));
519        assertEquals("Should return 1.7976931348623157E308",
520                1.7976931348623157E308, StrictMath.hypot(Double.MAX_VALUE, 211370.35));
521        assertEquals("Should return 5413.7185", 5413.7185, StrictMath.hypot(
522                -5413.7185, Double.MIN_VALUE));
523
524    }
525
526    /**
527     * @tests java.lang.StrictMath#IEEEremainder(double, double)
528     */
529    @TestInfo(
530      level = TestLevel.PARTIAL,
531      purpose = "Doesn't check boundary values.",
532      targets = {
533        @TestTarget(
534          methodName = "IEEEremainder",
535          methodArgs = {double.class, double.class}
536        )
537    })
538    public void test_IEEEremainderDD() {
539        // Test for method double java.lang.StrictMath.IEEEremainder(double,
540        // double)
541        assertEquals("Incorrect remainder returned", 0.0, StrictMath.IEEEremainder(
542                1.0, 1.0), 0.0);
543        assertTrue(
544                "Incorrect remainder returned",
545                StrictMath.IEEEremainder(1.32, 89.765) >= 1.4705063220631647E-2
546                        || StrictMath.IEEEremainder(1.32, 89.765) >= 1.4705063220631649E-2);
547    }
548
549    /**
550     * @tests java.lang.StrictMath#log(double)
551     */
552    @TestInfo(
553      level = TestLevel.PARTIAL,
554      purpose = "Doesn't check boundary values.",
555      targets = {
556        @TestTarget(
557          methodName = "log",
558          methodArgs = {double.class}
559        )
560    })
561    public void test_logD() {
562        // Test for method double java.lang.StrictMath.log(double)
563        for (double d = 10; d >= -10; d -= 0.5) {
564            double answer = StrictMath.log(StrictMath.exp(d));
565            assertTrue("Answer does not equal expected answer for d = " + d
566                    + " answer = " + answer,
567                    StrictMath.abs(answer - d) <= StrictMath
568                            .abs(d * 0.00000001));
569        }
570    }
571
572    /**
573     * @tests java.lang.StrictMath#log10(double)
574     */
575    @TestInfo(
576      level = TestLevel.COMPLETE,
577      purpose = "",
578      targets = {
579        @TestTarget(
580          methodName = "log10",
581          methodArgs = {double.class}
582        )
583    })
584    @SuppressWarnings("boxing")
585    public void test_log10_D() {
586        // Test for special cases
587        assertTrue("Should return NaN", Double.isNaN(StrictMath
588                .log10(Double.NaN)));
589        assertTrue("Should return NaN", Double.isNaN(StrictMath
590                .log10(-2541.05745687234187532)));
591        assertEquals("Should return POSITIVE_INFINITY",
592                Double.POSITIVE_INFINITY, StrictMath
593                        .log10(Double.POSITIVE_INFINITY));
594        assertEquals("Should return NEGATIVE_INFINITY",
595                Double.NEGATIVE_INFINITY, StrictMath.log10(0.0));
596        assertEquals("Should return NEGATIVE_INFINITY",
597                Double.NEGATIVE_INFINITY, StrictMath.log10(+0.0));
598        assertEquals("Should return NEGATIVE_INFINITY",
599                Double.NEGATIVE_INFINITY, StrictMath.log10(-0.0));
600        assertEquals("Should return 14.0", 14.0, StrictMath.log10(StrictMath
601                .pow(10, 14)));
602
603        assertEquals("Should return 3.7389561269540406", 3.7389561269540406,
604                StrictMath.log10(5482.2158));
605        assertEquals("Should return 14.661551142893833", 14.661551142893833,
606                StrictMath.log10(458723662312872.125782332587));
607        assertEquals("Should return -0.9083828622192334", -0.9083828622192334,
608                StrictMath.log10(0.12348583358871));
609        assertEquals("Should return 308.25471555991675", 308.25471555991675,
610                StrictMath.log10(Double.MAX_VALUE));
611        assertEquals("Should return -323.3062153431158", -323.3062153431158,
612                StrictMath.log10(Double.MIN_VALUE));
613    }
614
615    /**
616     * @tests java.lang.StrictMath#log1p(double)
617     */
618    @TestInfo(
619      level = TestLevel.COMPLETE,
620      purpose = "",
621      targets = {
622        @TestTarget(
623          methodName = "log1p",
624          methodArgs = {double.class}
625        )
626    })
627    @SuppressWarnings("boxing")
628    public void test_log1p_D() {
629        // Test for special cases
630        assertTrue("Should return NaN", Double.isNaN(StrictMath
631                .log1p(Double.NaN)));
632        assertTrue("Should return NaN", Double.isNaN(StrictMath
633                .log1p(-32.0482175)));
634        assertEquals("Should return POSITIVE_INFINITY",
635                Double.POSITIVE_INFINITY, StrictMath
636                        .log1p(Double.POSITIVE_INFINITY));
637        assertEquals(Double.doubleToLongBits(0.0), Double
638                .doubleToLongBits(StrictMath.log1p(0.0)));
639        assertEquals(Double.doubleToLongBits(+0.0), Double
640                .doubleToLongBits(StrictMath.log1p(+0.0)));
641        assertEquals(Double.doubleToLongBits(-0.0), Double
642                .doubleToLongBits(StrictMath.log1p(-0.0)));
643
644        assertEquals("Should return -0.2941782295312541", -0.2941782295312541,
645                StrictMath.log1p(-0.254856327));
646        assertEquals("Should return 7.368050685564151", 7.368050685564151,
647                StrictMath.log1p(1583.542));
648        assertEquals("Should return 0.4633708685409921", 0.4633708685409921,
649                StrictMath.log1p(0.5894227));
650        assertEquals("Should return 709.782712893384", 709.782712893384,
651                StrictMath.log1p(Double.MAX_VALUE));
652        assertEquals("Should return Double.MIN_VALUE", Double.MIN_VALUE,
653                StrictMath.log1p(Double.MIN_VALUE));
654    }
655
656    /**
657     * @tests java.lang.StrictMath#max(double, double)
658     */
659    @TestInfo(
660      level = TestLevel.PARTIAL,
661      purpose = "Doesn't check boundary values.",
662      targets = {
663        @TestTarget(
664          methodName = "max",
665          methodArgs = {double.class, double.class}
666        )
667    })
668    public void test_maxDD() {
669        // Test for method double java.lang.StrictMath.max(double, double)
670        assertEquals("Incorrect double max value", 1908897.6000089, StrictMath.max(
671                -1908897.6000089, 1908897.6000089), 0D);
672        assertEquals("Incorrect double max value", 1908897.6000089, StrictMath.max(2.0,
673                1908897.6000089), 0D);
674        assertEquals("Incorrect double max value", -2.0, StrictMath.max(-2.0,
675                -1908897.6000089), 0D);
676
677    }
678
679    /**
680     * @tests java.lang.StrictMath#max(float, float)
681     */
682    @TestInfo(
683      level = TestLevel.PARTIAL,
684      purpose = "Doesn't check boundary values.",
685      targets = {
686        @TestTarget(
687          methodName = "max",
688          methodArgs = {float.class, float.class}
689        )
690    })
691    public void test_maxFF() {
692        // Test for method float java.lang.StrictMath.max(float, float)
693        assertTrue("Incorrect float max value", StrictMath.max(-1908897.600f,
694                1908897.600f) == 1908897.600f);
695        assertTrue("Incorrect float max value", StrictMath.max(2.0f,
696                1908897.600f) == 1908897.600f);
697        assertTrue("Incorrect float max value", StrictMath.max(-2.0f,
698                -1908897.600f) == -2.0f);
699    }
700
701    /**
702     * @tests java.lang.StrictMath#max(int, int)
703     */
704    @TestInfo(
705      level = TestLevel.PARTIAL,
706      purpose = "Doesn't check boundary values.",
707      targets = {
708        @TestTarget(
709          methodName = "max",
710          methodArgs = {int.class, int.class}
711        )
712    })
713    public void test_maxII() {
714        // Test for method int java.lang.StrictMath.max(int, int)
715        assertEquals("Incorrect int max value", 19088976, StrictMath.max(-19088976,
716                19088976));
717        assertEquals("Incorrect int max value",
718                19088976, StrictMath.max(20, 19088976));
719        assertEquals("Incorrect int max value",
720                -20, StrictMath.max(-20, -19088976));
721    }
722
723    /**
724     * @tests java.lang.StrictMath#max(long, long)
725     */
726    @TestInfo(
727      level = TestLevel.PARTIAL,
728      purpose = "Doesn't check boundary values.",
729      targets = {
730        @TestTarget(
731          methodName = "max",
732          methodArgs = {long.class, long.class}
733        )
734    })
735    public void test_maxJJ() {
736        // Test for method long java.lang.StrictMath.max(long, long)
737        assertEquals("Incorrect long max value", 19088976000089L, StrictMath.max(-19088976000089L,
738                19088976000089L));
739        assertEquals("Incorrect long max value", 19088976000089L, StrictMath.max(20,
740                19088976000089L));
741        assertEquals("Incorrect long max value", -20, StrictMath.max(-20,
742                -19088976000089L));
743    }
744
745    /**
746     * @tests java.lang.StrictMath#min(double, double)
747     */
748    @TestInfo(
749      level = TestLevel.PARTIAL,
750      purpose = "Doesn't check boundary values.",
751      targets = {
752        @TestTarget(
753          methodName = "min",
754          methodArgs = {double.class, double.class}
755        )
756    })
757    public void test_minDD() {
758        // Test for method double java.lang.StrictMath.min(double, double)
759        assertEquals("Incorrect double min value", -1908897.6000089, StrictMath.min(
760                -1908897.6000089, 1908897.6000089), 0D);
761        assertEquals("Incorrect double min value", 2.0, StrictMath.min(2.0,
762                1908897.6000089), 0D);
763        assertEquals("Incorrect double min value", -1908897.6000089, StrictMath.min(-2.0,
764                -1908897.6000089), 0D);
765    }
766
767    /**
768     * @tests java.lang.StrictMath#min(float, float)
769     */
770    @TestInfo(
771      level = TestLevel.PARTIAL,
772      purpose = "Doesn't check boundary values.",
773      targets = {
774        @TestTarget(
775          methodName = "min",
776          methodArgs = {float.class, float.class}
777        )
778    })
779    public void test_minFF() {
780        // Test for method float java.lang.StrictMath.min(float, float)
781        assertTrue("Incorrect float min value", StrictMath.min(-1908897.600f,
782                1908897.600f) == -1908897.600f);
783        assertTrue("Incorrect float min value", StrictMath.min(2.0f,
784                1908897.600f) == 2.0f);
785        assertTrue("Incorrect float min value", StrictMath.min(-2.0f,
786                -1908897.600f) == -1908897.600f);
787    }
788
789    /**
790     * @tests java.lang.StrictMath#min(int, int)
791     */
792    @TestInfo(
793      level = TestLevel.PARTIAL,
794      purpose = "Doesn't check boundary values.",
795      targets = {
796        @TestTarget(
797          methodName = "min",
798          methodArgs = {int.class, int.class}
799        )
800    })
801    public void test_minII() {
802        // Test for method int java.lang.StrictMath.min(int, int)
803        assertEquals("Incorrect int min value", -19088976, StrictMath.min(-19088976,
804                19088976));
805        assertEquals("Incorrect int min value",
806                20, StrictMath.min(20, 19088976));
807        assertEquals("Incorrect int min value",
808                -19088976, StrictMath.min(-20, -19088976));
809
810    }
811
812    /**
813     * @tests java.lang.StrictMath#min(long, long)
814     */
815    @TestInfo(
816      level = TestLevel.PARTIAL,
817      purpose = "Doesn't check boundary values.",
818      targets = {
819        @TestTarget(
820          methodName = "min",
821          methodArgs = {long.class, long.class}
822        )
823    })
824    public void test_minJJ() {
825        // Test for method long java.lang.StrictMath.min(long, long)
826        assertEquals("Incorrect long min value", -19088976000089L, StrictMath.min(-19088976000089L,
827                19088976000089L));
828        assertEquals("Incorrect long min value", 20, StrictMath.min(20,
829                19088976000089L));
830        assertEquals("Incorrect long min value", -19088976000089L, StrictMath.min(-20,
831                -19088976000089L));
832    }
833
834    /**
835     * @tests java.lang.StrictMath#pow(double, double)
836     */
837    @TestInfo(
838      level = TestLevel.PARTIAL,
839      purpose = "Doesn't check boundary values.",
840      targets = {
841        @TestTarget(
842          methodName = "pow",
843          methodArgs = {double.class, double.class}
844        )
845    })
846    public void test_powDD() {
847        // Test for method double java.lang.StrictMath.pow(double, double)
848        assertTrue("pow returned incorrect value",
849                (long) StrictMath.pow(2, 8) == 256l);
850        assertTrue("pow returned incorrect value",
851                StrictMath.pow(2, -8) == 0.00390625d);
852    }
853
854    /**
855     * @tests java.lang.StrictMath#rint(double)
856     */
857    @TestInfo(
858      level = TestLevel.COMPLETE,
859      purpose = "",
860      targets = {
861        @TestTarget(
862          methodName = "rint",
863          methodArgs = {double.class}
864        )
865    })
866    public void test_rintD() {
867        // Test for method double java.lang.StrictMath.rint(double)
868        assertEquals("Failed to round properly - up to odd",
869                3.0, StrictMath.rint(2.9), 0D);
870        assertTrue("Failed to round properly - NaN", Double.isNaN(StrictMath
871                .rint(Double.NaN)));
872        assertEquals("Failed to round properly down  to even", 2.0, StrictMath
873                .rint(2.1), 0D);
874        assertTrue("Failed to round properly " + 2.5 + " to even", StrictMath
875                .rint(2.5) == 2.0);
876    }
877
878    /**
879     * @tests java.lang.StrictMath#round(double)
880     */
881    @TestInfo(
882      level = TestLevel.PARTIAL,
883      purpose = "Doesn't check boundary values.",
884      targets = {
885        @TestTarget(
886          methodName = "round",
887          methodArgs = {double.class}
888        )
889    })
890    public void test_roundD() {
891        // Test for method long java.lang.StrictMath.round(double)
892        assertEquals("Incorrect rounding of a float",
893                -91, StrictMath.round(-90.89d));
894    }
895
896    /**
897     * @tests java.lang.StrictMath#round(float)
898     */
899    @TestInfo(
900      level = TestLevel.PARTIAL,
901      purpose = "Doesn't check boundary values.",
902      targets = {
903        @TestTarget(
904          methodName = "round",
905          methodArgs = {float.class}
906        )
907    })
908    public void test_roundF() {
909        // Test for method int java.lang.StrictMath.round(float)
910        assertEquals("Incorrect rounding of a float",
911                -91, StrictMath.round(-90.89f));
912    }
913
914    /**
915     * @tests java.lang.StrictMath#signum(double)
916     */
917    @TestInfo(
918      level = TestLevel.COMPLETE,
919      purpose = "",
920      targets = {
921        @TestTarget(
922          methodName = "signum",
923          methodArgs = {double.class}
924        )
925    })
926    public void test_signum_D() {
927        assertTrue(Double.isNaN(StrictMath.signum(Double.NaN)));
928        assertEquals(Double.doubleToLongBits(0.0), Double
929                .doubleToLongBits(StrictMath.signum(0.0)));
930        assertEquals(Double.doubleToLongBits(+0.0), Double
931                .doubleToLongBits(StrictMath.signum(+0.0)));
932        assertEquals(Double.doubleToLongBits(-0.0), Double
933                .doubleToLongBits(StrictMath.signum(-0.0)));
934
935        assertEquals(1.0, StrictMath.signum(253681.2187962), 0D);
936        assertEquals(-1.0, StrictMath.signum(-125874693.56), 0D);
937        assertEquals(1.0, StrictMath.signum(1.2587E-308), 0D);
938        assertEquals(-1.0, StrictMath.signum(-1.2587E-308), 0D);
939
940        assertEquals(1.0, StrictMath.signum(Double.MAX_VALUE), 0D);
941        assertEquals(1.0, StrictMath.signum(Double.MIN_VALUE), 0D);
942        assertEquals(-1.0, StrictMath.signum(-Double.MAX_VALUE), 0D);
943        assertEquals(-1.0, StrictMath.signum(-Double.MIN_VALUE), 0D);
944        assertEquals(1.0, StrictMath.signum(Double.POSITIVE_INFINITY), 0D);
945        assertEquals(-1.0, StrictMath.signum(Double.NEGATIVE_INFINITY), 0D);
946
947    }
948
949    /**
950     * @tests java.lang.StrictMath#signum(float)
951     */
952    @TestInfo(
953      level = TestLevel.COMPLETE,
954      purpose = "",
955      targets = {
956        @TestTarget(
957          methodName = "signum",
958          methodArgs = {float.class}
959        )
960    })
961    public void test_signum_F() {
962        assertTrue(Float.isNaN(StrictMath.signum(Float.NaN)));
963        assertEquals(Float.floatToIntBits(0.0f), Float
964                .floatToIntBits(StrictMath.signum(0.0f)));
965        assertEquals(Float.floatToIntBits(+0.0f), Float
966                .floatToIntBits(StrictMath.signum(+0.0f)));
967        assertEquals(Float.floatToIntBits(-0.0f), Float
968                .floatToIntBits(StrictMath.signum(-0.0f)));
969
970        assertEquals(1.0f, StrictMath.signum(253681.2187962f), 0f);
971        assertEquals(-1.0f, StrictMath.signum(-125874693.56f), 0f);
972        assertEquals(1.0f, StrictMath.signum(1.2587E-11f), 0f);
973        assertEquals(-1.0f, StrictMath.signum(-1.2587E-11f), 0f);
974
975        assertEquals(1.0f, StrictMath.signum(Float.MAX_VALUE), 0f);
976        assertEquals(1.0f, StrictMath.signum(Float.MIN_VALUE), 0f);
977        assertEquals(-1.0f, StrictMath.signum(-Float.MAX_VALUE), 0f);
978        assertEquals(-1.0f, StrictMath.signum(-Float.MIN_VALUE), 0f);
979        assertEquals(1.0f, StrictMath.signum(Float.POSITIVE_INFINITY), 0f);
980        assertEquals(-1.0f, StrictMath.signum(Float.NEGATIVE_INFINITY), 0f);
981    }
982
983    /**
984     * @tests java.lang.StrictMath#sin(double)
985     */
986    @TestInfo(
987      level = TestLevel.PARTIAL,
988      purpose = "Doesn't check boundary value.",
989      targets = {
990        @TestTarget(
991          methodName = "sin",
992          methodArgs = {double.class}
993        )
994    })
995    public void test_sinD() {
996        // Test for method double java.lang.StrictMath.sin(double)
997        assertTrue("Returned incorrect sine", StrictMath.sin(StrictMath
998                .asin(OPP / HYP)) == OPP / HYP);
999    }
1000
1001    /**
1002     * @tests java.lang.StrictMath#sinh(double)
1003     */
1004    @TestInfo(
1005      level = TestLevel.COMPLETE,
1006      purpose = "",
1007      targets = {
1008        @TestTarget(
1009          methodName = "sinh",
1010          methodArgs = {double.class}
1011        )
1012    })
1013    public void test_sinh_D() {
1014        // Test for special situations
1015        assertTrue(Double.isNaN(StrictMath.sinh(Double.NaN)));
1016        assertEquals("Should return POSITIVE_INFINITY",
1017                Double.POSITIVE_INFINITY, StrictMath
1018                        .sinh(Double.POSITIVE_INFINITY), 0D);
1019        assertEquals("Should return NEGATIVE_INFINITY",
1020                Double.NEGATIVE_INFINITY, StrictMath
1021                        .sinh(Double.NEGATIVE_INFINITY), 0D);
1022        assertEquals(Double.doubleToLongBits(0.0), Double
1023                .doubleToLongBits(StrictMath.sinh(0.0)));
1024        assertEquals(Double.doubleToLongBits(+0.0), Double
1025                .doubleToLongBits(StrictMath.sinh(+0.0)));
1026        assertEquals(Double.doubleToLongBits(-0.0), Double
1027                .doubleToLongBits(StrictMath.sinh(-0.0)));
1028
1029        assertEquals("Should return POSITIVE_INFINITY",
1030                Double.POSITIVE_INFINITY, StrictMath.sinh(1234.56), 0D);
1031        assertEquals("Should return NEGATIVE_INFINITY",
1032                Double.NEGATIVE_INFINITY, StrictMath.sinh(-1234.56), 0D);
1033        assertEquals("Should return 1.0000000000001666E-6",
1034                1.0000000000001666E-6, StrictMath.sinh(0.000001), 0D);
1035        assertEquals("Should return -1.0000000000001666E-6",
1036                -1.0000000000001666E-6, StrictMath.sinh(-0.000001), 0D);
1037        assertEquals("Should return 5.115386441963859", 5.115386441963859,
1038                StrictMath.sinh(2.33482), 0D);
1039        assertEquals("Should return POSITIVE_INFINITY",
1040                Double.POSITIVE_INFINITY, StrictMath.sinh(Double.MAX_VALUE), 0D);
1041        assertEquals("Should return 4.9E-324", 4.9E-324, StrictMath
1042                .sinh(Double.MIN_VALUE), 0D);
1043    }
1044
1045    /**
1046     * @tests java.lang.StrictMath#sqrt(double)
1047     */
1048    @TestInfo(
1049      level = TestLevel.PARTIAL,
1050      purpose = "Doesn't check boundary values.",
1051      targets = {
1052        @TestTarget(
1053          methodName = "sqrt",
1054          methodArgs = {double.class}
1055        )
1056    })
1057    public void test_sqrtD() {
1058        // Test for method double java.lang.StrictMath.sqrt(double)
1059        assertEquals("Incorrect root returned1",
1060                             2, StrictMath.sqrt(StrictMath.pow(StrictMath.sqrt(2), 4)), 0.0);
1061        assertEquals("Incorrect root returned2", 7, StrictMath.sqrt(49), 0.0);
1062    }
1063
1064    /**
1065     * @tests java.lang.StrictMath#tan(double)
1066     */
1067    @TestInfo(
1068      level = TestLevel.PARTIAL,
1069      purpose = "Doesn't check boundary values.",
1070      targets = {
1071        @TestTarget(
1072          methodName = "tan",
1073          methodArgs = {double.class}
1074        )
1075    })
1076    public void test_tanD() {
1077        // Test for method double java.lang.StrictMath.tan(double)
1078        assertTrue(
1079                "Returned incorrect tangent: ",
1080                StrictMath.tan(StrictMath.atan(1.0)) <= 1.0
1081                        || StrictMath.tan(StrictMath.atan(1.0)) >= 9.9999999999999983E-1);
1082    }
1083
1084    /**
1085     * @tests java.lang.StrictMath#tanh(double)
1086     */
1087    @TestInfo(
1088      level = TestLevel.COMPLETE,
1089      purpose = "",
1090      targets = {
1091        @TestTarget(
1092          methodName = "tanh",
1093          methodArgs = {double.class}
1094        )
1095    })
1096    public void test_tanh_D() {
1097        // Test for special situations
1098        assertTrue(Double.isNaN(StrictMath.tanh(Double.NaN)));
1099        assertEquals("Should return +1.0", +1.0, StrictMath
1100                .tanh(Double.POSITIVE_INFINITY), 0D);
1101        assertEquals("Should return -1.0", -1.0, StrictMath
1102                .tanh(Double.NEGATIVE_INFINITY), 0D);
1103        assertEquals(Double.doubleToLongBits(0.0), Double
1104                .doubleToLongBits(StrictMath.tanh(0.0)));
1105        assertEquals(Double.doubleToLongBits(+0.0), Double
1106                .doubleToLongBits(StrictMath.tanh(+0.0)));
1107        assertEquals(Double.doubleToLongBits(-0.0), Double
1108                .doubleToLongBits(StrictMath.tanh(-0.0)));
1109
1110        assertEquals("Should return 1.0", 1.0, StrictMath.tanh(1234.56), 0D);
1111        assertEquals("Should return -1.0", -1.0, StrictMath.tanh(-1234.56), 0D);
1112        assertEquals("Should return 9.999999999996666E-7",
1113                9.999999999996666E-7, StrictMath.tanh(0.000001), 0D);
1114        assertEquals("Should return 0.981422884124941", 0.981422884124941,
1115                StrictMath.tanh(2.33482), 0D);
1116        assertEquals("Should return 1.0", 1.0, StrictMath
1117                .tanh(Double.MAX_VALUE), 0D);
1118        assertEquals("Should return 4.9E-324", 4.9E-324, StrictMath
1119                .tanh(Double.MIN_VALUE), 0D);
1120    }
1121
1122    /**
1123     * @tests java.lang.StrictMath#random()
1124     */
1125    @TestInfo(
1126      level = TestLevel.COMPLETE,
1127      purpose = "",
1128      targets = {
1129        @TestTarget(
1130          methodName = "random",
1131          methodArgs = {}
1132        )
1133    })
1134    public void test_random() {
1135        // There isn't a place for these tests so just stick them here
1136        assertEquals("Wrong value E",
1137                4613303445314885481L, Double.doubleToLongBits(StrictMath.E));
1138        assertEquals("Wrong value PI",
1139                4614256656552045848L, Double.doubleToLongBits(StrictMath.PI));
1140
1141        for (int i = 500; i >= 0; i--) {
1142            double d = StrictMath.random();
1143            assertTrue("Generated number is out of range: " + d, d >= 0.0
1144                    && d < 1.0);
1145        }
1146    }
1147
1148    /**
1149     * @tests java.lang.StrictMath#toRadians(double)
1150     */
1151    @TestInfo(
1152      level = TestLevel.COMPLETE,
1153      purpose = "",
1154      targets = {
1155        @TestTarget(
1156          methodName = "toRadians",
1157          methodArgs = {double.class}
1158        )
1159    })
1160    public void test_toRadiansD() {
1161        for (double d = 500; d >= 0; d -= 1.0) {
1162            double converted = StrictMath.toDegrees(StrictMath.toRadians(d));
1163            assertTrue("Converted number not equal to original. d = " + d,
1164                    converted >= d * 0.99999999 && converted <= d * 1.00000001);
1165        }
1166    }
1167
1168    /**
1169     * @tests java.lang.StrictMath#toDegrees(double)
1170     */
1171    @TestInfo(
1172      level = TestLevel.COMPLETE,
1173      purpose = "",
1174      targets = {
1175        @TestTarget(
1176          methodName = "toDegrees",
1177          methodArgs = {double.class}
1178        )
1179    })
1180    public void test_toDegreesD() {
1181        for (double d = 500; d >= 0; d -= 1.0) {
1182            double converted = StrictMath.toRadians(StrictMath.toDegrees(d));
1183            assertTrue("Converted number not equal to original. d = " + d,
1184                    converted >= d * 0.99999999 && converted <= d * 1.00000001);
1185        }
1186    }
1187
1188    /**
1189     * @tests java.lang.StrictMath#ulp(double)
1190     */
1191    @TestInfo(
1192      level = TestLevel.COMPLETE,
1193      purpose = "",
1194      targets = {
1195        @TestTarget(
1196          methodName = "ulp",
1197          methodArgs = {double.class}
1198        )
1199    })
1200     @SuppressWarnings("boxing")
1201    public void test_ulp_D() {
1202        // Test for special cases
1203        assertTrue("Should return NaN", Double
1204                .isNaN(StrictMath.ulp(Double.NaN)));
1205        assertEquals("Returned incorrect value", Double.POSITIVE_INFINITY,
1206                StrictMath.ulp(Double.POSITIVE_INFINITY), 0D);
1207        assertEquals("Returned incorrect value", Double.POSITIVE_INFINITY,
1208                StrictMath.ulp(Double.NEGATIVE_INFINITY), 0D);
1209        assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
1210                .ulp(0.0), 0D);
1211        assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
1212                .ulp(+0.0), 0D);
1213        assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
1214                .ulp(-0.0), 0D);
1215        assertEquals("Returned incorrect value", StrictMath.pow(2, 971),
1216                StrictMath.ulp(Double.MAX_VALUE), 0D);
1217        assertEquals("Returned incorrect value", StrictMath.pow(2, 971),
1218                StrictMath.ulp(-Double.MAX_VALUE), 0D);
1219
1220        assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
1221                .ulp(Double.MIN_VALUE), 0D);
1222        assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
1223                .ulp(-Double.MIN_VALUE), 0D);
1224
1225        assertEquals("Returned incorrect value", 2.220446049250313E-16,
1226                StrictMath.ulp(1.0), 0D);
1227        assertEquals("Returned incorrect value", 2.220446049250313E-16,
1228                StrictMath.ulp(-1.0), 0D);
1229        assertEquals("Returned incorrect value", 2.2737367544323206E-13,
1230                StrictMath.ulp(1153.0), 0D);
1231    }
1232
1233    /**
1234     * @tests java.lang.StrictMath#ulp(float)
1235     */
1236    @TestInfo(
1237      level = TestLevel.COMPLETE,
1238      purpose = "",
1239      targets = {
1240        @TestTarget(
1241          methodName = "ulp",
1242          methodArgs = {float.class}
1243        )
1244    })
1245    @SuppressWarnings("boxing")
1246    public void test_ulp_f() {
1247        // Test for special cases
1248        assertTrue("Should return NaN", Float.isNaN(StrictMath.ulp(Float.NaN)));
1249        assertEquals("Returned incorrect value", Float.POSITIVE_INFINITY,
1250                StrictMath.ulp(Float.POSITIVE_INFINITY), 0f);
1251        assertEquals("Returned incorrect value", Float.POSITIVE_INFINITY,
1252                StrictMath.ulp(Float.NEGATIVE_INFINITY), 0f);
1253        assertEquals("Returned incorrect value", Float.MIN_VALUE, StrictMath
1254                .ulp(0.0f), 0f);
1255        assertEquals("Returned incorrect value", Float.MIN_VALUE, StrictMath
1256                .ulp(+0.0f), 0f);
1257        assertEquals("Returned incorrect value", Float.MIN_VALUE, StrictMath
1258                .ulp(-0.0f), 0f);
1259        assertEquals("Returned incorrect value", 2.028241E31f, StrictMath
1260                .ulp(Float.MAX_VALUE), 0f);
1261        assertEquals("Returned incorrect value", 2.028241E31f, StrictMath
1262                .ulp(-Float.MAX_VALUE), 0f);
1263
1264        assertEquals("Returned incorrect value", 1.4E-45f, StrictMath
1265                .ulp(Float.MIN_VALUE), 0f);
1266        assertEquals("Returned incorrect value", 1.4E-45f, StrictMath
1267                .ulp(-Float.MIN_VALUE), 0f);
1268
1269        assertEquals("Returned incorrect value", 1.1920929E-7f, StrictMath
1270                .ulp(1.0f), 0f);
1271        assertEquals("Returned incorrect value", 1.1920929E-7f, StrictMath
1272                .ulp(-1.0f), 0f);
1273        assertEquals("Returned incorrect value", 1.2207031E-4f, StrictMath
1274                .ulp(1153.0f), 0f);
1275        assertEquals("Returned incorrect value", 5.6E-45f, Math
1276                .ulp(9.403954E-38f), 0f);
1277    }
1278}
1279