Code example for BigDecimal

Methods: add, doubleValue

0
		bigDB = new BigDecimal(Double.MAX_VALUE);
		bigDB = bigDB.add(bigDB);
		assertTrue(
				"a  + number out of the double range should return infinity", 
				bigDB.doubleValue() == Double.POSITIVE_INFINITY);
		bigDB = new BigDecimal(-Double.MAX_VALUE);
		bigDB = bigDB.add(bigDB);
		assertTrue(
				"a  - number out of the double range should return neg infinity", 
				bigDB.doubleValue() == Double.NEGATIVE_INFINITY);
	} 
 
	/** 
	 * @tests java.math.BigDecimal#equals(java.lang.Object) 
	 */ 
	public void test_equalsLjava_lang_Object() { 
		BigDecimal equal1 = new BigDecimal(1.00D);
		BigDecimal equal2 = new BigDecimal("1.0");
		assertFalse("1.00 and 1.0 should not be equal",
				equal1.equals(equal2));
		equal2 = new BigDecimal(1.01D);