Skip to content

Commit 0e77319

Browse files
committed
fix sign-denormal conflict
1 parent 79392f8 commit 0e77319

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ieee754/IEEE754.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ def validate_number(self, number: str) -> Decimal:
107107
denormalized_range = self.calculate_denormalized_range(
108108
self.__exponent, self.__mantissa
109109
)
110-
if Decimal(number) < Decimal(denormalized_range[0]):
110+
if Decimal(number).copy_abs() < Decimal(denormalized_range[0]):
111111
raise ValueError(
112112
f"Number is too small, must be larger than {denormalized_range[0]}, we lost both exponent and mantissa, please increase precision."
113113
)
114-
if Decimal(number) < Decimal(denormalized_range[1]):
114+
if Decimal(number).copy_abs() < Decimal(denormalized_range[1]):
115115
raise ValueError(
116116
f"Number is too small, must be larger than {denormalized_range[1]}, we lost exponent, please increase precision."
117117
)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
setup(
77
name="ieee754",
88
packages=["ieee754"],
9-
version="0.5",
9+
version="0.6",
1010
license="MIT",
1111
description="A Python module which converts floating points numbers into IEEE-754 representation.",
1212
long_description=long_description,
1313
long_description_content_type="text/markdown",
1414
author="Bora Canbula",
1515
author_email="bora.canbula@cbu.edu.tr",
1616
url="https://github.com/canbula/ieee754",
17-
download_url="https://github.com/canbula/ieee754/archive/refs/tags/v_05.tar.gz",
17+
download_url="https://github.com/canbula/ieee754/archive/refs/tags/v_06.tar.gz",
1818
keywords=[
1919
"IEEE-754",
2020
"precisions",

0 commit comments

Comments
 (0)