From b43dab3caf38ae1412efa96938b3f36a3cfaeae8 Mon Sep 17 00:00:00 2001 From: Aleksandar Kostovic Date: Wed, 8 May 2019 17:11:48 +0200 Subject: [PATCH] Fix exponent offsets --- src/ieee754/fpsqrt/fsqrt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ieee754/fpsqrt/fsqrt.py b/src/ieee754/fpsqrt/fsqrt.py index 0c8aa1e5..3f63ce78 100644 --- a/src/ieee754/fpsqrt/fsqrt.py +++ b/src/ieee754/fpsqrt/fsqrt.py @@ -93,14 +93,14 @@ def normalise(s, m, e, lowbits): if (e == 128 & m !=0): # these are in IEEE754 format, this function returns s,e,m not z s = 1 # sign (so, s=1) - e = 127 # exponent (minus 128, so e = 127 + e = 128 # exponent (minus 127, so e = 128 m = 1<<22 # high bit of mantissa, so m = 1<<22 i think #if the num is Inf, then adjust (to normalised +/-INF) if (e == 128): # these are in IEEE754 format, this function returns s,e,m not z s = 1 # s is already s, so do nothing to s. - e = 127 # have to subtract 128, so e = 127 (again) + e = 128 # have to subtract 127, so e = 128 (again) m = 0 # mantissa... so m=0 return s, m, e -- 2.30.2