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:
Hilbrand Bouwkamp 2018-07-23 13:11:05 +02:00 committed by Kai Kreuzer
parent 33c7f838fc
commit ad3f6df25a

View File

@ -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) {