java - Why does HALF_UP sometimes round down with double? -
the following code: double doublevalue = 1713.6; float floatvalue = 1713.6f; string fs = "%-9s : %-7s %-7s\n"; system.out.printf( fs, "", "double", "float" ); decimalformat format = new decimalformat("#0"); system.out.printf( fs, "tostring", string.valueof( doublevalue ), string.valueof( floatvalue ) ); format.setroundingmode( roundingmode.down ); system.out.printf( fs, "down", format.format( doublevalue ), format.format( floatvalue ) ); format.setroundingmode( roundingmode.half_down ); system.out.printf( fs, "half_down", format.format( doublevalue ), format.format( floatvalue ) ); format.setroundingmode( roundingmode.half_up ); system.out.printf( fs, "half_up", format.format( doublevalue ), format.format( floatvalue ) ); format.setroundingmode( roundingmode.up ); system.out.printf( fs, "up", format.format( doublevalue ), format.format( floatvalue ) ); produces result ( live...