summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/Float
diff options
context:
space:
mode:
authorJan Stolarek <jan.stolarek@p.lodz.pl>2013-09-16 15:16:31 +0100
committerJan Stolarek <jan.stolarek@p.lodz.pl>2013-09-18 14:19:49 +0100
commitad89699497ee475c22a72d46d9569cd7769c57f6 (patch)
tree89bb9ce327990fa9377830c39f9884c72ab2b0dc /libraries/base/GHC/Float
parentacb313ad780f547f55a8f549a368c445559932d2 (diff)
downloadhaskell-ad89699497ee475c22a72d46d9569cd7769c57f6.tar.gz
Follow changes in comparison primops (see #6135)
Diffstat (limited to 'libraries/base/GHC/Float')
-rw-r--r--libraries/base/GHC/Float/ConversionUtils.hs18
-rw-r--r--libraries/base/GHC/Float/RealFracMethods.hs50
2 files changed, 35 insertions, 33 deletions
diff --git a/libraries/base/GHC/Float/ConversionUtils.hs b/libraries/base/GHC/Float/ConversionUtils.hs
index ec2233c741..c7fcf8dcb4 100644
--- a/libraries/base/GHC/Float/ConversionUtils.hs
+++ b/libraries/base/GHC/Float/ConversionUtils.hs
@@ -41,9 +41,9 @@ toByte64# i = word2Int# (and# 255## (int2Word# (int64ToInt# i)))
elim64# :: Int64# -> Int# -> (# Integer, Int# #)
elim64# n e =
case zeroCount (toByte64# n) of
- t | e <=# t -> (# int64ToInteger (uncheckedIShiftRA64# n e), 0# #)
- | t <# 8# -> (# int64ToInteger (uncheckedIShiftRA64# n t), e -# t #)
- | otherwise -> elim64# (uncheckedIShiftRA64# n 8#) (e -# 8#)
+ t | isTrue# (e <=# t) -> (# int64ToInteger (uncheckedIShiftRA64# n e), 0# #)
+ | isTrue# (t <# 8#) -> (# int64ToInteger (uncheckedIShiftRA64# n t), e -# t #)
+ | otherwise -> elim64# (uncheckedIShiftRA64# n 8#) (e -# 8#)
#else
@@ -62,9 +62,9 @@ elimZerosInteger m e = elim64# (TO64 m) e
elimZerosInt# :: Int# -> Int# -> (# Integer, Int# #)
elimZerosInt# n e =
case zeroCount (toByte# n) of
- t | e <=# t -> (# smallInteger (uncheckedIShiftRA# n e), 0# #)
- | t <# 8# -> (# smallInteger (uncheckedIShiftRA# n t), e -# t #)
- | otherwise -> elimZerosInt# (uncheckedIShiftRA# n 8#) (e -# 8#)
+ t | isTrue# (e <=# t) -> (# smallInteger (uncheckedIShiftRA# n e), 0# #)
+ | isTrue# (t <# 8#) -> (# smallInteger (uncheckedIShiftRA# n t), e -# t #)
+ | otherwise -> elimZerosInt# (uncheckedIShiftRA# n 8#) (e -# 8#)
{-# INLINE zeroCount #-}
zeroCount :: Int# -> Int#
@@ -87,9 +87,11 @@ zeroCountArr =
case writeInt8Array# mba 0# 8# s1 of
s2 ->
let fillA step val idx st
- | idx <# 256# = case writeInt8Array# mba idx val st of
+ | isTrue# (idx <# 256#) =
+ case writeInt8Array# mba idx val st of
nx -> fillA step val (idx +# step) nx
- | step <# 256# = fillA (2# *# step) (val +# 1#) step st
+ | isTrue# (step <# 256#) =
+ fillA (2# *# step) (val +# 1#) step st
| otherwise = st
in case fillA 2# 0# 1# s2 of
s3 -> case unsafeFreezeByteArray# mba s3 of
diff --git a/libraries/base/GHC/Float/RealFracMethods.hs b/libraries/base/GHC/Float/RealFracMethods.hs
index 57ec1e820e..c072208fca 100644
--- a/libraries/base/GHC/Float/RealFracMethods.hs
+++ b/libraries/base/GHC/Float/RealFracMethods.hs
@@ -99,7 +99,7 @@ default ()
-- of performance.
properFractionFloatInt :: Float -> (Int, Float)
properFractionFloatInt (F# x) =
- if x `eqFloat#` 0.0#
+ if isTrue# (x `eqFloat#` 0.0#)
then (I# 0#, F# 0.0#)
else case float2Int# x of
n -> (I# n, F# (x `minusFloat#` int2Float# n))
@@ -109,14 +109,14 @@ properFractionFloatInt (F# x) =
floorFloatInt :: Float -> Int
floorFloatInt (F# x) =
case float2Int# x of
- n | x `ltFloat#` int2Float# n -> I# (n -# 1#)
- | otherwise -> I# n
+ n | isTrue# (x `ltFloat#` int2Float# n) -> I# (n -# 1#)
+ | otherwise -> I# n
ceilingFloatInt :: Float -> Int
ceilingFloatInt (F# x) =
case float2Int# x of
- n | int2Float# n `ltFloat#` x -> I# (n +# 1#)
- | otherwise -> I# n
+ n | isTrue# (int2Float# n `ltFloat#` x) -> I# (n +# 1#)
+ | otherwise -> I# n
roundFloatInt :: Float -> Int
roundFloatInt x = float2Int (c_rintFloat x)
@@ -137,10 +137,10 @@ properFractionFloatInteger :: Float -> (Integer, Float)
properFractionFloatInteger v@(F# x) =
case decodeFloat_Int# x of
(# m, e #)
- | e <# 0# ->
+ | isTrue# (e <# 0#) ->
case negateInt# e of
- s | s ># 23# -> (0, v)
- | m <# 0# ->
+ s | isTrue# (s ># 23#) -> (0, v)
+ | isTrue# (m <# 0#) ->
case negateInt# (negateInt# m `uncheckedIShiftRA#` s) of
k -> (smallInteger k,
case m -# (k `uncheckedIShiftL#` s) of
@@ -165,10 +165,10 @@ floorFloatInteger :: Float -> Integer
floorFloatInteger (F# x) =
case decodeFloat_Int# x of
(# m, e #)
- | e <# 0# ->
+ | isTrue# (e <# 0#) ->
case negateInt# e of
- s | s ># 23# -> if m <# 0# then (-1) else 0
- | otherwise -> smallInteger (m `uncheckedIShiftRA#` s)
+ s | isTrue# (s ># 23#) -> if isTrue# (m <# 0#) then (-1) else 0
+ | otherwise -> smallInteger (m `uncheckedIShiftRA#` s)
| otherwise -> shiftLInteger (smallInteger m) e
-- ceiling x = -floor (-x)
@@ -195,7 +195,7 @@ roundFloatInteger x = float2Integer (c_rintFloat x)
-- of performance.
properFractionDoubleInt :: Double -> (Int, Double)
properFractionDoubleInt (D# x) =
- if x ==## 0.0##
+ if isTrue# (x ==## 0.0##)
then (I# 0#, D# 0.0##)
else case double2Int# x of
n -> (I# n, D# (x -## int2Double# n))
@@ -205,14 +205,14 @@ properFractionDoubleInt (D# x) =
floorDoubleInt :: Double -> Int
floorDoubleInt (D# x) =
case double2Int# x of
- n | x <## int2Double# n -> I# (n -# 1#)
- | otherwise -> I# n
+ n | isTrue# (x <## int2Double# n) -> I# (n -# 1#)
+ | otherwise -> I# n
ceilingDoubleInt :: Double -> Int
ceilingDoubleInt (D# x) =
case double2Int# x of
- n | int2Double# n <## x -> I# (n +# 1#)
- | otherwise -> I# n
+ n | isTrue# (int2Double# n <## x) -> I# (n +# 1#)
+ | otherwise -> I# n
roundDoubleInt :: Double -> Int
roundDoubleInt x = double2Int (c_rintDouble x)
@@ -235,10 +235,10 @@ properFractionDoubleInteger :: Double -> (Integer, Double)
properFractionDoubleInteger v@(D# x) =
case decodeDoubleInteger x of
(# m, e #)
- | e <# 0# ->
+ | isTrue# (e <# 0#) ->
case negateInt# e of
- s | s ># 52# -> (0, v)
- | m < 0 ->
+ s | isTrue# (s ># 52#) -> (0, v)
+ | m < 0 ->
case TO64 (negateInteger m) of
n ->
case n `uncheckedIShiftRA64#` s of
@@ -269,10 +269,10 @@ floorDoubleInteger :: Double -> Integer
floorDoubleInteger (D# x) =
case decodeDoubleInteger x of
(# m, e #)
- | e <# 0# ->
+ | isTrue# (e <# 0#) ->
case negateInt# e of
- s | s ># 52# -> if m < 0 then (-1) else 0
- | otherwise ->
+ s | isTrue# (s ># 52#) -> if m < 0 then (-1) else 0
+ | otherwise ->
case TO64 m of
n -> FROM64 (n `uncheckedIShiftRA64#` s)
| otherwise -> shiftLInteger m e
@@ -314,7 +314,7 @@ double2Integer :: Double -> Integer
double2Integer (D# x) =
case decodeDoubleInteger x of
(# m, e #)
- | e <# 0# ->
+ | isTrue# (e <# 0#) ->
case TO64 m of
n -> FROM64 (n `uncheckedIShiftRA64#` negateInt# e)
| otherwise -> shiftLInteger m e
@@ -324,8 +324,8 @@ float2Integer :: Float -> Integer
float2Integer (F# x) =
case decodeFloat_Int# x of
(# m, e #)
- | e <# 0# -> smallInteger (m `uncheckedIShiftRA#` negateInt# e)
- | otherwise -> shiftLInteger (smallInteger m) e
+ | isTrue# (e <# 0#) -> smallInteger (m `uncheckedIShiftRA#` negateInt# e)
+ | otherwise -> shiftLInteger (smallInteger m) e
-- Foreign imports, the rounding is done faster in C when the value
-- isn't integral, so we call out for rounding. For values of large