Home
last modified time | relevance | path

Searched refs:StrictMath (Results 1 – 25 of 52) sorted by relevance

123

/libcore/luni/src/test/java/libcore/java/lang/
DOldAndroidStrictMathTest.java24 private final double HYP = StrictMath.sqrt(2.0);
37 (StrictMath.abs(-1908.8976) == 1908.8976)); in testAbsD()
39 (StrictMath.abs(1908.8976) == 1908.8976)); in testAbsD()
45 (StrictMath.abs(-1908.8976f) == 1908.8976f)); in testAbsF()
47 (StrictMath.abs(1908.8976f) == 1908.8976f)); in testAbsF()
53 (StrictMath.abs(-1908897) == 1908897)); in testAbsI()
55 (StrictMath.abs(1908897) == 1908897)); in testAbsI()
60 assertTrue("Incorrect long abs value", (StrictMath in testAbsJ()
63 (StrictMath.abs(19088976000089L) == 19088976000089L)); in testAbsJ()
68 assertTrue("Returned incorrect arc cosine", StrictMath.cos(StrictMath in testAcosD()
[all …]
DIntrinsicTest.java67 StrictMath.abs(1); in testStrictMath_abs()
68 StrictMath.class.getMethod("abs", int.class).invoke(null, 1); in testStrictMath_abs()
69 StrictMath.abs(1L); in testStrictMath_abs()
70 StrictMath.class.getMethod("abs", long.class).invoke(null, 1L); in testStrictMath_abs()
71 StrictMath.abs(1.0f); in testStrictMath_abs()
72 StrictMath.class.getMethod("abs", float.class).invoke(null, 1.0f); in testStrictMath_abs()
73 StrictMath.abs(1.0); in testStrictMath_abs()
74 StrictMath.class.getMethod("abs", double.class).invoke(null, 1.0); in testStrictMath_abs()
78 StrictMath.min(1, 2); in testStrictMath_min()
79 StrictMath.class.getMethod("min", int.class, int.class).invoke(null, 1, 2); in testStrictMath_min()
[all …]
DStrictMathTest.java46 assertEquals(expected, StrictMath.addExact(a, b)); in testAddExactI()
57 assertEquals(expected, StrictMath.subtractExact(a, b)); in testSubtractExactI()
69 assertEquals(expected, StrictMath.multiplyExact(a, b)); in testMultiplyExactI()
99 assertEquals(expected, BigInteger.valueOf(StrictMath.addExact(a, b))); in testAddExactL()
110 assertEquals(expected, BigInteger.valueOf(StrictMath.subtractExact(a, b))); in testSubtractExactL()
121 assertEquals(expected, BigInteger.valueOf(StrictMath.multiplyExact(a, b))); in testMultiplyExactL()
131 assertEquals((int) a, StrictMath.toIntExact(a)); in testToIntExactL()
132 assertEquals(a, StrictMath.toIntExact(a)); // Is not exact, should throw AE. in testToIntExactL()
158 int floorDiv = StrictMath.floorDiv(a, b); in testFloorDivI()
173 int floorMod = StrictMath.floorMod(a, b); in testFloorModI()
[all …]
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/
DStrictMathTest.java32 private static final double HYP = StrictMath.sqrt(2.0);
48 (StrictMath.abs(-1908.8976) == 1908.8976)); in test_absD()
50 (StrictMath.abs(1908.8976) == 1908.8976)); in test_absD()
59 (StrictMath.abs(-1908.8976f) == 1908.8976f)); in test_absF()
61 (StrictMath.abs(1908.8976f) == 1908.8976f)); in test_absF()
70 (StrictMath.abs(-1908897) == 1908897)); in test_absI()
72 (StrictMath.abs(1908897) == 1908897)); in test_absI()
80 assertTrue("Incorrect long abs value", (StrictMath in test_absJ()
83 (StrictMath.abs(19088976000089L) == 19088976000089L)); in test_absJ()
91 assertTrue("Returned incorrect arc cosine", StrictMath.cos(StrictMath in test_acosD()
[all …]
/libcore/benchmarks/src/benchmarks/regression/
DStrictMathBenchmark.java61 StrictMath.abs(d); in timeAbsD()
67 StrictMath.abs(f); in timeAbsF()
73 StrictMath.abs(i); in timeAbsI()
79 StrictMath.abs(l); in timeAbsL()
85 StrictMath.acos(d); in timeAcos()
91 StrictMath.asin(d); in timeAsin()
97 StrictMath.atan(d); in timeAtan()
103 StrictMath.atan2(3, 4); in timeAtan2()
109 StrictMath.cbrt(d); in timeCbrt()
116 StrictMath.ceil(CEIL_DOUBLES[i]); in timeCeilOverInterestingValues()
[all …]
/libcore/luni/src/test/java/tests/java/lang/
DStrictMathTest.java35 assertEquals(0, StrictMath.absExact(0)); in test_absExact_int()
36 assertEquals(5, StrictMath.absExact(5)); in test_absExact_int()
37 assertEquals(5, StrictMath.absExact(-5)); in test_absExact_int()
38 assertEquals(Integer.MAX_VALUE, StrictMath.absExact(-Integer.MAX_VALUE)); in test_absExact_int()
39 assertEquals(Integer.MAX_VALUE, StrictMath.absExact(Integer.MAX_VALUE)); in test_absExact_int()
44 assertEquals(0L, StrictMath.absExact(0L)); in test_absExact_long()
45 assertEquals(5L, StrictMath.absExact(5L)); in test_absExact_long()
46 assertEquals(5L, StrictMath.absExact(-5L)); in test_absExact_long()
47 assertEquals(Long.MAX_VALUE, StrictMath.absExact(-Long.MAX_VALUE)); in test_absExact_long()
48 assertEquals(Long.MAX_VALUE, StrictMath.absExact(Long.MAX_VALUE)); in test_absExact_long()
/libcore/ojluni/src/main/native/
DStrictMath.c160 NATIVE_METHOD(StrictMath, cos, "(D)D"),
161 NATIVE_METHOD(StrictMath, sin, "(D)D"),
162 NATIVE_METHOD(StrictMath, tan, "(D)D"),
163 NATIVE_METHOD(StrictMath, asin, "(D)D"),
164 NATIVE_METHOD(StrictMath, acos, "(D)D"),
165 NATIVE_METHOD(StrictMath, atan, "(D)D"),
166 NATIVE_METHOD(StrictMath, exp, "(D)D"),
167 NATIVE_METHOD(StrictMath, log, "(D)D"),
168 NATIVE_METHOD(StrictMath, log10, "(D)D"),
169 NATIVE_METHOD(StrictMath, sqrt, "(D)D"),
[all …]
/libcore/ojluni/src/test/java/lang/Math/
DHyperbolicTests.java291 testSinhCaseWithUlpDiff(d, StrictMath.exp(d) * 0.5, 3.5); in testSinh()
331 double offset = StrictMath.log(0.5); in testSinh()
337 StrictMath.exp(input + offset) * in testSinh()
338 StrictMath.exp(offset - ((input + offset) - input)); in testSinh()
365 input, StrictMath.sinh(input), in testSinhCaseWithTolerance()
368 -input, StrictMath.sinh(-input), in testSinhCaseWithTolerance()
385 input, StrictMath.sinh(input), in testSinhCaseWithUlpDiff()
388 -input, StrictMath.sinh(-input), in testSinhCaseWithUlpDiff()
639 testCoshCaseWithUlpDiff(d, StrictMath.exp(d) * 0.5, 3.5); in testCosh()
679 double offset = StrictMath.log(0.5); in testCosh()
[all …]
DCubeRootTests.java61 StrictMath.cbrt(input), expected); in testCubeRootCase()
63 StrictMath.cbrt(minus_input), minus_expected); in testCubeRootCase()
180 double y2 = StrictMath.cbrt(d); in testCubeRoot()
182 err = d - StrictMath.pow(y1, 3); in testCubeRoot()
189 err_adjacent = StrictMath.pow(Math.nextUp(y1), 3) - d; in testCubeRoot()
191 err_adjacent = StrictMath.pow(Math.nextAfter(y1, 0.0), 3) - d; in testCubeRoot()
201 err = d - StrictMath.pow(y2, 3); in testCubeRoot()
208 err_adjacent = StrictMath.pow(Math.nextUp(y2), 3) - d; in testCubeRoot()
210 err_adjacent = StrictMath.pow(Math.nextAfter(y2, 0.0), 3) - d; in testCubeRoot()
252 pcNeighborsStrictCbrt[j] = StrictMath.cbrt(pcNeighbors[j]); in testCubeRoot()
[all …]
DWorstCaseTests.java106 Tests.testBounds("StrictMath.exp", input, StrictMath.exp(input), expected, out); in testExpCase()
134 Tests.testBounds("StrictMath.log", input, StrictMath.log(input), expected, out); in testLogCase()
163 Tests.testBounds("StrictMath.sin", input, StrictMath.sin(input), expected, out); in testSinCase()
191 Tests.testBounds("StrictMath.asin", input, StrictMath.asin(input), expected, out); in testAsinCase()
220 Tests.testBounds("StrictMath.cos", input, StrictMath.cos(input), expected, out); in testCosCase()
240 Tests.testBounds("StrictMath.acos", input, StrictMath.acos(input), expected, out); in testAcosCase()
265 Tests.testBounds("StrictMath.tan", input, StrictMath.tan(input), expected, out); in testTanCase()
293 Tests.testBounds("StrictMath.atan", input, StrictMath.atan(input), expected, out); in testAtanCase()
315 Tests.testBounds("StrictMath.pow2", input, StrictMath.pow(2, input), expected, out); in testPow2Case()
344 Tests.testBounds("StrictMath.sinh", input, StrictMath.sinh(input), expected, out); in testSinhCase()
[all …]
DLog10Tests.java42 static final double LN_10 = StrictMath.log(10.0);
52 StrictMath.log10(input), expected); in testLog10Case()
103 double expected = StrictMath.log(input) / LN_10; in testLog10()
118 ((result = StrictMath.log10(input)) - expected) / Math.ulp(expected)) in testLog10()
141 neighborsStrict[0] = StrictMath.log10(1.0); in testLog10()
166 neighborsStrict[i] = StrictMath.log10(input[i]); in testLog10()
DLog1pTests.java57 return (u == 1.0 ? x : StrictMath.log(u) * x / (u - 1)); in hp15cLogp()
109 testLog1pCaseWithUlpDiff(d, StrictMath.log(d), 2.001); in testLog1p()
145 double pc = StrictMath.pow(Math.E, i) - 1; in testLog1p()
155 pcNeighborsStrictLog1p[j] = StrictMath.log1p(pcNeighbors[j]); in testLog1p()
191 input, StrictMath.log1p(input), in testLog1pCaseWithUlpDiff()
DClamp.java75 …als("(int) StrictMath.clamp(" + value + ", " + min + ", " + max + ")", StrictMath.clamp(value, min… in testIntClamp()
84 () -> StrictMath.clamp(value, min, max)); in testIntClamp()
115 …ls("(long) StrictMath.clamp(" + value + ", " + min + ", " + max + ")", StrictMath.clamp(value, min… in testLongClamp()
124 () -> StrictMath.clamp(value, min, max)); in testLongClamp()
179 …("(double) StrictMath.clamp(" + value + ", " + min + ", " + max + ")", StrictMath.clamp(value, min… in testDoubleClamp()
188 () -> StrictMath.clamp(value, min, max)); in testDoubleClamp()
243 …s("(float) StrictMath.clamp(" + value + ", " + min + ", " + max + ")", StrictMath.clamp(value, min… in testFloatClamp()
252 () -> StrictMath.clamp(value, min, max)); in testFloatClamp()
DIeeeRecommendedTests.java106 StrictMath.getExponent(f), expected); in testGetExponentCase()
108 StrictMath.getExponent(minus_f), expected); in testGetExponentCase()
123 StrictMath.getExponent(d), expected); in testGetExponentCase()
125 StrictMath.getExponent(minus_d), expected); in testGetExponentCase()
340 StrictMath.nextAfter(start, direction), expected); in testNextAfterCase()
342 StrictMath.nextAfter(minus_start, minus_direction), minus_expected); in testNextAfterCase()
356 StrictMath.nextAfter(start, direction), expected); in testNextAfterCase()
358 StrictMath.nextAfter(minus_start, minus_direction), minus_expected); in testNextAfterCase()
529 testCase[0], StrictMath.nextUp(testCase[0]), testCase[1]); in testFloatNextUp()
563 testCase[0], StrictMath.nextUp(testCase[0]), testCase[1]); in testDoubleNextUp()
[all …]
DExpm1Tests.java97 testExpm1CaseWithUlpDiff(d, StrictMath.exp(d), 2, null); in testExpm1()
140 double pc = StrictMath.log(2) * i; in testExpm1()
150 pcNeighborsStrictExpm1[j] = StrictMath.expm1(pcNeighbors[j]); in testExpm1()
205 input, strictOutput = StrictMath.expm1(input), in testExpm1CaseWithUlpDiff()
DPowTests.java44 StrictMath.pow(input1, input2), expected); in testPowCase()
67 StrictMath.pow(input1, input2), expected); in testStrictPowCase()
248 return StrictMath.pow(Math.abs(x), y); in f3()
252 return -StrictMath.pow(Math.abs(x), y); in f3()
300 a = StrictMath.abs(a); // absolute value doesn't affect odd/even in intClassify()
DFusedMultiplyAddTests.java346 StrictMath.fma(input1, input2, input3), expected); in testFusedMacCase()
352 StrictMath.fma(input2, input1, input3), expected); in testFusedMacCase()
359 StrictMath.fma(input1, input2, input3), expected); in testFusedMacCase()
365 StrictMath.fma(input2, input1, input3), expected); in testFusedMacCase()
DDivModTests.java474 return StrictMath.floorDiv(x, y); in doStrictFloorDiv()
488 return StrictMath.floorDiv(x, y); in doStrictFloorDiv()
502 return StrictMath.floorDiv(x, y); in doStrictFloorDiv()
516 return StrictMath.floorMod(x, y); in doStrictFloorMod()
530 return StrictMath.floorMod(x, y); in doStrictFloorMod()
544 return StrictMath.floorMod(x, y); in doStrictFloorMod()
954 return StrictMath.ceilDiv(x, y); in doStrictCeilDiv()
968 return StrictMath.ceilDiv(x, y); in doStrictCeilDiv()
982 return StrictMath.ceilDiv(x, y); in doStrictCeilDiv()
996 return StrictMath.ceilMod(x, y); in doStrictCeilMod()
[all …]
DRint.java39 input, StrictMath.rint(input), expected); in testRintCase()
41 StrictMath.rint(-input), -expected); in testRintCase()
/libcore/ojluni/src/test/java/lang/StrictMath/
DExactArithTests.java23 package test.java.lang.StrictMath;
75 int sum = StrictMath.addExact(x, y); in testIntegerExact()
91 int diff = StrictMath.subtractExact(x, y); in testIntegerExact()
106 int product = StrictMath.multiplyExact(x, y); in testIntegerExact()
120 int inc = StrictMath.incrementExact(x); in testIntegerExact()
136 int dec = StrictMath.decrementExact(x); in testIntegerExact()
152 int neg = StrictMath.negateExact(x); in testIntegerExact()
226 long sum = StrictMath.addExact(x, y); in testLongExact()
237 long diff = StrictMath.subtractExact(x, y); in testLongExact()
248 long product = StrictMath.multiplyExact(x, y); in testLongExact()
[all …]
DMultiplicationTests.java33 package test.java.lang.StrictMath;
69 long p2 = StrictMath.multiplyHigh(x, y); in check()
DHyperbolicTests.java30 package test.java.lang.StrictMath;
49 Tests.test("StrictMath.sinh(double)", input, StrictMath.sinh(input), expected); in testSinhCase()
53 Tests.test("StrictMath.cosh(double)", input, StrictMath.cosh(input), expected); in testCoshCase()
57 Tests.test("StrictMath.tanh(double)", input, StrictMath.tanh(input), expected); in testTanhCase()
DExpTests.java36 package test.java.lang.StrictMath;
82 StrictMath.exp(input), expected); in testExpCase()
DPowTests.java30 package test.java.lang.StrictMath;
279 StrictMath.pow(input1, input2), expected); in testPowCase()
/libcore/luni/src/test/java/libcore/java/math/
DRunCSVTestsStrict.java26 Class<StrictMath> mathClass = StrictMath.class; in runTest()
45 Class<StrictMath> mathClass = StrictMath.class; in run2InputTest()

123