publicstaticvoid testBigDecimalRounding() { var res1 = String.format("%g", 0.00009999999999999995); var res2 = String.format("%g", 0.00009999999f); var res3 = String.format("%g", new BigDecimal(0.0001)); java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 var res4 = String.format("%g", new BigDecimal("0.00009999999999999999995"));
var res5 = String.format("%.9g", 999999.999999432168754e+3); var res6 = String.format("%.9g", 999999999.999432168754f); var res7 = String.format("% *questions.
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 8
assertEquals )
assertEquals(res7, res8);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.