"%.3f".format(1) returns 1.000.
"%.3f".format(4.0/3.0) returns 1.333.
Is there some easy way to have these return 1 and 1.333? I thought the standard printf format specified that precision as the maximum already, but apparently not in Scala.
The default formatter used by printf seems to be a generic one that doesn’t have all the same support than
[DecimalFormat][1]. You can instantiate a custom formatter along those lines:See: http://docs.oracle.com/javase/tutorial/java/data/numberformat.html for more information.