Precision errors in float to string methods (#7809)

* replaced fixValue with autoFixed

* Reverted, only fixValue implementation
This commit is contained in:
matusm1
2022-11-03 23:02:24 +01:00
committed by GitHub
parent e073eca93c
commit 3a0f4409fc

View File

@@ -35,8 +35,7 @@ public class StatValues{
}
public static String fixValue(float value){
int precision = Math.abs((int)value - value) <= 0.001f ? 0 : Math.abs((int)(value * 10) - value * 10) <= 0.001f ? 1 : 2;
return Strings.fixed(value, precision);
return Strings.autoFixed(value, 2);
}
public static StatValue squared(float value, StatUnit unit){