fix mis-computed exponent in bfp_CONVERT_FROM_BFP64
authorJacob Lifshay <programmerjake@gmail.com>
Tue, 16 May 2023 06:48:28 +0000 (23:48 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Tue, 16 May 2023 06:48:28 +0000 (23:48 -0700)
openpower/isafunctions/bfp.mdwn

index 7ab2ab2b0da03674a789749b2a50c6c745f6235b..08409e8f0016f2be3ede7a7e3f09ca8a0f9973d6 100644 (file)
@@ -57,7 +57,7 @@ section 7.6.2.2
             # x is a Denormal
             result.class.Denormal <- 1
             result.sign <- x[0]
-            result.exp <- -1022
+            result.exponent <- -1022
             result.significand[0] <- 0
             result.significand[1:52] <- fraction
             do while result.significand[0] != 1
@@ -66,7 +66,10 @@ section 7.6.2.2
         else
             result.class.Normal <- 1
             result.sign <- x[0]
-            result.exponent <- exponent - 1023
+            result.exponent <- exponent
+            # have to do the subtraction separately since SelectableInt won't
+            # give negative results
+            result.exponent <- result.exponent - 1023
             result.significand[0] <- 1
             result.significand[1:52] <- fraction
         return result