Repository : ssh://darcs.haskell.org//srv/darcs/packages/base

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/7ed045164892688bc9823c709787307f2fff312c

>---------------------------------------------------------------

commit 7ed045164892688bc9823c709787307f2fff312c
Author: Johan Tibell <[email protected]>
Date:   Thu Dec 13 14:49:58 2012 -0800

    Add fromIntegral/Word->Double and fromIntegral/Word-Float rules

>---------------------------------------------------------------

 GHC/Float.lhs |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/GHC/Float.lhs b/GHC/Float.lhs
index 66318d4..59b7542 100644
--- a/GHC/Float.lhs
+++ b/GHC/Float.lhs
@@ -1110,9 +1110,18 @@ foreign import ccall unsafe "isDoubleFinite" 
isDoubleFinite :: Double -> Int
 %*********************************************************
 
 \begin{code}
+
+word2Double :: Word -> Double
+word2Double (W# w) = D# (word2Double# w)
+
+word2Float :: Word -> Float
+word2Float (W# w) = F# (word2Float# w)
+
 {-# RULES
 "fromIntegral/Int->Float"   fromIntegral = int2Float
 "fromIntegral/Int->Double"  fromIntegral = int2Double
+"fromIntegral/Word->Float"  fromIntegral = word2Float
+"fromIntegral/Word->Double" fromIntegral = word2Double
 "realToFrac/Float->Float"   realToFrac   = id :: Float -> Float
 "realToFrac/Float->Double"  realToFrac   = float2Double
 "realToFrac/Double->Float"  realToFrac   = double2Float



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to