Here you can find the source of divide(Double a, Double b)
public static Double divide(Double a, Double b)
//package com.java2s; import java.math.BigDecimal; public class Main { /**/* w w w. j ava 2s .co m*/ * Double divide * @param a * @param b * @return * @Create Sin@2012/2/23 */ public static BigDecimal divide(String a, String b, int scale, int roundMode) { BigDecimal bd1 = new BigDecimal(a); BigDecimal bd2 = new BigDecimal(b); return bd1.divide(bd2, scale, roundMode); } public static Double divide(Double a, Double b, int scale, int roundMode) throws Exception { BigDecimal bd1 = new BigDecimal(a.toString()); BigDecimal bd2 = new BigDecimal(b.toString()); return bd1.divide(bd2, scale, roundMode).doubleValue(); } public static Double divide(Double a, Double b) { BigDecimal bd1 = new BigDecimal(a.toString()); BigDecimal bd2 = new BigDecimal(b.toString()); return bd1.divide(bd2).doubleValue(); } }