Home | History | Annotate | Download | only in lang

Lines Matching defs:StrictMath

24     private final double HYP = StrictMath.sqrt(2.0);
34 // Test for method double java.lang.StrictMath.abs(double)
37 (StrictMath.abs(-1908.8976) == 1908.8976));
39 (StrictMath.abs(1908.8976) == 1908.8976));
43 // Test for method float java.lang.StrictMath.abs(float)
45 (StrictMath.abs(-1908.8976f) == 1908.8976f));
47 (StrictMath.abs(1908.8976f) == 1908.8976f));
51 // Test for method int java.lang.StrictMath.abs(int)
53 (StrictMath.abs(-1908897) == 1908897));
55 (StrictMath.abs(1908897) == 1908897));
59 // Test for method long java.lang.StrictMath.abs(long)
60 assertTrue("Incorrect long abs value", (StrictMath
63 (StrictMath.abs(19088976000089L) == 19088976000089L));
67 // Test for method double java.lang.StrictMath.acos(double)
68 assertTrue("Returned incorrect arc cosine", StrictMath.cos(StrictMath
73 // Test for method double java.lang.StrictMath.asin(double)
74 assertTrue("Returned incorrect arc sine", StrictMath.sin(StrictMath
79 // Test for method double java.lang.StrictMath.atan(double)
80 double answer = StrictMath.tan(StrictMath.atan(1.0));
86 // Test for method double java.lang.StrictMath.atan2(double, double)
87 double answer = StrictMath.atan(StrictMath.tan(1.0));
95 assertTrue("Should return Double.NaN", Double.isNaN(StrictMath
98 Double.POSITIVE_INFINITY, StrictMath
101 Double.NEGATIVE_INFINITY, StrictMath
104 .doubleToLongBits(StrictMath.cbrt(0.0)));
106 .doubleToLongBits(StrictMath.cbrt(+0.0)));
108 .doubleToLongBits(StrictMath.cbrt(-0.0)));
110 assertEquals("Should return 3.0", 3.0, StrictMath.cbrt(27.0));
112 StrictMath.cbrt(12345.6));
114 5.643803094122362E102, StrictMath.cbrt(Double.MAX_VALUE));
115 assertEquals("Should return 0.01", 0.01, StrictMath.cbrt(0.000001));
117 assertEquals("Should return -3.0", -3.0, StrictMath.cbrt(-27.0));
119 StrictMath.cbrt(-12345.6));
121 1.7031839360032603E-108, StrictMath.cbrt(Double.MIN_VALUE));
122 assertEquals("Should return -0.01", -0.01, StrictMath.cbrt(-0.000001));
125 StrictMath.cbrt((Double) null);
133 // Test for method double java.lang.StrictMath.ceil(double)
135 79, StrictMath.ceil(78.89), 0.0);
137 -78, StrictMath.ceil(-78.89), 0.0);
141 // Test for method double java.lang.StrictMath.cos(double)
143 assertTrue("Returned incorrect cosine", StrictMath.cos(StrictMath
150 assertTrue("Should return NaN", Double.isNaN(StrictMath
153 Double.POSITIVE_INFINITY, StrictMath
156 Double.POSITIVE_INFINITY, StrictMath
158 assertEquals("Should return 1.0", 1.0, StrictMath.cosh(+0.0));
159 assertEquals("Should return 1.0", 1.0, StrictMath.cosh(-0.0));
162 Double.POSITIVE_INFINITY, StrictMath.cosh(1234.56));
164 Double.POSITIVE_INFINITY, StrictMath.cosh(-1234.56));
166 StrictMath.cosh(0.000001));
168 StrictMath.cosh(-0.000001));
170 StrictMath.cosh(2.33482));
173 Double.POSITIVE_INFINITY, StrictMath.cosh(Double.MAX_VALUE));
174 assertEquals("Should return 1.0", 1.0, StrictMath
179 // Test for method double java.lang.StrictMath.exp(double)
180 assertTrue("Incorrect answer returned for simple power", StrictMath
181 .abs(StrictMath.exp(4D) - StrictMath.E * StrictMath.E
182 * StrictMath.E * StrictMath.E) < 0.1D);
183 assertTrue("Incorrect answer returned for larger power", StrictMath
184 .log(StrictMath.abs(StrictMath.exp(5.5D)) - 5.5D) < 10.0D);
190 assertTrue("Should return NaN", Double.isNaN(StrictMath.expm1(Double.NaN)));
192 Double.POSITIVE_INFINITY, StrictMath.expm1(Double.POSITIVE_INFINITY));
193 assertEquals("Should return -1.0", -1.0, StrictMath
196 .doubleToLongBits(StrictMath.expm1(0.0)));
198 .doubleToLongBits(StrictMath.expm1(+0.0)));
200 .doubleToLongBits(StrictMath.expm1(-0.0)));
203 -9.999950000166666E-6, StrictMath.expm1(-0.00001));
205 1.0145103074469635E60, StrictMath.expm1(138.16951162));
207 Double.POSITIVE_INFINITY, StrictMath
210 Double.POSITIVE_INFINITY, StrictMath.expm1(Double.MAX_VALUE));
211 assertEquals("Should return MIN_VALUE", Double.MIN_VALUE, StrictMath
217 // Test for method double java.lang.StrictMath.floor(double)
219 78, StrictMath.floor(78.89), 0.0);
221 -79, StrictMath.floor(-78.89), 0.0);
228 Double.POSITIVE_INFINITY, StrictMath.hypot(Double.POSITIVE_INFINITY,
231 Double.POSITIVE_INFINITY, StrictMath.hypot(Double.NEGATIVE_INFINITY,
234 Double.POSITIVE_INFINITY, StrictMath.hypot(-758.2587,
237 Double.POSITIVE_INFINITY, StrictMath.hypot(5687.21,
240 Double.POSITIVE_INFINITY, StrictMath.hypot(Double.POSITIVE_INFINITY,
243 Double.POSITIVE_INFINITY, StrictMath.hypot(Double.NEGATIVE_INFINITY,
245 assertTrue("Should return NaN", Double.isNaN(StrictMath.hypot(Double.NaN,
247 assertTrue("Should return NaN", Double.isNaN(StrictMath.hypot(-345.2680,
250 assertEquals("Should return 2396424.905416697", 2396424.905416697, StrictMath
253 StrictMath.hypot(-138.16951162, 0.13817035864));
255 1.7976931348623157E308, StrictMath.hypot(Double.MAX_VALUE, 211370.35));
256 assertEquals("Should return 5413.7185", 5413.7185, StrictMath.hypot(
262 // Test for method double java.lang.StrictMath.IEEEremainder(double,
264 assertEquals("Incorrect remainder returned", 0.0, StrictMath.IEEEremainder(
268 StrictMath.IEEEremainder(1.32, 89.765) >= 1.4705063220631647E-2
269 || StrictMath.IEEEremainder(1.32, 89.765) >= 1.4705063220631649E-2);
273 // Test for method double java.lang.StrictMath.log(double)
275 double answer = StrictMath.log(StrictMath.exp(d));
278 StrictMath.abs(answer - d) <= StrictMath
286 assertTrue("Should return NaN", Double.isNaN(StrictMath
288 assertTrue("Should return NaN", Double.isNaN(StrictMath
291 Double.POSITIVE_INFINITY, StrictMath
294 Double.NEGATIVE_INFINITY, StrictMath.log10(0.0));
296 Double.NEGATIVE_INFINITY, StrictMath.log10(+0.0));
298 Double.NEGATIVE_INFINITY, StrictMath.log10(-0.0));
299 assertEquals("Should return 14.0", 14.0, StrictMath.log10(StrictMath
303 StrictMath.log10(5482.2158));
305 StrictMath.log10(458723662312872.125782332587));
307 StrictMath.log10(0.12348583358871));
309 StrictMath.log10(Double.MAX_VALUE));
311 StrictMath.log10(Double.MIN_VALUE));
317 assertTrue("Should return NaN", Double.isNaN(StrictMath
319 assertTrue("Should return NaN", Double.isNaN(StrictMath
322 Double.POSITIVE_INFINITY, StrictMath
325 .doubleToLongBits(StrictMath.log1p(0.0)));
327 .doubleToLongBits(StrictMath.log1p(+0.0)));
329 .doubleToLongBits(StrictMath.log1p(-0.0)));
332 StrictMath.log1p(-0.254856327));
334 StrictMath.log1p(1583.542));
336 StrictMath.log1p(0.5894227));
338 StrictMath.log1p(Double.MAX_VALUE));
340 StrictMath.log1p(Double.MIN_VALUE));
344 // Test for method double java.lang.StrictMath.max(double, double)
345 assertEquals("Incorrect double max value", 1908897.6000089, StrictMath.max(
347 assertEquals("Incorrect double max value", 1908897.6000089, StrictMath.max(2.0,
349 assertEquals("Incorrect double max value", -2.0, StrictMath.max(-2.0,
355 // Test for method float java.lang.StrictMath.max(float, float)
356 assertTrue("Incorrect float max value", StrictMath.max(-1908897.600f,
358 assertTrue("Incorrect float max value", StrictMath.max(2.0f,
360 assertTrue("Incorrect float max value", StrictMath.max(-2.0f,
365 // Test for method int java.lang.StrictMath.max(int, int)
366 assertEquals("Incorrect int max value", 19088976, StrictMath.max(-19088976,
369 19088976, StrictMath.max(20, 19088976));
371 -20, StrictMath.max(-20, -19088976));
375 // Test for method long java.lang.StrictMath.max(long, long)
376 assertEquals("Incorrect long max value", 19088976000089L, StrictMath.max(-19088976000089L,
378 assertEquals("Incorrect long max value", 19088976000089L, StrictMath.max(20,
380 assertEquals("Incorrect long max value", -20, StrictMath.max(-20,
385 // Test for method double java.lang.StrictMath.min(double, double)
386 assertEquals("Incorrect double min value", -1908897.6000089, StrictMath.min(
388 assertEquals("Incorrect double min value", 2.0, StrictMath.min(2.0,
390 assertEquals("Incorrect double min value", -1908897.6000089, StrictMath.min(-2.0,
395 // Test for method float java.lang.StrictMath.min(float, float)
396 assertTrue("Incorrect float min value", StrictMath.min(-1908897.600f,
398 assertTrue("Incorrect float min value", StrictMath.min(2.0f,
400 assertTrue("Incorrect float min value", StrictMath.min(-2.0f,
405 // Test for method int java.lang.StrictMath.min(int, int)
406 assertEquals("Incorrect int min value", -19088976, StrictMath.min(-19088976,
409 20, StrictMath.min(20, 19088976));
411 -19088976, StrictMath.min(-20, -19088976));
416 // Test for method long java.lang.StrictMath.min(long, long)
417 assertEquals("Incorrect long min value", -19088976000089L, StrictMath.min(-19088976000089L,
419 assertEquals("Incorrect long min value", 20, StrictMath.min(20,
421 assertEquals("Incorrect long min value", -19088976000089L, StrictMath.min(-20,
426 // Test for method double java.lang.StrictMath.pow(double, double)
428 (long) StrictMath.pow(2, 8) == 256l);
430 StrictMath.pow(2, -8) == 0.00390625d);
434 // Test for method double java.lang.StrictMath.rint(double)
436 3.0, StrictMath.rint(2.9), 0D);
437 assertTrue("Failed to round properly - NaN", Double.isNaN(StrictMath
439 assertEquals("Failed to round properly down to even", 2.0, StrictMath
441 assertTrue("Failed to round properly " + 2.5 + " to even", StrictMath
446 // Test for method long java.lang.StrictMath.round(double)
448 -91, StrictMath.round(-90.89d));
452 // Test for method int java.lang.StrictMath.round(float)
454 -91, StrictMath.round(-90.89f));
458 assertTrue(Double.isNaN(StrictMath.signum(Double.NaN)));
460 .doubleToLongBits(StrictMath.signum(0.0)));
462 .doubleToLongBits(StrictMath.signum(+0.0)));
464 .doubleToLongBits(StrictMath.signum(-0.0)));
466 assertEquals(1.0, StrictMath.signum(253681.2187962), 0D);
467 assertEquals(-1.0, StrictMath.signum(-125874693.56), 0D);
468 assertEquals(1.0, StrictMath.signum(1.2587E-308), 0D);
469 assertEquals(-1.0, StrictMath.signum(-1.2587E-308), 0D);
471 assertEquals(1.0, StrictMath.signum(Double.MAX_VALUE), 0D);
472 assertEquals(1.0, StrictMath.signum(Double.MIN_VALUE), 0D);
473 assertEquals(-1.0, StrictMath.signum(-Double.MAX_VALUE), 0D);
474 assertEquals(-1.0, StrictMath.signum(-Double.MIN_VALUE), 0D);
475 assertEquals(1.0, StrictMath.signum(Double.POSITIVE_INFINITY), 0D);
476 assertEquals(-1.0, StrictMath.signum(Double.NEGATIVE_INFINITY), 0D);
481 assertTrue(Float.isNaN(StrictMath.signum(Float.NaN)));
483 .floatToIntBits(StrictMath.signum(0.0f)));
485 .floatToIntBits(StrictMath.signum(+0.0f)));
487 .floatToIntBits(StrictMath.signum(-0.0f)));
489 assertEquals(1.0f, StrictMath.signum(253681.2187962f), 0f);
490 assertEquals(-1.0f, StrictMath.signum(-125874693.56f), 0f);
491 assertEquals(1.0f, StrictMath.signum(1.2587E-11f), 0f);
492 assertEquals(-1.0f, StrictMath.signum(-1.2587E-11f), 0f);
494 assertEquals(1.0f, StrictMath.signum(Float.MAX_VALUE), 0f);
495 assertEquals(1.0f, StrictMath.signum(Float.MIN_VALUE), 0f);
496 assertEquals(-1.0f, StrictMath.signum(-Float.MAX_VALUE), 0f);
497 assertEquals(-1.0f, StrictMath.signum(-Float.MIN_VALUE), 0f);
498 assertEquals(1.0f, StrictMath.signum(Float.POSITIVE_INFINITY), 0f);
499 assertEquals(-1.0f, StrictMath.signum(Float.NEGATIVE_INFINITY), 0f);
503 // Test for method double java.lang.StrictMath.sin(double)
504 assertTrue("Returned incorrect sine", StrictMath.sin(StrictMath
510 assertTrue(Double.isNaN(StrictMath.sinh(Double.NaN)));
512 Double.POSITIVE_INFINITY, StrictMath
515 Double.NEGATIVE_INFINITY, StrictMath
518 .doubleToLongBits(StrictMath.sinh(0.0)));
520 .doubleToLongBits(StrictMath.sinh(+0.0)));
522 .doubleToLongBits(StrictMath.sinh(-0.0)));
525 Double.POSITIVE_INFINITY, StrictMath.sinh(1234.56), 0D);
527 Double.NEGATIVE_INFINITY, StrictMath.sinh(-1234.56), 0D);
529 1.0000000000001666E-6, StrictMath.sinh(0.000001), 0D);
531 -1.0000000000001666E-6, StrictMath.sinh(-0.000001), 0D);
533 StrictMath.sinh(2.33482), 0D);
535 Double.POSITIVE_INFINITY, StrictMath.sinh(Double.MAX_VALUE), 0D);
536 assertEquals("Should return 4.9E-324", 4.9E-324, StrictMath
541 // Test for method double java.lang.StrictMath.sqrt(double)
543 2, StrictMath.sqrt(StrictMath.pow(StrictMath.sqrt(2), 4)), 0.0);
544 assertEquals("Incorrect root returned2", 7, StrictMath.sqrt(49), 0.0);
548 // Test for method double java.lang.StrictMath.tan(double)
551 StrictMath.tan(StrictMath.atan(1.0)) <= 1.0
552 || StrictMath.tan(StrictMath.atan(1.0)) >= 9.9999999999999983E-1);
557 assertTrue(Double.isNaN(StrictMath.tanh(Double.NaN)));
558 assertEquals("Should return +1.0", +1.0, StrictMath
560 assertEquals("Should return -1.0", -1.0, StrictMath
563 .doubleToLongBits(StrictMath.tanh(0.0)));
565 .doubleToLongBits(StrictMath.tanh(+0.0)));
567 .doubleToLongBits(StrictMath.tanh(-0.0)));
569 assertEquals("Should return 1.0", 1.0, StrictMath.tanh(1234.56), 0D);
570 assertEquals("Should return -1.0", -1.0, StrictMath.tanh(-1234.56), 0D);
572 9.999999999996666E-7, StrictMath.tanh(0.000001), 0D);
574 StrictMath.tanh(2.33482), 0D);
575 assertEquals("Should return 1.0", 1.0, StrictMath
577 assertEquals("Should return 4.9E-324", 4.9E-324, StrictMath
584 4613303445314885481L, Double.doubleToLongBits(StrictMath.E));
586 4614256656552045848L, Double.doubleToLongBits(StrictMath.PI));
589 double d = StrictMath.random();
597 double converted = StrictMath.toDegrees(StrictMath.toRadians(d));
605 double converted = StrictMath.toRadians(StrictMath.toDegrees(d));
615 .isNaN(StrictMath.ulp(Double.NaN)));
617 StrictMath.ulp(Double.POSITIVE_INFINITY), 0D);
619 StrictMath.ulp(Double.NEGATIVE_INFINITY), 0D);
620 assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
622 assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
624 assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
626 assertEquals("Returned incorrect value", StrictMath.pow(2, 971),
627 StrictMath.ulp(Double.MAX_VALUE), 0D);
628 assertEquals("Returned incorrect value", StrictMath.pow(2, 971),
629 StrictMath.ulp(-Double.MAX_VALUE), 0D);
631 assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
633 assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
637 StrictMath.ulp(1.0), 0D);
639 StrictMath.ulp(-1.0), 0D);
641 StrictMath.ulp(1153.0), 0D);
647 assertTrue("Should return NaN", Float.isNaN(StrictMath.ulp(Float.NaN)));
649 StrictMath.ulp(Float.POSITIVE_INFINITY), 0f);
651 StrictMath.ulp(Float.NEGATIVE_INFINITY), 0f);
652 assertEquals("Returned incorrect value", Float.MIN_VALUE, StrictMath
654 assertEquals("Returned incorrect value", Float.MIN_VALUE, StrictMath
656 assertEquals("Returned incorrect value", Float.MIN_VALUE, StrictMath
658 assertEquals("Returned incorrect value", 2.028241E31f, StrictMath
660 assertEquals("Returned incorrect value", 2.028241E31f, StrictMath
663 assertEquals("Returned incorrect value", 1.4E-45f, StrictMath
665 assertEquals("Returned incorrect value", 1.4E-45f, StrictMath
668 assertEquals("Returned incorrect value", 1.1920929E-7f, StrictMath
670 assertEquals("Returned incorrect value", 1.1920929E-7f, StrictMath
672 assertEquals("Returned incorrect value", 1.2207031E-4f, StrictMath