test/java/math/BigDecimal/ZeroScalingTests.java

Print this page




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4902952 4905407 4916149
  27  * @summary Tests that the scale of zero is propagated properly and has the proper effect.
  28  * @author Joseph D. Darcy
  29  * @compile -source 1.5 ZeroScalingTests.java
  30  * @run main ZeroScalingTests
  31  */
  32 
  33 import java.math.*;
  34 import java.util.*;
  35 
  36 public class ZeroScalingTests {
  37 
  38     static MathContext longEnough = new MathContext(50, RoundingMode.UNNECESSARY);
  39 
  40     static BigDecimal[]  zeros = new BigDecimal[23];
  41     static {
  42         for(int i = 0; i < 21; i++) {
  43             zeros[i] = new BigDecimal(BigInteger.ZERO, i-10);
  44         }
  45         zeros[21] = new BigDecimal(BigInteger.ZERO, Integer.MIN_VALUE);
  46         zeros[22] = new BigDecimal(BigInteger.ZERO, Integer.MAX_VALUE);
  47     }
  48 
  49     static BigDecimal element = BigDecimal.valueOf(100, -2);
  50 




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4902952 4905407 4916149
  27  * @summary Tests that the scale of zero is propagated properly and has the proper effect.
  28  * @author Joseph D. Darcy


  29  */
  30 
  31 import java.math.*;
  32 import java.util.*;
  33 
  34 public class ZeroScalingTests {
  35 
  36     static MathContext longEnough = new MathContext(50, RoundingMode.UNNECESSARY);
  37 
  38     static BigDecimal[]  zeros = new BigDecimal[23];
  39     static {
  40         for(int i = 0; i < 21; i++) {
  41             zeros[i] = new BigDecimal(BigInteger.ZERO, i-10);
  42         }
  43         zeros[21] = new BigDecimal(BigInteger.ZERO, Integer.MIN_VALUE);
  44         zeros[22] = new BigDecimal(BigInteger.ZERO, Integer.MAX_VALUE);
  45     }
  46 
  47     static BigDecimal element = BigDecimal.valueOf(100, -2);
  48