amelentev / java-oo

Java Operator Overloading
http://amelentev.github.io/java-oo/
268 stars 31 forks source link

Does not work when performing possibly non-terminating decimal result division. #54

Closed PowerUser1234 closed 6 years ago

PowerUser1234 commented 6 years ago

BigDecimal a = new BigDecimal(1, MathContext.DECIMAL64);

BigDecimal b = new BigDecimal(3, MathContext.DECIMAL64);

BigDecimal c2 = a/b;

out.println(c2);

amelentev commented 6 years ago

javaoo only provides operators syntactic sugar. what operators do is up to its implementation. I cannot affect BigDecimal#divide implementation.

amelentev commented 6 years ago

As a workaround, you can create your wrapper classes and override divide method to something like super.divide(x, precision, RoundingMode.HALF_UP). Or you can use another bigmath library.