Here you can find the source of divideDouble(double first, double second, int scale, int roundingMode)
public static double divideDouble(double first, double second, int scale, int roundingMode)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; public class Main { public static double divideDouble(double first, double second, int scale, int roundingMode) { BigDecimal b1 = new BigDecimal(first); BigDecimal b2 = new BigDecimal(second); if (roundingMode == -1) { roundingMode = BigDecimal.ROUND_HALF_EVEN; }//from w w w .j a v a 2 s . c o m return b1.divide(b2, scale, BigDecimal.ROUND_HALF_EVEN).doubleValue(); } }