operFractionDoubleInteger :: Double -> (Integer, Double)
properFractionDoubleInteger v@(D# x) =
    case decodeDoubleInteger x of
      (# m, e #)
        | isTrue# (e <# 0#) ->
          case negateInt# e of
            s | isTrue# (s ># 52#) -> (0, v)
              | m < 0                 ->
                case integerToInt (negateInteger m) of
                  n ->
                    case n `uncheckedIShiftRA64#` s of
                      k ->
                        (smallInteger (negateInt# k),
                          case ( -# ) n (k `uncheckedIShiftL64#` s) of
                            r ->
                              D# (encodeDoubleInteger (smallInteger (negateInt# r)) e))
              | otherwise           ->
                case integerToInt m of
                  n ->
                    case n `uncheckedIShiftRA64#` s of
                      k -> (smallInteger k,
                            case ( -# ) n (k `uncheckedIShiftL64#` s) of
                              r -> D# (encodeDoubleInteger (smallInteger r) e))
        | otherwise -> (shiftLInteger m e, D# 0.0##)

{-
properFractionDoubleInteger :: Double -> (Integer, Double)
properFractionDoubleInteger v@(D# x) =
    case decodeDoubleInteger x of
      (# m, e #)
        | isTrue# (e <# 0#) ->
          case negateInt# e of
            s | isTrue# (s ># 52#) -> (0, v)
              | m < 0                 ->
                case integerToInt (negateInteger m) of
                  n ->
                    case n `uncheckedIShiftRA64#` s of
                      k ->
                        (smallInteger (negateInt# k),
                          case ( -# ) n (k `uncheckedIShiftL64#` s) of
                            r ->
                              D# (encodeDoubleInteger (smallInteger (negateInt# r)) e))
              | otherwise           ->
                case integerToInt m of
                  n ->
                    case n `uncheckedIShiftRA64#` s of
                      k -> (smallInteger k,
                            case ( -# ) n (k `uncheckedIShiftL64#` s) of
                              r -> D# (encodeDoubleInteger (smallInteger r) e))
        | otherwise -> (shiftLInteger m e, D# 0.0##)


properFractionDoubleInteger v@(D# x) =
    case decodeDoubleInteger x of
      (# m, e #)
        | isTrue# (e <# 0#) ->
          case negateInt# e of
            s | isTrue# (s ># 52#) -> (0, v)
              | m < 0                 ->
                case integerToInt (negateInteger m) of
                  n ->
                    case n `uncheckedIShiftRA64#` s of
                      k ->
                        (smallInteger (negateInt# k),
                          case ( -# ) n (k `uncheckedIShiftL64#` s) of
                            r ->
                              D# (encodeDoubleInteger (smallInteger (negateInt# r)) e))
              | otherwise           ->
                case integerToInt m of
                  n ->
                    case n `uncheckedIShiftRA64#` s of
                      k -> (smallInteger k,
                            case ( -# ) n (k `uncheckedIShiftL64#` s) of
                              r -> D# (encodeDoubleInteger (smallInteger r) e))
        | otherwise -> (shiftLInteger m e, D# 0.0##)

