aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-10-18 15:31:32 -0700
committerGitHub <noreply@github.com>2020-10-18 15:31:32 -0700
commitb58190b2251526cdfe0e1ffec7995c2b9f9962f4 (patch)
treee09e5222b6b0596f48433dcd536396f64b4d8615 /src/main/java/org
parent01429a90583b221a84e5d40a9acc654377b41f52 (diff)
parent457c6a29077ebb143e40c29fdc37863b8d46357a (diff)
downloadtrackermap-server-b58190b2251526cdfe0e1ffec7995c2b9f9962f4.tar.gz
trackermap-server-b58190b2251526cdfe0e1ffec7995c2b9f9962f4.tar.bz2
trackermap-server-b58190b2251526cdfe0e1ffec7995c2b9f9962f4.zip
Merge pull request #4586 from kamaci/master
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.java2
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();
}