aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authorkamaci <furkankamaci@gmail.com>2020-10-19 01:03:44 +0300
committerkamaci <furkankamaci@gmail.com>2020-10-19 01:03:44 +0300
commit457c6a29077ebb143e40c29fdc37863b8d46357a (patch)
treec4cff2c6ca0d1b22ead53cabf9dda04d5ff0aacf /src/main/java/org/traccar
parent9e25f74ac2ad8193cc45236403cceea5becb37ff (diff)
downloadtraccar-server-457c6a29077ebb143e40c29fdc37863b8d46357a.tar.gz
traccar-server-457c6a29077ebb143e40c29fdc37863b8d46357a.tar.bz2
traccar-server-457c6a29077ebb143e40c29fdc37863b8d46357a.zip
BigDecimal.valueOf(double) is used because of floating point imprecision.
Diffstat (limited to 'src/main/java/org/traccar')
-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();
}