Skip to content

Commit be5928f

Browse files
authored
Merge pull request #27 from graphcore-research/simplify-round-2
Quick update to #26
2 parents aea875d + b2dfb94 commit be5928f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/gfloat/round.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ def round_float(
8686
isignificand += 1
8787

8888
## Special case for Precision=1, all-log format with zero.
89+
# The logic is simply duplicated (and isignificand overwritten) for clarity.
8990
if fi.precision == 1:
90-
# The logic is simply duplicated for clarity of reading.
9191
isignificand = math.floor(fsignificand)
9292
code_is_odd = isignificand != 0 and _isodd(expval + bias)
9393
if (
@@ -105,8 +105,9 @@ def round_float(
105105
else:
106106
assert isignificand == 1
107107
expval += 1
108-
## End special case for Precision=1.
108+
## End special case for Precision=1.
109109

110+
# Reconstruct rounded result to float
110111
result = isignificand * (2.0**expval)
111112

112113
if result == 0:

0 commit comments

Comments
 (0)