/libcore/luni/src/test/java/libcore/java/lang/ |
D | OldAndroidMathTest.java | 23 import static java.lang.Math.PI; 27 private static final double HYP = Math.sqrt(2.0); 38 Assert.assertEquals(message, expected, actual, Math.ulp(expected)); in assertEquals() 46 Assert.assertEquals(message, expected, actual, Math.ulp(expected)); in assertEquals() 56 (Math.abs(-1908.8976) == 1908.8976)); in testAbsD() 58 (Math.abs(1908.8976) == 1908.8976)); in testAbsD() 64 (Math.abs(-1908.8976f) == 1908.8976f)); in testAbsF() 66 (Math.abs(1908.8976f) == 1908.8976f)); in testAbsF() 71 assertTrue("Incorrect int abs value", (Math.abs(-1908897) == 1908897)); in testAbsI() 72 assertTrue("Incorrect int abs value", (Math.abs(1908897) == 1908897)); in testAbsI() [all …]
|
D | IntrinsicTest.java | 56 Math.abs(1); in testMath_abs() 57 Math.class.getMethod("abs", int.class).invoke(null, 1); in testMath_abs() 58 Math.abs(1L); in testMath_abs() 59 Math.class.getMethod("abs", long.class).invoke(null, 1L); in testMath_abs() 60 Math.abs(1.0f); in testMath_abs() 61 Math.class.getMethod("abs", float.class).invoke(null, 1.0f); in testMath_abs() 62 Math.abs(1.0); in testMath_abs() 63 Math.class.getMethod("abs", double.class).invoke(null, 1.0); in testMath_abs() 93 Math.min(1, 2); in testMath_min() 94 Math.class.getMethod("min", int.class, int.class).invoke(null, 1, 2); in testMath_min() [all …]
|
D | MathTest.java | 49 assertEquals(expected, Math.addExact(a, b)); in testAddExactI() 60 assertEquals(expected, Math.subtractExact(a, b)); in testSubtractExactI() 72 assertEquals(expected, Math.multiplyExact(a, b)); in testMultiplyExactI() 83 assertEquals(expected, Math.incrementExact(a)); in testIncrementExactI() 94 assertEquals(expected, Math.decrementExact(a)); in testDecrementExactI() 105 assertEquals(expected, Math.negateExact(a)); in testNegateExactI() 138 assertEquals(expected, BigInteger.valueOf(Math.addExact(a, b))); in testAddExactL() 149 assertEquals(expected, BigInteger.valueOf(Math.subtractExact(a, b))); in testSubtractExactL() 160 assertEquals(expected, BigInteger.valueOf(Math.multiplyExact(a, b))); in testMultiplyExactL() 171 assertEquals(expected, BigInteger.valueOf(Math.incrementExact(a))); in testIncrementExactL() [all …]
|
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ |
D | MathTest.java | 22 double HYP = Math.sqrt(2.0); 38 (Math.abs(-1908.8976) == 1908.8976)); in test_absD() 40 (Math.abs(1908.8976) == 1908.8976)); in test_absD() 49 (Math.abs(-1908.8976f) == 1908.8976f)); in test_absF() 51 (Math.abs(1908.8976f) == 1908.8976f)); in test_absF() 59 assertTrue("Incorrect int abs value", (Math.abs(-1908897) == 1908897)); in test_absI() 60 assertTrue("Incorrect int abs value", (Math.abs(1908897) == 1908897)); in test_absI() 69 (Math.abs(-19088976000089L) == 19088976000089L)); in test_absJ() 71 (Math.abs(19088976000089L) == 19088976000089L)); in test_absJ() 79 double r = Math.cos(Math.acos(ADJ / HYP)); in test_acosD() [all …]
|
/libcore/ojluni/src/main/java/java/lang/ |
D | StrictMath.java | 388 int exponent = Math.getExponent(a); in floorOrCeil() 464 double sign = Math.copySign(1.0, a); // preserve sign info in rint() 465 a = Math.abs(a); in rint() 668 return Math.round(a); in round() 692 return Math.round(a); in round() 738 return Math.addExact(x, y); in addExact() 753 return Math.addExact(x, y); in addExact() 768 return Math.subtractExact(x, y); in subtractExact() 783 return Math.subtractExact(x, y); in subtractExact() 798 return Math.multiplyExact(x, y); in multiplyExact() [all …]
|
D | Double.java | 294 if (Math.copySign(1.0, d) == -1.0) // value is negative, in toHexString() 299 d = Math.abs(d); in toHexString() 333 Math.getExponent(d)); in toHexString() 576 return Math.abs(d) <= DoubleConsts.MAX_VALUE; in isFinite() 1039 return Math.max(a, b); in max() 1053 return Math.min(a, b); in min()
|
D | Float.java | 284 if (Math.abs(f) < FloatConsts.MIN_NORMAL in toHexString() 289 String s = Double.toHexString(Math.scalb((double)f, in toHexString() 490 return Math.abs(f) <= FloatConsts.MAX_VALUE; in isFinite() 946 return Math.max(a, b); in max() 960 return Math.min(a, b); in min()
|
/libcore/benchmarks/src/benchmarks/regression/ |
D | MathBenchmark.java | 37 result = Math.abs(d); in timeAbsD() 45 result = Math.abs(f); in timeAbsF() 53 result = Math.abs(i); in timeAbsI() 61 result = Math.abs(l); in timeAbsL() 69 result = Math.acos(d); in timeAcos() 77 result = Math.asin(d); in timeAsin() 85 result = Math.atan(d); in timeAtan() 93 result = Math.atan2(3, 4); in timeAtan2() 101 result = Math.cbrt(d); in timeCbrt() 109 result = Math.ceil(d); in timeCeil() [all …]
|
/libcore/ojluni/src/main/java/sun/misc/ |
D | FpUtils.java | 140 return Math.getExponent(d); in getExponent() 149 return Math.getExponent(f); in getExponent() 171 return Math.copySign(magnitude, sign); in rawCopySign() 192 return Math.copySign(magnitude, sign); in rawCopySign() 534 return Math.scalb(d, scale_factor); in scalb() 572 return Math.scalb(f, scale_factor); in scalb() 618 return Math.nextAfter(start, direction); in nextAfter() 664 return Math.nextAfter(start, direction); in nextAfter() 695 return Math.nextUp(d); in nextUp() 726 return Math.nextUp(f); in nextUp() [all …]
|
D | FormattedFloatingDecimal.java | 175 int t = Math.min(nDigits - exp, precision); in fillCompatible() 187 int zeros = Math.max(0, Math.min(-exp, precision)); in fillCompatible() 188 int t = Math.max(0, Math.min(nDigits, precision + exp)); in fillCompatible() 274 int t = Math.min(nDigits - exp, precision); in fillDecimal() 286 int zeros = Math.max(0, Math.min(-exp, precision)); in fillDecimal() 287 int t = Math.max(0, Math.min(nDigits, precision + exp)); in fillDecimal() 316 int t = Math.max(0, Math.min(nDigits - 1, precision)); in fillScientific()
|
/libcore/ojluni/src/main/java/java/time/ |
D | Period.java | 203 return create(0, 0, Math.multiplyExact(weeks, 7)); in ofWeeks() 270 years = Math.toIntExact(unitAmount); in from() 272 months = Math.toIntExact(unitAmount); in from() 274 days = Math.toIntExact(unitAmount); in from() 337 days = Math.addExact(days, Math.multiplyExact(weeks, 7)); in parse() 353 return Math.multiplyExact(val, negate); in parseNumber() 622 Math.addExact(years, isoAmount.years), in plus() 623 Math.addExact(months, isoAmount.months), in plus() 624 Math.addExact(days, isoAmount.days)); in plus() 644 return create(Math.toIntExact(Math.addExact(years, yearsToAdd)), months, days); in plusYears() [all …]
|
D | Instant.java | 322 long secs = Math.addExact(epochSecond, Math.floorDiv(nanoAdjustment, NANOS_PER_SECOND)); in ofEpochSecond() 323 int nos = (int)Math.floorMod(nanoAdjustment, NANOS_PER_SECOND); in ofEpochSecond() 338 long secs = Math.floorDiv(epochMilli, 1000); in ofEpochMilli() 339 int mos = (int)Math.floorMod(epochMilli, 1000); in ofEpochMilli() 851 … case MINUTES: return plusSeconds(Math.multiplyExact(amountToAdd, SECONDS_PER_MINUTE)); in plus() 852 case HOURS: return plusSeconds(Math.multiplyExact(amountToAdd, SECONDS_PER_HOUR)); in plus() 853 … case HALF_DAYS: return plusSeconds(Math.multiplyExact(amountToAdd, SECONDS_PER_DAY / 2)); in plus() 854 case DAYS: return plusSeconds(Math.multiplyExact(amountToAdd, SECONDS_PER_DAY)); in plus() 919 long epochSec = Math.addExact(seconds, secondsToAdd); in plus() 920 epochSec = Math.addExact(epochSec, nanosToAdd / NANOS_PER_SECOND); in plus() [all …]
|
D | Duration.java | 175 return create(Math.multiplyExact(days, SECONDS_PER_DAY), 0); in ofDays() 190 return create(Math.multiplyExact(hours, SECONDS_PER_HOUR), 0); in ofHours() 205 return create(Math.multiplyExact(minutes, SECONDS_PER_MINUTE), 0); in ofMinutes() 241 long secs = Math.addExact(seconds, Math.floorDiv(nanoAdjustment, NANOS_PER_SECOND)); in ofSeconds() 242 int nos = (int) Math.floorMod(nanoAdjustment, NANOS_PER_SECOND); in ofSeconds() 418 return Math.multiplyExact(val, multiplier); in parseNumber() 438 …long seconds = Math.addExact(daysAsSecs, Math.addExact(hoursAsSecs, Math.addExact(minsAsSecs, secs… in create() 694 return plus(Math.multiplyExact(amountToAdd, SECONDS_PER_DAY), 0); in plus() 709 return plusSeconds(Math.multiplyExact(unit.getDuration().seconds, amountToAdd)); in plus() 729 return plus(Math.multiplyExact(daysToAdd, SECONDS_PER_DAY), 0); in plusDays() [all …]
|
D | ZoneOffset.java | 372 if (Math.abs(minutes) > 59) { in validate() 374 Math.abs(minutes) + " is not in the range 0 to 59"); in validate() 376 if (Math.abs(seconds) > 59) { in validate() 378 Math.abs(seconds) + " is not in the range 0 to 59"); in validate() 380 if (Math.abs(hours) == 18 && (Math.abs(minutes) > 0 || Math.abs(seconds) > 0)) { in validate() 408 if (Math.abs(totalSeconds) > MAX_SECONDS) { in ofTotalSeconds() 442 int absTotalSeconds = Math.abs(totalSeconds); in buildId()
|
/libcore/ojluni/src/main/java/java/util/ |
D | IntSummaryStatistics.java | 87 min = Math.min(min, value); in accept() 88 max = Math.max(max, value); in accept() 100 min = Math.min(min, other.min); in combine() 101 max = Math.max(max, other.max); in combine()
|
D | LongSummaryStatistics.java | 98 min = Math.min(min, value); in accept() 99 max = Math.max(max, value); in accept() 112 min = Math.min(min, other.min); in combine() 113 max = Math.max(max, other.max); in combine()
|
/libcore/ojluni/src/test/java/lang/Math/ |
D | ExactArithTests.java | 23 package test.java.lang.Math; 78 int sum = Math.addExact(x, y); in testIntegerExact() 95 int diff = Math.subtractExact(x, y); in testIntegerExact() 110 int product = Math.multiplyExact(x, y); in testIntegerExact() 124 int inc = Math.incrementExact(x); in testIntegerExact() 141 int dec = Math.decrementExact(x); in testIntegerExact() 158 int neg = Math.negateExact(x); in testIntegerExact() 234 long sum = Math.addExact(x, y); in testLongExact() 245 long diff = Math.subtractExact(x, y); in testLongExact() 256 long product = Math.multiplyExact(x, y); in testLongExact() [all …]
|
/libcore/ojluni/src/test/java/time/tck/java/time/chrono/ |
D | CopticDate.java | 214 case DAY_OF_WEEK: return Math.floorMod(toEpochDay() + 3, 7) + 1; in getLong() 264 case WEEKS: return plusDays(Math.multiplyExact(amountToAdd, 7)); in plus() 267 case DECADES: return plusYears(Math.multiplyExact(amountToAdd, 10)); in plus() 268 case CENTURIES: return plusYears(Math.multiplyExact(amountToAdd, 100)); in plus() 269 case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000)); in plus() 278 return plusMonths(Math.multiplyExact(years, 13)); in plusYears() 286 long calcEm = Math.addExact(curEm, months); in plusMonths() 287 int newYear = Math.toIntExact(Math.floorDiv(calcEm, 13)); in plusMonths() 288 int newMonth = (int)Math.floorMod(calcEm, 13) + 1; in plusMonths() 296 return CopticDate.ofEpochDay(Math.addExact(toEpochDay(), days)); in plusDays() [all …]
|
/libcore/ojluni/src/main/java/java/nio/file/attribute/ |
D | FileTime.java | 177 long ax = Math.abs(secs); in toMillis() 251 secs = Math.floorDiv(value, MILLIS_PER_SECOND); in toInstant() 252 nanos = (int)Math.floorMod(value, MILLIS_PER_SECOND) in toInstant() 256 secs = Math.floorDiv(value, MICROS_PER_SECOND); in toInstant() 257 nanos = (int)Math.floorMod(value, MICROS_PER_SECOND) in toInstant() 261 secs = Math.floorDiv(value, NANOS_PER_SECOND); in toInstant() 262 nanos = (int)Math.floorMod(value, NANOS_PER_SECOND); in toInstant() 426 long hi = Math.floorDiv(zeroSecs, SECONDS_PER_10000_YEARS) + 1; in toString() 427 long lo = Math.floorMod(zeroSecs, SECONDS_PER_10000_YEARS); in toString() 444 year = Math.abs(year); in toString() [all …]
|
/libcore/ojluni/src/main/java/java/time/chrono/ |
D | ChronoPeriodImpl.java | 180 Math.addExact(years, amount.years), in plus() 181 Math.addExact(months, amount.months), in plus() 182 Math.addExact(days, amount.days)); in plus() 190 Math.subtractExact(years, amount.years), in minus() 191 Math.subtractExact(months, amount.months), in minus() 192 Math.subtractExact(days, amount.days)); in minus() 221 Math.multiplyExact(years, scalar), in multipliedBy() 222 Math.multiplyExact(months, scalar), in multipliedBy() 223 Math.multiplyExact(days, scalar)); in multipliedBy() 237 return new ChronoPeriodImpl(chrono, Math.toIntExact(splitYears), splitMonths, days); in normalized()
|
D | IsoChronology.java | 502 addFieldValue(fieldValues, MONTH_OF_YEAR, Math.floorMod(pMonth, 12) + 1); in resolveProlepticMonth() 503 addFieldValue(fieldValues, YEAR, Math.floorDiv(pMonth, 12)); in resolveProlepticMonth() 520 … addFieldValue(fieldValues, YEAR, (year > 0 ? yoeLong: Math.subtractExact(1, yoeLong))); in resolveYearOfEra() 527 …addFieldValue(fieldValues, YEAR, (year == null || year > 0 ? yoeLong: Math.subtractExact(1, yoeLon… in resolveYearOfEra() 532 addFieldValue(fieldValues, YEAR, Math.subtractExact(1, yoeLong)); in resolveYearOfEra() 546 long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); in resolveYMD() 547 long days = Math.subtractExact(fieldValues.remove(DAY_OF_MONTH), 1); in resolveYMD() 554 dom = Math.min(dom, 30); in resolveYMD() 556 dom = Math.min(dom, Month.FEBRUARY.length(Year.isLeap(y))); in resolveYMD()
|
D | ChronoLocalDateTimeImpl.java | 357 totDays += Math.floorDiv(totNanos, NANOS_PER_DAY); in plusWithOverflow() 358 long newNoD = Math.floorMod(totNanos, NANOS_PER_DAY); in plusWithOverflow() 379 case NANOS: amount = Math.multiplyExact(amount, NANOS_PER_DAY); break; in until() 380 case MICROS: amount = Math.multiplyExact(amount, MICROS_PER_DAY); break; in until() 381 case MILLIS: amount = Math.multiplyExact(amount, MILLIS_PER_DAY); break; in until() 382 case SECONDS: amount = Math.multiplyExact(amount, SECONDS_PER_DAY); break; in until() 383 case MINUTES: amount = Math.multiplyExact(amount, MINUTES_PER_DAY); break; in until() 384 case HOURS: amount = Math.multiplyExact(amount, HOURS_PER_DAY); break; in until() 385 case HALF_DAYS: amount = Math.multiplyExact(amount, 2); break; in until() 387 return Math.addExact(amount, time.until(end.toLocalTime(), unit)); in until()
|
D | AbstractChronology.java | 521 yoe = Math.toIntExact(yoeLong); in resolveYearOfEra() 554 long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); in resolveYMD() 555 long days = Math.subtractExact(fieldValues.remove(DAY_OF_MONTH), 1); in resolveYMD() 574 long days = Math.subtractExact(fieldValues.remove(DAY_OF_YEAR), 1); in resolveYD() 584 long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); in resolveYMAA() 585 long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), 1); in resolveYMAA() 586 long days = Math.subtractExact(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH), 1); in resolveYMAA() 602 long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1); in resolveYMAD() 603 long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), 1); in resolveYMAD() 604 long dow = Math.subtractExact(fieldValues.remove(DAY_OF_WEEK), 1); in resolveYMAD() [all …]
|
/libcore/ojluni/src/main/java/java/io/ |
D | StringReader.java | 99 int n = Math.min(length - next, len); in read() 128 long n = Math.min(length - next, ns); in skip() 129 n = Math.max(-next, n); in skip()
|
/libcore/ojluni/src/main/java/java/util/stream/ |
D | AbstractSpinedBuffer.java | 93 this.initialChunkPower = Math.max(MIN_CHUNK_POWER, in AbstractSpinedBuffer() 119 : Math.min(initialChunkPower + n - 1, AbstractSpinedBuffer.MAX_CHUNK_POWER); in chunkSize()
|