mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 11:45:49 +01:00
Changed constructors DecimalType to work the same as ESH DecimalType (#372)
The constructors of DecimalType in ESH use BigDecimal.valueOf instead of new BigDecimal. Using valueOf is better because the new constuctors causes undesired rounding. For example the value 0.32 becomes: 0.320000000000000006661338147750939242541790008544921875. With valueOf this doesn't happen. This change will make it work the same as the ESH DecimalType Closes #371 Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
This commit is contained in:
parent
33c7f838fc
commit
ad3f6df25a
@ -38,11 +38,11 @@ public class DecimalType extends Number implements PrimitiveType, State, Command
|
||||
}
|
||||
|
||||
public DecimalType(long value) {
|
||||
this.value = new BigDecimal(value);
|
||||
this.value = BigDecimal.valueOf(value);
|
||||
}
|
||||
|
||||
public DecimalType(double value) {
|
||||
this.value = new BigDecimal(value);
|
||||
this.value = BigDecimal.valueOf(value);
|
||||
}
|
||||
|
||||
public DecimalType(String value) {
|
||||
|
Loading…
Reference in New Issue
Block a user