From 61ef3f245ee02904d870a75254a2744ecc698c74 Mon Sep 17 00:00:00 2001 From: Mark Herwege Date: Mon, 20 Jan 2025 18:05:01 +0100 Subject: [PATCH] use BigDecimal in comparison Signed-off-by: Mark Herwege --- .../main/java/org/openhab/core/library/types/QuantityType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/QuantityType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/QuantityType.java index 69f60981ba7..3bcb5b8800d 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/QuantityType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/QuantityType.java @@ -268,7 +268,7 @@ private int internalCompareTo(QuantityType o) { QuantityType v1 = this.toUnit(getUnit().getSystemUnit()); QuantityType v2 = o.toUnit(o.getUnit().getSystemUnit()); if (v1 != null && v2 != null) { - return Double.compare(v1.doubleValue(), v2.doubleValue()); + return v1.toBigDecimal().compareTo(v2.toBigDecimal()); } else { throw new IllegalArgumentException("Unable to convert to system unit during compare."); }