public void testAddEqualScaleNegNeg(){
  String a="1231212478987482988429808779810457634781384756794987";
  int aScale=-10;
  String b="747233429293018787918347987234564568";
  int bScale=-10;
  String c="1.231212478987483735663238072829245553129371991359555E+61";
  int cScale=-10;
  BigDecimal aNumber=new BigDecimal(new BigInteger(a),aScale);
  BigDecimal bNumber=new BigDecimal(new BigInteger(b),bScale);
  BigDecimal result=aNumber.add(bNumber);
  assertEquals("incorrect value",c,result.toString());
  assertEquals("incorrect scale",cScale,result.scale());
}

public void testAddEqualScaleNegNeg ( ) { String a = "1231212478987482988429808779810457634781384756794987" ; int aScale = - 10 ; String b = "747233429293018787918347987234564568" ; int bScale = - 10 ; String c = "1.231212478987483735663238072829245553129371991359555E+61" ; int cScale = - 10 ; BigDecimal aNumber = new BigDecimal ( new BigInteger ( a ) , aScale ) ; BigDecimal bNumber = new BigDecimal ( new BigInteger ( b ) , bScale ) ; BigDecimal result = aNumber . add ( bNumber ) ; assertEquals ( "incorrect value" , c , result . toString ( ) ) ; assertEquals ( "incorrect scale" , cScale , result . scale ( ) ) ; }
add two numbers of equal negative scales
