Home
last modified time | relevance | path

Searched refs:abs (Results 1 – 25 of 60) sorted by relevance

123

/libcore/luni/src/main/java/libcore/util/
DFP16.java240 int abs = bits & EXPONENT_SIGNIFICAND_MASK; in rint() local
243 if (abs < 0x3c00) { in rint()
245 if (abs > 0x3800){ in rint()
248 } else if (abs < 0x6400) { in rint()
249 int exp = 25 - (abs >> 10); in rint()
251 result += ((1 << (exp - 1)) - (~(abs >> exp) & 1)); in rint()
283 int abs = bits & EXPONENT_SIGNIFICAND_MASK; in ceil() local
286 if (abs < 0x3c00) { in ceil()
288 result |= 0x3c00 & -(~(bits >> 15) & (abs != 0 ? 1 : 0)); in ceil()
289 } else if (abs < 0x6400) { in ceil()
[all …]
/libcore/luni/src/test/java/libcore/java/lang/
DIntrinsicTest.java56 Math.abs(1); in testMath_abs()
58 Math.abs(1L); in testMath_abs()
60 Math.abs(1.0f); in testMath_abs()
62 Math.abs(1.0); in testMath_abs()
67 StrictMath.abs(1); in testStrictMath_abs()
69 StrictMath.abs(1L); in testStrictMath_abs()
71 StrictMath.abs(1.0f); in testStrictMath_abs()
73 StrictMath.abs(1.0); in testStrictMath_abs()
DOldAndroidStrictMathTest.java37 (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()
61 .abs(-19088976000089L) == 19088976000089L)); in testAbsJ()
63 (StrictMath.abs(19088976000089L) == 19088976000089L)); in testAbsJ()
181 .abs(StrictMath.exp(4D) - StrictMath.E * StrictMath.E in testExpD()
184 .log(StrictMath.abs(StrictMath.exp(5.5D)) - 5.5D) < 10.0D); in testExpD()
[all …]
DOldAndroidMathTest.java56 (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()
78 (Math.abs(-19088976000089L) == 19088976000089L)); in testAbsJ()
80 (Math.abs(19088976000089L) == 19088976000089L)); in testAbsJ()
227 assertTrue("Incorrect answer returned for simple power", Math.abs(Math in testExpD()
231 .abs(Math.exp(5.5D)) - 5.5D) < 10.0D); in testExpD()
[all …]
/libcore/luni/src/test/java/libcore/java/math/
DOldBigDecimalCompareTest.java36 …assertEquals("incorrect value", "1.238096483923847545735673567457357E+53", aNumber.abs(mc).toStrin… in testAbsMathContextNeg()
39 …assertEquals("incorrect value", "1.238096483923847545735673567457356E+53", aNumber.abs(mc).toStrin… in testAbsMathContextNeg()
42 …assertEquals("incorrect value", "1.238096483923847545735673567457356E+53", aNumber.abs(mc).toStrin… in testAbsMathContextNeg()
45 …assertEquals("incorrect value", "1.238096483923847545735673567457357E+53", aNumber.abs(mc).toStrin… in testAbsMathContextNeg()
49 aNumber.abs(mc); in testAbsMathContextNeg()
/libcore/ojluni/src/main/java/java/lang/
DStrictMath.java451 a = Math.abs(a); in rint()
930 public static int abs(int a) { in abs() method in StrictMath
931 return Math.abs(a); in abs()
947 public static long abs(long a) { in abs() method in StrictMath
948 return Math.abs(a); in abs()
966 public static float abs(float a) { in abs() method in StrictMath
967 return Math.abs(a); in abs()
985 public static double abs(double a) { in abs() method in StrictMath
986 return Math.abs(a); in abs()
DMath.java907 long ax = Math.abs(x); in multiplyExact()
908 long ay = Math.abs(y); in multiplyExact()
1205 public static int abs(int a) { in abs() method in Math
1222 public static long abs(long a) { in abs() method in Math
1241 public static float abs(float a) { in abs() method in Math
1265 public static double abs(double a) { in abs() method in Math
1466 return Math.abs(d); in ulp()
1517 return Math.abs(f); in ulp()
DFloat.java284 if (Math.abs(f) < FloatConsts.MIN_NORMAL in toHexString()
490 return Math.abs(f) <= FloatConsts.MAX_VALUE; in isFinite()
DDouble.java299 d = Math.abs(d); in toHexString()
576 return Math.abs(d) <= DoubleConsts.MAX_VALUE; in isFinite()
/libcore/luni/src/test/resources/
Dmath_important_numbers.csv2 abs,0x1.5bf0a8b145769p1,0x1.5bf0a8b145769p1,2.718281828459045
3 abs,0x1.5bf0a8b145769p1,-0x1.5bf0a8b145769p1,-2.718281828459045
4 abs,0x0.0p0,0x0.0p0,0.0
5 abs,0x0.0p0,-0x0.0p0,-0.0
6 abs,0x1.0p0,0x1.0p0,1.0
7 abs,0x1.0p0,-0x1.0p0,-1.0
8 abs,0x1.0p-1,-0x1.0p-1,-0.5
9 abs,0x1.0p-1,0x1.0p-1,0.5
10 abs,0x1.921fb54442d18p2,-0x1.921fb54442d18p2,-6.283185307179586
11 abs,0x1.815e630c155e1p2,-0x1.815e630c155e1p2,-6.021385919380436
[all …]
Dmath_java_only.csv1133 abs,0x1.93d505df96a7bp1,-0x1.93d505df96a7bp1
1134 abs,0x1.772aabf17e9fap1,-0x1.772aabf17e9fap1
1135 abs,0x1.37482866cf6fbp0,0x1.37482866cf6fbp0
1136 abs,0x1.2f2d86b7d412bp0,-0x1.2f2d86b7d412bp0
1137 abs,0x1.1472bc84f162dp1,-0x1.1472bc84f162dp1
1138 abs,0x1.6f1aef4f2128fp-1,0x1.6f1aef4f2128fp-1
1139 abs,0x1.30f9423f14eeap0,-0x1.30f9423f14eeap0
1140 abs,0x1.a1c4694bb59efp-3,-0x1.a1c4694bb59efp-3
1141 abs,0x1.1103fecbf63fp0,-0x1.1103fecbf63fp0
1142 abs,0x1.2790898fcdf8ap1,-0x1.2790898fcdf8ap1
[all …]
/libcore/ojluni/src/main/java/java/time/
DZoneOffset.java372 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/test/java/time/tck/java/time/
DTCKZoneOffset.java197 String str = (i < 0 ? "-" : "+") + Math.abs(i); in test_factory_string_singleDigitHours()
206 String str = (i < 0 ? "-" : "+") + Integer.toString(Math.abs(i) + 100).substring(1); in test_factory_string_hours()
218 Integer.toString(Math.abs(i) + 100).substring(1) + in test_factory_string_hours_minutes_noColon()
219 Integer.toString(Math.abs(j) + 100).substring(1); in test_factory_string_hours_minutes_noColon()
237 Integer.toString(Math.abs(i) + 100).substring(1) + ":" + in test_factory_string_hours_minutes_colon()
238 Integer.toString(Math.abs(j) + 100).substring(1); in test_factory_string_hours_minutes_colon()
258 Integer.toString(Math.abs(i) + 100).substring(1) + in test_factory_string_hours_minutes_seconds_noColon()
259 Integer.toString(Math.abs(j) + 100).substring(1) + in test_factory_string_hours_minutes_seconds_noColon()
260 Integer.toString(Math.abs(k) + 100).substring(1); in test_factory_string_hours_minutes_seconds_noColon()
281 Integer.toString(Math.abs(i) + 100).substring(1) + ":" + in test_factory_string_hours_minutes_seconds_colon()
[all …]
/libcore/ojluni/annotations/mmodule/java/lang/
DMath.annotated.java118 public static int abs(int a) { throw new RuntimeException("Stub!"); } in abs() method in Math
120 public static long abs(long a) { throw new RuntimeException("Stub!"); } in abs() method in Math
122 public static float abs(float a) { throw new RuntimeException("Stub!"); } in abs() method in Math
124 public static double abs(double a) { throw new RuntimeException("Stub!"); } in abs() method in Math
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/math/
DBigIntegerTest.java345 .abs().equals(aZillion.abs())); in test_abs()
346 assertTrue("Invalid number returned for zero neg", zero.negate().abs() in test_abs()
348 assertTrue("Invalid number returned for zero", zero.abs().equals(zero)); in test_abs()
349 assertTrue("Invalid number returned for two", two.negate().abs() in test_abs()
922 assertTrue("remainder out of range", r.abs().compareTo(i2.abs()) < 0); in testDiv()
923 assertTrue("quotient too small", q.abs().add(one).multiply(i2.abs()) in testDiv()
924 .compareTo(i1.abs()) > 0); in testDiv()
925 assertTrue("quotient too large", q.abs().multiply(i2.abs()).compareTo( in testDiv()
926 i1.abs()) <= 0); in testDiv()
933 assertTrue("mod out of range", mod.abs().compareTo(i2.abs()) < 0); in testDiv()
DMathContextTest.java73 BigDecimal res = aNumber.abs(mcInt6); in test_MathContextConstruction()
DBigDecimalCompareTest.java43 assertEquals("incorrect value", result, aNumber.abs().toString()); in testAbsNeg()
53 assertEquals("incorrect value", result, aNumber.abs().toString()); in testAbsPos()
67 BigDecimal res = aNumber.abs(mc); in testAbsMathContextNeg()
83 BigDecimal res = aNumber.abs(mc); in testAbsMathContextPos()
/libcore/ojluni/src/test/java/nio/file/attribute/
DBasicFileAttributeViewCreationTimeTest.java72 if (Math.abs(creationTime.toMillis()-now.toEpochMilli()) > 10000L) { in test()
118 if (Math.abs(creationTime.toMillis()-current.toMillis()) > 1000L) in test()
/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()
DMathBenchmark.java37 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()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/
DStrictMathTest.java48 (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()
81 .abs(-19088976000089L) == 19088976000089L)); in test_absJ()
83 (StrictMath.abs(19088976000089L) == 19088976000089L)); in test_absJ()
187 .abs(magnitude)); in test_copySign_DD()
189 .abs(magnitude)); in test_copySign_DD()
[all …]
DMathTest.java38 (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()
171 .abs(magnitude)); in test_copySign_DD()
173 .abs(magnitude)); in test_copySign_DD()
[all …]
/libcore/luni/src/main/java/java/math/
DBigDecimal.java1104 compRem = remainder.abs().shiftLeftOneBit().compareTo(scaledDivisor.abs()); in divideBigIntegers()
1244 if (!q.abs().equals(BigInteger.ONE)) { in divide()
1464 compRemDiv = Math.abs(quotAndRem[1].signum()); in divideToIntegralValue()
1645 int m = Math.abs(n); in pow()
1688 public BigDecimal abs() { in abs() method in BigDecimal
1697 public BigDecimal abs(MathContext mc) { in abs() method in BigDecimal
1816 int index = Arrays.binarySearch(MathUtils.LONG_POWERS_OF_TEN, Math.abs(value)); in decimalDigitsInLong()
2323 StringBuilder result = new StringBuilder(intStr.length() + 1 + Math.abs(scale)); in toPlainString()
2552 mantissa = getUnscaledValue().abs(); in doubleValue()
2688 compRem = (integerAndFraction[1].abs().shiftLeftOneBit().compareTo(sizeOfFraction)); in inplaceRound()
[all …]
DConversion.java76 int resLengthInChars = (int) (val.abs().bitLength() / bitsForRadixDigit + ((sign < 0) ? 1 in bigInteger2String()
430 int bitLen = val.abs().bitLength(); in bigInteger2Double()
434 long lVal = val.abs().shiftRight(delta).longValue(); in bigInteger2Double()
/libcore/ojluni/src/main/java/java/nio/file/attribute/
DFileTime.java177 long ax = Math.abs(secs); in toMillis()
444 year = Math.abs(year); in toString()
446 append(sb, 1000, Math.abs(year)); in toString()

123