Code example for BigDecimal

Methods: equals, max

0
 
	/** 
	 * @tests java.math.BigDecimal#max(java.math.BigDecimal) 
	 */ 
	public void test_maxLjava_math_BigDecimal() { 
		BigDecimal max1 = new BigDecimal(value2, 1);
		BigDecimal max2 = new BigDecimal(value2, 4);
		assertTrue("1233456000.0 is not greater than 1233456", max1.max(max2)
				.equals(max1));
		max1 = new BigDecimal(-1.224D);
		max2 = new BigDecimal(-1.2245D);
		assertTrue("-1.224 is not greater than -1.2245", max1.max(max2).equals(
				max1));
		max1 = new BigDecimal(123E18);
		max2 = new BigDecimal(123E19);
		assertTrue("123E19 is the not the max", max1.max(max2).equals(max2));
	} 
 
	/** 
	 * @tests java.math.BigDecimal#min(java.math.BigDecimal) 
	 */