Fix multiplication of Decimal with float
This commit is contained in:
1 parent
6478825503
commit
3d3401c942
1 file changed
+1
-1
@@ -91,7 +91,7 @@ class DecimalField(DeviceField):
|
|||||||
|
|
||||||
def parse(self, data: bytes) -> Decimal:
|
def parse(self, data: bytes) -> Decimal:
|
||||||
val = Decimal(struct.unpack("!H", data)[0])
|
val = Decimal(struct.unpack("!H", data)[0])
|
||||||
return (val / 10 ** self.scale) * self.multiplier
|
return (val / 10 ** self.scale) * Decimal(self.multiplier)
|
||||||
|
|
||||||
def in_range(self, val: Decimal) -> bool:
|
def in_range(self, val: Decimal) -> bool:
|
||||||
if self.range is None:
|
if self.range is None:
|
||||||
|
|||||||
Reference in new issue
Block a user