fix small rounding error
This commit is contained in:
parent
76fe128af4
commit
51732515a8
1 changed files with 2 additions and 2 deletions
|
@ -62,9 +62,9 @@ public class OsmAndFormatter {
|
|||
if (meters >= 100 * mainUnitInMeters) {
|
||||
return (int) (meters / mainUnitInMeters + 0.5) + " " + ctx.getString(mainUnitStr); //$NON-NLS-1$
|
||||
} else if (meters > 9.99f * mainUnitInMeters) {
|
||||
return MessageFormat.format("{0,number,#.#} " + ctx.getString(mainUnitStr), ((float) meters + 0.5) / mainUnitInMeters); //$NON-NLS-1$
|
||||
return MessageFormat.format("{0,number,#.#} " + ctx.getString(mainUnitStr), ((float) meters) / mainUnitInMeters); //$NON-NLS-1$
|
||||
} else if (meters > 0.999f * mainUnitInMeters) {
|
||||
return MessageFormat.format("{0,number,#.##} " + ctx.getString(mainUnitStr), ((float) meters + 0.5) / mainUnitInMeters); //$NON-NLS-1$
|
||||
return MessageFormat.format("{0,number,#.##} " + ctx.getString(mainUnitStr), ((float) meters) / mainUnitInMeters); //$NON-NLS-1$
|
||||
} else {
|
||||
if (mc == MetricsConstants.KILOMETERS_AND_METERS) {
|
||||
return ((int) meters + 0.5) + " " + ctx.getString(R.string.m); //$NON-NLS-1$
|
||||
|
|
Loading…
Reference in a new issue