From b2dfb94dd11dd0527be185a119ff4de3ffd41e47 Mon Sep 17 00:00:00 2001 From: Andrew Fitzgibbon Date: Thu, 6 Jun 2024 13:54:36 +0100 Subject: [PATCH] Address PR Comment --- src/gfloat/round.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gfloat/round.py b/src/gfloat/round.py index 8bec81e..2d1f38e 100644 --- a/src/gfloat/round.py +++ b/src/gfloat/round.py @@ -86,8 +86,8 @@ def round_float( isignificand += 1 ## Special case for Precision=1, all-log format with zero. + # The logic is simply duplicated (and isignificand overwritten) for clarity. if fi.precision == 1: - # The logic is simply duplicated for clarity of reading. isignificand = math.floor(fsignificand) code_is_odd = isignificand != 0 and _isodd(expval + bias) if ( @@ -105,8 +105,9 @@ def round_float( else: assert isignificand == 1 expval += 1 - ## End special case for Precision=1. + ## End special case for Precision=1. + # Reconstruct rounded result to float result = isignificand * (2.0**expval) if result == 0: