The default java String.format by default rounds floating point values to 6 digits, this can be overridden by using format specifiers in the format string.
How would one go about creating an instance of Formater that by default prints the full machine precision of the float or double to be formatted but retains the ability to specify a lower precision in the format string.
To exemplify, the following code
String.format("%f",1.23456789)
returns
1.234568
I want to create a custom Formatter so that
MyFormatter.format("%f",1.23456789)
returns
1.23456789
while producing identical output to String.format if the format string is "%.2f"
that is
String.format("%.2f",1.23456789).equals(MyFormatter.format("%.2f",1.23456789))
should evaluate to true