Code example for BigDecimal

Methods: compareTo

0
 
	/** 
	 * @tests java.math.BigDecimal#compareTo(java.math.BigDecimal) 
	 */ 
	public void test_compareToLjava_math_BigDecimal() { 
		BigDecimal comp1 = new BigDecimal("1.00");
		BigDecimal comp2 = new BigDecimal(1.000000D);
		assertTrue("1.00 and 1.000000 should be equal",
				comp1.compareTo(comp2) == 0);
		BigDecimal comp3 = new BigDecimal("1.02");
		assertTrue("1.02 should be bigger than 1.00",
				comp3.compareTo(comp1) == 1);
		BigDecimal comp4 = new BigDecimal(0.98D);
		assertTrue("0.98 should be less than 1.00",
				comp4.compareTo(comp1) == -1);
	} 
 
	/** 
	 * @tests java.math.BigDecimal#divide(java.math.BigDecimal, int) 
	 */ 
	public void test_divideLjava_math_BigDecimalI() {