Code example for BigDecimal

Methods: equals

0
		equal1 = new BigDecimal("1.00");
		equal2 = new BigDecimal(val, 2);
		assertTrue("1.00(string) and 1.00(bigInteger) should be equal", equal1
				.equals(equal2));
		equal1 = new BigDecimal(100D);
		equal2 = new BigDecimal("2.34576");
		assertFalse("100D and 2.34576 should not be equal", equal1
				.equals(equal2));
		assertFalse("bigDecimal 100D does not equal string 23415", equal1
				.equals("23415"));
	} 
 
	/** 
	 * @tests java.math.BigDecimal#floatValue() 
	 */ 
	public void test_floatValue() { 
		BigDecimal fl1 = new BigDecimal("234563782344567");
		assertTrue("the float representation of bigDecimal 234563782344567",
				fl1.floatValue() == 234563782344567f);
		BigDecimal fl2 = new BigDecimal(2.345E37);
		assertTrue("the float representation of bigDecimal 2.345E37", fl2