src/java.base/share/classes/java/math/BigDecimal.java

Print this page
8152237 Support BigInteger.TWO

*** 1,7 **** /* ! * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 284,294 **** // Cache of common small BigDecimal values. private static final BigDecimal ZERO_THROUGH_TEN[] = { new BigDecimal(BigInteger.ZERO, 0, 0, 1), new BigDecimal(BigInteger.ONE, 1, 0, 1), ! new BigDecimal(BigInteger.valueOf(2), 2, 0, 1), new BigDecimal(BigInteger.valueOf(3), 3, 0, 1), new BigDecimal(BigInteger.valueOf(4), 4, 0, 1), new BigDecimal(BigInteger.valueOf(5), 5, 0, 1), new BigDecimal(BigInteger.valueOf(6), 6, 0, 1), new BigDecimal(BigInteger.valueOf(7), 7, 0, 1), --- 284,294 ---- // Cache of common small BigDecimal values. private static final BigDecimal ZERO_THROUGH_TEN[] = { new BigDecimal(BigInteger.ZERO, 0, 0, 1), new BigDecimal(BigInteger.ONE, 1, 0, 1), ! new BigDecimal(BigInteger.TWO, 2, 0, 1), new BigDecimal(BigInteger.valueOf(3), 3, 0, 1), new BigDecimal(BigInteger.valueOf(4), 4, 0, 1), new BigDecimal(BigInteger.valueOf(5), 5, 0, 1), new BigDecimal(BigInteger.valueOf(6), 6, 0, 1), new BigDecimal(BigInteger.valueOf(7), 7, 0, 1),
*** 934,944 **** } else { if (exponent < 0) { rb = BigInteger.valueOf(5).pow(-exponent).multiply(compactVal); scl = -exponent; } else { // (exponent > 0) ! rb = BigInteger.valueOf(2).pow(exponent).multiply(compactVal); } compactVal = compactValFor(rb); } int prec = 0; int mcp = mc.precision; --- 934,944 ---- } else { if (exponent < 0) { rb = BigInteger.valueOf(5).pow(-exponent).multiply(compactVal); scl = -exponent; } else { // (exponent > 0) ! rb = BigInteger.TWO.pow(exponent).multiply(compactVal); } compactVal = compactValFor(rb); } int prec = 0; int mcp = mc.precision;