Here you can find the source of sub(BigDecimal d1, BigDecimal d2)
public static BigDecimal sub(BigDecimal d1, BigDecimal d2)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; public class Main { public static double sub(double d1, double d2) { BigDecimal b1 = new BigDecimal(Double.toString(d1)); BigDecimal b2 = new BigDecimal(Double.toString(d2)); return b1.subtract(b2).doubleValue(); }/* w w w .jav a2s.c om*/ public static BigDecimal sub(BigDecimal d1, BigDecimal d2) { return d1.subtract(d2); } }