X-Git-Url: https://git.libre-soc.org/?p=ieee754fpu.git;a=blobdiff_plain;f=src%2Fieee754%2Ffpsqrt%2Ffsqrt.py;h=15f1555d969098246dc9df4bf1f3ffce812d6958;hp=02449b0f75b41b0ba2e004711d9570ccca49ca3d;hb=2a273381d3f843cd58b99cbc45728761a4d12d0d;hpb=23daa4a7dbe5d98b00bbd468b35e7b2f2c782ff4 diff --git a/src/ieee754/fpsqrt/fsqrt.py b/src/ieee754/fpsqrt/fsqrt.py index 02449b0f..15f1555d 100644 --- a/src/ieee754/fpsqrt/fsqrt.py +++ b/src/ieee754/fpsqrt/fsqrt.py @@ -86,6 +86,18 @@ def normalise(s, m, e, lowbits): m += 1 if get_mantissa(m) == ((1<<24)-1): e += 1 + #if the num is NaN, than adjust + if (e == 128 & m !=0): + z[31] = 1 + z[30:23] = 255 + z[22] = 1 + z[21:0] = 0 + #if the num is Inf, then adjust + if (e == 128): + z[31] = s + z[30:23] = 255 + z[22:0] = 0 + return s, m, e