Skip to content

Commit

Permalink
fix sign-denormal conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
canbula committed Nov 16, 2023
1 parent 79392f8 commit 0e77319
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ieee754/IEEE754.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ def validate_number(self, number: str) -> Decimal:
denormalized_range = self.calculate_denormalized_range(
self.__exponent, self.__mantissa
)
if Decimal(number) < Decimal(denormalized_range[0]):
if Decimal(number).copy_abs() < Decimal(denormalized_range[0]):
raise ValueError(
f"Number is too small, must be larger than {denormalized_range[0]}, we lost both exponent and mantissa, please increase precision."
)
if Decimal(number) < Decimal(denormalized_range[1]):
if Decimal(number).copy_abs() < Decimal(denormalized_range[1]):
raise ValueError(
f"Number is too small, must be larger than {denormalized_range[1]}, we lost exponent, please increase precision."
)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
setup(
name="ieee754",
packages=["ieee754"],
version="0.5",
version="0.6",
license="MIT",
description="A Python module which converts floating points numbers into IEEE-754 representation.",
long_description=long_description,
long_description_content_type="text/markdown",
author="Bora Canbula",
author_email="bora.canbula@cbu.edu.tr",
url="https://github.com/canbula/ieee754",
download_url="https://github.com/canbula/ieee754/archive/refs/tags/v_05.tar.gz",
download_url="https://github.com/canbula/ieee754/archive/refs/tags/v_06.tar.gz",
keywords=[
"IEEE-754",
"precisions",
Expand Down

0 comments on commit 0e77319

Please sign in to comment.