List of usage examples for java.math BigDecimal subtract
public BigDecimal subtract(BigDecimal subtrahend)
From source file:Main.java
public static double sub(double v1, double v2) { BigDecimal a = new BigDecimal(v1); BigDecimal b = new BigDecimal(v2); BigDecimal c = a.subtract(b); c.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); return c.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); }
From source file:Main.java
public static double sub(String value1, String value2) { BigDecimal b1 = new BigDecimal(value1); BigDecimal b2 = new BigDecimal(value2); return b1.subtract(b2).doubleValue(); }
From source file:Main.java
public static double sub(double value1, double value2) { BigDecimal b1 = BigDecimal.valueOf(value1); BigDecimal b2 = BigDecimal.valueOf(value2); return b1.subtract(b2).doubleValue(); }
From source file:Main.java
public static float subFloat(Float v1, Float v2) { BigDecimal b1 = new BigDecimal(Float.toString(v1)); BigDecimal b2 = new BigDecimal(Float.toString(v2)); return b1.subtract(b2).floatValue(); }
From source file:Main.java
public static double subtract(double d1, double d2) { BigDecimal b1 = new BigDecimal(Double.toString(d1)); BigDecimal b2 = new BigDecimal(Double.toString(d2)); return b1.subtract(b2).doubleValue(); }
From source file:Main.java
public static double doubleJian(double d1, double d2) { BigDecimal bd1 = new BigDecimal(Double.toString(d1)); BigDecimal bd2 = new BigDecimal(Double.toString(d2)); return bd1.subtract(bd2).doubleValue(); }
From source file:Main.java
public static double sub(double value1, double value2) { BigDecimal b1 = new BigDecimal(value1); BigDecimal b2 = new BigDecimal(value2); return b1.subtract(b2).doubleValue(); }
From source file:Main.java
public static double subtract(double d1, double d2) { BigDecimal bd1 = new BigDecimal(Double.toString(d1)); BigDecimal bd2 = new BigDecimal(Double.toString(d2)); return bd1.subtract(bd2).doubleValue(); }
From source file:Main.java
public static Double sub(Double v1, Double v2) { BigDecimal b1 = new BigDecimal(v1.toString()); BigDecimal b2 = new BigDecimal(v2.toString()); return Double.valueOf(b1.subtract(b2).doubleValue()); }
From source file:Main.java
public static double sub(double value1, double value2) { BigDecimal b1 = new BigDecimal(Double.valueOf(value1)); BigDecimal b2 = new BigDecimal(Double.valueOf(value2)); return b1.subtract(b2).doubleValue(); }