X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fieee754%2Ffpsqrt%2Ffsqrt.py;h=f7410703643e763c0ad5c43c57e6c39b3c12e71e;hb=75f9bd28e14c789872060997a655335bbdaed1aa;hp=5ae2bb253fa1356ec89f2960930b884faf51a2db;hpb=5690d1f94f158cbc8e715b9943d3eaba32cec9e3;p=ieee754fpu.git diff --git a/src/ieee754/fpsqrt/fsqrt.py b/src/ieee754/fpsqrt/fsqrt.py index 5ae2bb25..f7410703 100644 --- a/src/ieee754/fpsqrt/fsqrt.py +++ b/src/ieee754/fpsqrt/fsqrt.py @@ -92,17 +92,19 @@ def normalise(s, m, e, lowbits): #if the num is NaN, then adjust (normalised NaN rather than de-normed NaN) if (e == 128 & m !=0): # these are in IEEE754 format, this function returns s,e,m not z - z[31] = 1 # sign (so, s=1) - z[30:23] = 255 # exponent (minus 128, so e = 127 - z[22] = 1 # high bit of mantissa, so m = 1<<22 i think - z[21:0] = 0 # rest of mantissa is zero, so m = 1<<22 is good. + s = 1 # sign (so, s=1) + e = 255 # exponent (minus 128, so e = 127 + m = 1<<22 # high bit of mantissa, so m = 1<<22 i think + m = 1 + m = 1<<22 # rest of mantissa is zero, so m = 1<<22 is good. + m = 0 #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 - z[31] = s # s is already s, so do nothing to s. - z[30:23] = 255 # have to subtract 128, so e = 127 (again) - z[22:0] = 0 # mantissa... so m=0 + s = 1 # s is already s, so do nothing to s. + m = 255 # have to subtract 128, so e = 127 (again) + m = 0 # mantissa... so m=0 return s, m, e