在这个片段中,我期望“2”作为结果?
Apfloat f = new Apfloat("1.5", 50);
f = ApfloatMath.round(f, 15, RoundingMode.HALF_UP);
System.out.println(f.toString());
还是应该以不同的方式使用ApfloatMath.round()?
在这个片段中,我期望“2”作为结果?
Apfloat f = new Apfloat("1.5", 50);
f = ApfloatMath.round(f, 15, RoundingMode.HALF_UP);
System.out.println(f.toString());
还是应该以不同的方式使用ApfloatMath.round()?
I have never heard of apfloat but one google query showed me:
round(Apfloat x, long precision, RoundingMode roundingMode)
So apparently you are rounding with a precision of 15, why do you expect 1.5 to magically become 2?
In other words: set precision to 0 or 1 (depends on the implementation)