diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-10-18 15:31:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-18 15:31:32 -0700 |
commit | b58190b2251526cdfe0e1ffec7995c2b9f9962f4 (patch) | |
tree | e09e5222b6b0596f48433dcd536396f64b4d8615 /src | |
parent | 01429a90583b221a84e5d40a9acc654377b41f52 (diff) | |
parent | 457c6a29077ebb143e40c29fdc37863b8d46357a (diff) | |
download | traccar-server-b58190b2251526cdfe0e1ffec7995c2b9f9962f4.tar.gz traccar-server-b58190b2251526cdfe0e1ffec7995c2b9f9962f4.tar.bz2 traccar-server-b58190b2251526cdfe0e1ffec7995c2b9f9962f4.zip |
Merge pull request #4586 from kamaci/master
BigDecimal.valueOf(double) is used because of floating point imprecision
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/reports/ReportUtils.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/reports/ReportUtils.java b/src/main/java/org/traccar/reports/ReportUtils.java index af686ba20..870264fad 100644 --- a/src/main/java/org/traccar/reports/ReportUtils.java +++ b/src/main/java/org/traccar/reports/ReportUtils.java @@ -112,7 +112,7 @@ public final class ReportUtils { if (firstPosition.getAttributes().get(Position.KEY_FUEL_LEVEL) != null && lastPosition.getAttributes().get(Position.KEY_FUEL_LEVEL) != null) { - BigDecimal value = new BigDecimal(firstPosition.getDouble(Position.KEY_FUEL_LEVEL) + BigDecimal value = BigDecimal.valueOf(firstPosition.getDouble(Position.KEY_FUEL_LEVEL) - lastPosition.getDouble(Position.KEY_FUEL_LEVEL)); return value.setScale(1, RoundingMode.HALF_EVEN).doubleValue(); } |