Commits

dafis  committed 85d547c

Fix possible overflow for short representations

  • Participants
  • Parent commits 122f686

Comments (0)

Files changed (1)

File Text/FShow/RealFloat/Internals.hs

     !binshift = e# +# d#
     !decMant
         | d# <# 0# =
-            shiftLInteger mant binshift `quot` expt5 (I# (negateInt# d#))
+            (if binshift <# 0#
+                then shiftRInteger mant (negateInt# binshift)
+                else shiftLInteger mant binshift) `quot` expt5 (I# (negateInt# d#))
         | binshift <# 0# =
             shiftRInteger (mant * expt5 decshift) (negateInt# binshift)
         | otherwise = shiftLInteger (mant * expt5 decshift) binshift