diff options
author | kamaci <furkankamaci@gmail.com> | 2020-10-19 01:03:44 +0300 |
---|---|---|
committer | kamaci <furkankamaci@gmail.com> | 2020-10-19 01:03:44 +0300 |
commit | 457c6a29077ebb143e40c29fdc37863b8d46357a (patch) | |
tree | c4cff2c6ca0d1b22ead53cabf9dda04d5ff0aacf /src/main/java/org | |
parent | 9e25f74ac2ad8193cc45236403cceea5becb37ff (diff) | |
download | trackermap-server-457c6a29077ebb143e40c29fdc37863b8d46357a.tar.gz trackermap-server-457c6a29077ebb143e40c29fdc37863b8d46357a.tar.bz2 trackermap-server-457c6a29077ebb143e40c29fdc37863b8d46357a.zip |
BigDecimal.valueOf(double) is used because of floating point imprecision.
Diffstat (limited to 'src/main/java/org')
-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(); } |