USA → European DecimalFormat bug
Brought to you by:
marbach
Hello,
When performing "Evaluation" → "Generate" on a machine with an OS installation that uses the comma (",") as a decimal seperator, the function "roundTwoDecimals" located in '\gnw-3.1b-src\src\ch\epfl\lis\gnw\evaluation\Score.java' erroneously returns results such as "0,01" instead of the proper "0.01".
To fix this I implemented the following workaround (inspired by http://stackoverflow.com/a/5054217/1750173):
double roundTwoDecimals(double d) { /*added*/DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.US); /*changed*/DecimalFormat twoDForm = new DecimalFormat("#.##", otherSymbols); return Double.valueOf(twoDForm.format(d)); }
Good luck implementing this change.
Greetings,
Boris Breuer