Here you can find the source of add(Double a, Double b)
public static Double add(Double a, Double b) throws Exception
//package com.java2s; import java.math.BigDecimal; public class Main { /**//from w ww . ja v a2s . co m * Double add * @param a * @param b * @return * @Create Sin@2012/2/23 */ public static BigDecimal add(String a, String b) { BigDecimal bd1 = new BigDecimal(a); BigDecimal bd2 = new BigDecimal(b); return bd1.add(bd2); } public static Double add(Double a, Double b) throws Exception { BigDecimal bd1 = new BigDecimal(a.toString()); BigDecimal bd2 = new BigDecimal(b.toString()); return bd1.add(bd2).doubleValue(); } }