@Test public void sub(){ double result = 0D; double v1 = 456456456.46554; double v2 = 4545889963333333.6456; BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b2 = new BigDecimal(Double.toString(v2)); result = b1.subtract(b2).doubleValue(); Log.d("======", "得到结果result---------->" + result); }
public static double sub(double v1, double v2) { double result = 0D; try { BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b2 = new BigDecimal(Double.toString(v2)); result = b1.subtract(b2).doubleValue(); } catch (Exception e) { LogUtils.e(e.getMessage(),e.fillInStackTrace()); } return result; }
BigDecimalUtil { public static double sub(double v1, double v2) { double result = 0D; try { BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b2 = new BigDecimal(Double.toString(v2)); result = b1.subtract(b2).doubleValue(); } catch (Exception e) { LogUtils.e(e.getMessage(),e.fillInStackTrace()); } return result; } }
BigDecimalUtil { public static double sub(double v1, double v2) { double result = 0D; try { BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b2 = new BigDecimal(Double.toString(v2)); result = b1.subtract(b2).doubleValue(); } catch (Exception e) { LogUtils.e(e.getMessage(),e.fillInStackTrace()); } return result; } private  BigDecimalUtil(); }
BigDecimalUtil { public static double sub(double v1, double v2) { double result = 0D; try { BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b2 = new BigDecimal(Double.toString(v2)); result = b1.subtract(b2).doubleValue(); } catch (Exception e) { LogUtils.e(e.getMessage(),e.fillInStackTrace()); } return result; } private  BigDecimalUtil(); static double add(long v1, long v2); static double add(double v1, double v2); static BigDecimal add(String v1, String v2); static double add(double v1, double v2, int scale, RoundingMode roundingMode); static double sub(double v1, double v2); static BigDecimal sub(String v1, String v2); static double mul(double v1, double v2); static BigDecimal mul(String v1, String v2); static String div(String v1, String v2); static double div(double v1, double v2); static double div(double v1, double v2, int scale); static String div(String v1, String v2, int scale); static String div(String v1, String v2, int scale, int roundingMode); static double round(double v, int scale); static float convertsToFloat(double v); static float convertsToFloat(String v); static int convertsToInt(double v); static long convertsToLong(double v); static double returnMax(double v1, double v2); static double returnMin(double v1, double v2); static int compareTo(double v1, double v2); static String parseString(double value); static boolean isBigger(String val1, String val2); static boolean isNotSmaller(String val1, String val2); static boolean isBiggerThanZero(String val1); static boolean isEqualsZero(BigDecimal bigDecimal); static BigDecimal toBigDecimal(String value); static int compareTo(String val1, String val2); }
BigDecimalUtil { public static double sub(double v1, double v2) { double result = 0D; try { BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b2 = new BigDecimal(Double.toString(v2)); result = b1.subtract(b2).doubleValue(); } catch (Exception e) { LogUtils.e(e.getMessage(),e.fillInStackTrace()); } return result; } private  BigDecimalUtil(); static double add(long v1, long v2); static double add(double v1, double v2); static BigDecimal add(String v1, String v2); static double add(double v1, double v2, int scale, RoundingMode roundingMode); static double sub(double v1, double v2); static BigDecimal sub(String v1, String v2); static double mul(double v1, double v2); static BigDecimal mul(String v1, String v2); static String div(String v1, String v2); static double div(double v1, double v2); static double div(double v1, double v2, int scale); static String div(String v1, String v2, int scale); static String div(String v1, String v2, int scale, int roundingMode); static double round(double v, int scale); static float convertsToFloat(double v); static float convertsToFloat(String v); static int convertsToInt(double v); static long convertsToLong(double v); static double returnMax(double v1, double v2); static double returnMin(double v1, double v2); static int compareTo(double v1, double v2); static String parseString(double value); static boolean isBigger(String val1, String val2); static boolean isNotSmaller(String val1, String val2); static boolean isBiggerThanZero(String val1); static boolean isEqualsZero(BigDecimal bigDecimal); static BigDecimal toBigDecimal(String value); static int compareTo(String val1, String val2);  }