Home
last modified time | relevance | path

Searched refs:bd (Results 1 – 25 of 29) sorted by relevance

12

/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/
DBidiTest.java28 Bidi bd; field in BidiTest
50 bd = new Bidi(null, Bidi.DIRECTION_RIGHT_TO_LEFT); in testNullPointerConstructor()
57 bd = new Bidi(null, 0, new byte[] { 0 }, 0, 0, in testNullPointerConstructor()
65 bd = new Bidi(null); in testNullPointerConstructor()
70 bd = new Bidi("a".toCharArray(), 0, null, 0, 1, in testNullPointerConstructor()
76 bd = new Bidi("1".toCharArray(), 0, new byte[] { 0 }, 0, 20, in testBadLength()
84 bd = new Bidi("1234567".toCharArray(), 0, new byte[] { 0 }, 0, 4, in testBadLength()
92 bd = new Bidi("1234567".toCharArray(), 4, new byte[] { 0, 1, 2, 3, in testBadLength()
100 bd = new Bidi("1234567".toCharArray(), 0, new byte[] { 0, 1, 2, 3, in testBadLength()
109 bd = new Bidi(new char[] { 't','t','t'}, -1, new byte[] { 2, 2 }, 1, 1, 1); in testBadLength()
[all …]
/libcore/luni/src/test/java/libcore/java/math/
DOldBigDecimalConstructorsTest.java48 BigDecimal bd; in testConstrBigIntegerMathContext() local
53 bd = new BigDecimal(bi, mc); in testConstrBigIntegerMathContext()
54 assertEquals("incorrect value", "1.234567890123456789012345678902E+34", bd.toString()); in testConstrBigIntegerMathContext()
55 bd = new BigDecimal(nbi, mc); in testConstrBigIntegerMathContext()
56 assertEquals("incorrect value", "-1.234567890123456789012345678902E+34", bd.toString()); in testConstrBigIntegerMathContext()
59 bd = new BigDecimal(bi, mc); in testConstrBigIntegerMathContext()
60 assertEquals("incorrect value", "1.234567890123456789012345678E+34", bd.toString()); in testConstrBigIntegerMathContext()
61 bd = new BigDecimal(nbi, mc); in testConstrBigIntegerMathContext()
62 assertEquals("incorrect value", "-1.234567890123456789012345678E+34", bd.toString()); in testConstrBigIntegerMathContext()
65 bd = new BigDecimal(bi, mc); in testConstrBigIntegerMathContext()
[all …]
DOldBigDecimalArithmeticTest.java477 BigDecimal bd; in testRoundNonTrivial() local
480 bd = new BigDecimal(new BigInteger("123456789012345678"), 3, mc); in testRoundNonTrivial()
481 assertEquals("incorrect value", "123456789012345.67", bd.toString()); in testRoundNonTrivial()
484 bd = (new BigDecimal(biStr)).round(mc); in testRoundNonTrivial()
485 assertEquals("incorrect value", "1.234567890123456789012345678902E+44", bd.toString()); in testRoundNonTrivial()
486 bd = (new BigDecimal(nbiStr)).round(mc); in testRoundNonTrivial()
487 assertEquals("incorrect value", "-1.234567890123456789012345678902E+44", bd.toString()); in testRoundNonTrivial()
490 bd = (new BigDecimal(biStr)).round(mc); in testRoundNonTrivial()
491 assertEquals("incorrect value", "1.234567890123456789012345678E+44", bd.toString()); in testRoundNonTrivial()
492 bd = (new BigDecimal(nbiStr)).round(mc); in testRoundNonTrivial()
[all …]
DOldBigDecimalTest.java62 BigDecimal bd; in test_constructor_String_plus_exp() local
63 bd = new BigDecimal("+23e-0"); in test_constructor_String_plus_exp()
64 assertEquals("incorrect value", "23", bd.toString()); in test_constructor_String_plus_exp()
65 bd = new BigDecimal("-23e+0"); in test_constructor_String_plus_exp()
66 assertEquals("incorrect value", "-23", bd.toString()); in test_constructor_String_plus_exp()
/libcore/ojluni/src/test/java/math/BigDecimal/
DNegateTests.java40 static BigDecimal negateThenRound(BigDecimal bd, MathContext mc) { in negateThenRound() argument
41 return bd.negate().plus(mc); in negateThenRound()
45 static BigDecimal absThenRound(BigDecimal bd, MathContext mc) { in absThenRound() argument
46 return bd.abs().plus(mc); in absThenRound()
53 BigDecimal bd = testCase[0]; in negateTest() local
54 BigDecimal neg1 = bd.negate(mc); in negateTest()
55 BigDecimal neg2 = negateThenRound(bd, mc); in negateTest()
58 Assert.assertEquals(neg1, expected, "(" + bd + ").negate(" + mc + ") => " + in negateTest()
61 Assert.assertEquals(neg1, neg2, "(" + bd + ").negate(" + mc + ") => " + in negateTest()
65 BigDecimal abs = bd.abs(mc); in negateTest()
[all …]
DToPlainStringTests.java80 BigDecimal bd = new BigDecimal(testCase[0]); in testToPlainString() local
83 s = bd.toPlainString(); in testToPlainString()
85 "Unexpected plain result ``" + s + "'' from BigDecimal " + bd); in testToPlainString()
87 bd = new BigDecimal("-"+testCase[0]); in testToPlainString()
88 s = bd.toPlainString(); in testToPlainString()
89 Assert.assertFalse(bd.signum()!=0 && !s.equals("-"+testCase[1]), in testToPlainString()
90 "Unexpected plain result ``" + s + "'' from BigDecimal " + bd); in testToPlainString() local
DFloatDoubleValueTests.java49 static void testDoubleValue0(long i, BigDecimal bd) { in testDoubleValue0() argument
50 Assert.assertFalse(bd.doubleValue() != i || bd.longValue() != i, in testDoubleValue0()
51 "Unexpected equality failure for " + i + "\t" + bd); in testDoubleValue0() local
54 static void testFloatValue0(long i, BigDecimal bd) { in testFloatValue0() argument
55 Assert.assertFalse(bd.floatValue() != i || bd.longValue() != i, in testFloatValue0()
56 "Unexpected equality failure for " + i + "\t" + bd); in testFloatValue0() local
59 static void checkFloat(BigDecimal bd, float f) { in checkFloat() argument
60 float fbd = bd.floatValue(); in checkFloat()
66 static void checkDouble(BigDecimal bd, double d) { in checkDouble() argument
67 double dbd = bd.doubleValue(); in checkDouble()
DScaleByPowerOfTenTests.java43 BigDecimal bd = BigDecimal.ONE.scaleByPowerOfTen(i); in testScaleByPowerOfTen() local
47 Assert.assertEquals(bd, expected, "Unexpected result " + in testScaleByPowerOfTen()
48 bd.toString() + in testScaleByPowerOfTen()
52 bd = BigDecimal.ONE.negate().scaleByPowerOfTen(i); in testScaleByPowerOfTen()
54 Assert.assertEquals(bd, expected, "Unexpected result " + in testScaleByPowerOfTen()
55 bd.toString() + in testScaleByPowerOfTen()
DPrecisionTests.java52 for(BigDecimal bd : testValues) { in testPrecision()
53 testPrecision(bd, i); in testPrecision()
54 testPrecision(bd.negate(), i); in testPrecision()
81 private static void testPrecision(BigDecimal bd, int expected) { in testPrecision() argument
82 int precision = bd.precision(); in testPrecision()
85 String.format("For (%s).precision expected %d, got %d%n", bd, expected, precision)); in testPrecision()
DSerializationTests.java41 static void checkSerialForm(BigDecimal bd) throws Exception { in checkSerialForm() argument
44 oos.writeObject(bd); in checkSerialForm()
51 if (!bd.equals(tmp) || bd.hashCode() != tmp.hashCode()) { in checkSerialForm()
52 Assert.fail(" original : " + bd + in checkSerialForm()
53 " (hash: 0x" + Integer.toHexString(bd.hashCode()) + ")" + in checkSerialForm()
DConstructor.java39 BigDecimal bd = new BigDecimal("1.2e"); in stringConstructor() local
44 BigDecimal bd = new BigDecimal(new char[5], -1, 4, null); in charArrayConstructorNegativeOffset() local
49 BigDecimal bd = new BigDecimal(new char[5], 0, -1, null); in charArrayConstructorNegativeLength() local
55 BigDecimal bd = new BigDecimal(new char[5], Integer.MAX_VALUE - 5, in charArrayConstructorIntegerOverflow() local
69 BigDecimal bd = new BigDecimal(new char[5], 1, 5, null); in charArrayConstructorIndexOutOfBounds() local
DSquareRootTests.java100 for (BigDecimal bd : oneToNine) { in oneDigitTests()
103 compareSqrtImplementations(bd, mc); in oneDigitTests()
104 bd = bd.multiply(ONE_TENTH); in oneDigitTests()
105 compareSqrtImplementations(bd, mc); in oneDigitTests()
132 for (BigDecimal bd : List.of(bd0, bd1, bd2)) { in twoDigitTests()
136 compareSqrtImplementations(bd, mc); in twoDigitTests()
145 private static void compareSqrtImplementations(BigDecimal bd, MathContext mc) { in compareSqrtImplementations() argument
146 equalNumerically(BigSquareRoot.sqrt(bd, mc), in compareSqrtImplementations()
147 bd.sqrt(mc), "sqrt(" + bd + ") under " + mc); in compareSqrtImplementations()
418 public static boolean isPowerOfTen(BigDecimal bd) {
[all …]
DLongValueExactTests.java52 BigDecimal bd = new BigDecimal(longValue); in longValueExactTests() local
53 long longValueExact = bd.longValueExact(); in longValueExactTests()
72 BigDecimal bd = new BigDecimal(bigValue); in longValueExactTests() local
73 long longValueExact = bd.longValueExact(); in longValueExactTests()
DStringConstructor.java88 BigDecimal bd = new BigDecimal(bi, scale); in testRoundtrip() local
89 String bdString = bd.toString(); in testRoundtrip()
91 Assert.assertEquals(bd, bdDoppel, "bd string: scale: " + bd.scale() + in testRoundtrip()
DZeroScalingTests.java313 BigDecimal bd = zero.setScale(scale); in setScaleTests() local
337 BigDecimal bd = new BigDecimal(testCase[0]); in toEngineeringStringTests() local
338 String result = bd.toEngineeringString(); in toEngineeringStringTests()
340 Assert.assertFalse(!result.equals(testCase[1]) || !bd.equals(new BigDecimal(result)), in toEngineeringStringTests()
DDivideTests.java149 BigDecimal bd; in powersOf2and5() local
152 bd = BigDecimal.ONE.divide(new BigDecimal(product=powerOf2*powerOf5)); in powersOf2and5()
159 bd = new BigDecimal(powerOf2).divide(new BigDecimal(powerOf5)); in powersOf2and5()
166 bd = new BigDecimal(powerOf5).divide(new BigDecimal(powerOf2)); in powersOf2and5()
/libcore/luni/src/test/java/libcore/java/text/
DOldBidiTest.java28 Bidi bd = new Bidi("bidi", 173); in testToString() local
29 assertNotNull("Bidi representation is null", bd.toString()); in testToString()
43 Bidi bd = new Bidi("text", Bidi.DIRECTION_LEFT_TO_RIGHT); in testGetRunLevelLInt() local
45 assertEquals(0, bd.getRunLevel(0)); in testGetRunLevelLInt()
46 assertEquals(0, bd.getRunLevel(bd.getRunCount())); in testGetRunLevelLInt()
51 bd = new Bidi("text", Bidi.DIRECTION_RIGHT_TO_LEFT); in testGetRunLevelLInt()
53 assertEquals(2, bd.getRunLevel(0)); in testGetRunLevelLInt()
58 bd = new Bidi("text", Bidi.DIRECTION_DEFAULT_RIGHT_TO_LEFT); in testGetRunLevelLInt()
60 assertEquals(0, bd.getRunLevel(0)); in testGetRunLevelLInt()
67 Bidi bd = new Bidi(new char[] { 's', 's', 's' }, 0, new byte[] { (byte) -7, in testGetRunStart() local
[all …]
DDecimalFormatTest.java71 BigDecimal bd = new BigDecimal(longDec); in testBigDecimalBug1897917() local
72 assertBigDecimalWithFraction(bd, "1,123.46%", 2); in testBigDecimalBug1897917()
73 assertBigDecimalWithFraction(bd, "1,123.45678901%", 8); in testBigDecimalBug1897917()
74 assertBigDecimalWithFraction(bd, "1,123.4567890123%", 10); in testBigDecimalBug1897917()
75 assertBigDecimalWithFraction(bd, "1,123.45678901234567890123%", 20); in testBigDecimalBug1897917()
76 assertBigDecimalWithFraction(bd, "1,123.456789012345678901234567890123%", 30); in testBigDecimalBug1897917()
263 private void assertBigDecimalWithFraction(BigDecimal bd, String expectedResult, int fraction) { in assertBigDecimalWithFraction() argument
266 assertEquals(expectedResult, pf.format(bd)); in assertBigDecimalWithFraction()
/libcore/ojluni/src/test/java/math/BigInteger/
DOperatorNpeTests.java45 for (BigInteger bd : specialValues) { in testOperatorsNpe()
48 result = bd.multiply(null); in testOperatorsNpe()
55 result = bd.divide(null); in testOperatorsNpe()
62 result = bd.add(null); in testOperatorsNpe()
69 result = bd.subtract(null); in testOperatorsNpe()
/libcore/ojluni/src/test/java/lang/Float/
DParseFloatTest.java80 BigDecimal bd; in check()
93 bd = new BigDecimal(new BigInteger(significand, 16)); in check()
95 bd = bd.multiply(BigDecimal.valueOf(2).pow((int)exp)); in check()
97 bd = bd.divide(BigDecimal.valueOf(2).pow((int)-exp)); in check()
100 bd = new BigDecimal(s); in check()
110 int cmpL = bd.compareTo(l); in check()
111 int cmpU = u != null ? bd.compareTo(u) : -1; in check()
/libcore/benchmarks/src/benchmarks/regression/
DBidiBenchmark.java37 Bidi bd = new Bidi(new char[]{'s', 's', 's'}, 0, new byte[]{(byte) 1, in time_createBidiFromCharArray() local
57 Bidi bd = new Bidi(new char[]{'\u05D0', '\u05D0', '\u05D0'}, 0, in time_hebrewBidi() local
60 bd = new Bidi(new char[]{'\u05D0', '\u05D0', '\u05D0'}, 0, in time_hebrewBidi()
68 Bidi bd = new Bidi("a\u05D0a\"a\u05D0\"\u05D0a".toCharArray(), 0, in time_complicatedOverrideBidi() local
/libcore/ojluni/src/test/java/lang/Double/
DParseDoubleTest.java82 BigDecimal bd; in check()
95 bd = new BigDecimal(new BigInteger(significand, 16)); in check()
97 bd = bd.multiply(BigDecimal.valueOf(2).pow((int)exp)); in check()
99 bd = bd.divide(BigDecimal.valueOf(2).pow((int)-exp)); in check()
102 bd = new BigDecimal(s); in check()
112 int cmpL = bd.compareTo(l); in check()
113 int cmpU = u != null ? bd.compareTo(u) : -1; in check()
/libcore/luni/src/main/java/javax/xml/datatype/
DDuration.java936 private String toString(BigDecimal bd) { in toString() argument
937 String intString = bd.unscaledValue().toString(); in toString()
938 int scale = bd.scale(); in toString()
/libcore/luni/src/test/resources/keystore/
Dprivkey.pem11 bd/yDwJAMT4jF8GAjARFX5nmvwGr+ZnX5hVxhBx+B4WlvRZbrzE9VC0XdG4oSTPw
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/math/
DBigDecimalTest.java885 BigDecimal bd = new BigDecimal(in, 0, 9); in test_BigDecimal_serialization() local
889 oos.writeObject(bd); in test_BigDecimal_serialization()
895 assertEquals(bd.intValue(), nbd.intValue()); in test_BigDecimal_serialization()
896 assertEquals(bd.doubleValue(), nbd.doubleValue(), 0.0); in test_BigDecimal_serialization()
897 assertEquals(bd.toString(), nbd.toString()); in test_BigDecimal_serialization()

12