specializations on float
Hal Daume III
hdaume@ISI.EDU
Thu, 8 Aug 2002 10:57:24 -0700 (PDT)
the ghc docs suggest using Doubles instead of Floats because GHC
specializes Double but not float...I want to use floats to save memory and
to test this claim, i grepped through the libraries for the SPECIALIZE
keyword and find that with the exception of a few complex routines (which
I don't care about), floats are just as specialized as doubles...is this
the case, or am I missing something?
the results of grepping are:
moussor:libraries/ grep "SPECIALI[SZ]E" `find . | grep 'hs$'` | cut -d':'
-f2- | grep Float
{-# SPECIALISE instance Num (Complex Float) #-}
{-# SPECIALISE instance Fractional (Complex Float) #-}
{-# SPECIALISE instance Floating (Complex Float) #-}
{-# SPECIALISE instance Floating (Complex Double) #-}
{-# SPECIALIZE properFraction :: Float -> (Int, Float) #-}
{-# SPECIALIZE round :: Float -> Int #-}
{-# SPECIALIZE ceiling :: Float -> Int #-}
{-# SPECIALIZE floor :: Float -> Int #-}
{-# SPECIALIZE properFraction :: Float -> (Integer, Float) #-}
{-# SPECIALIZE truncate :: Float -> Integer #-}
{-# SPECIALIZE round :: Float -> Integer #-}
{-# SPECIALIZE ceiling :: Float -> Integer #-}
{-# SPECIALIZE floor :: Float -> Integer #-}
{-# SPECIALIZE showEFloat ::
{-# SPECIALIZE showFFloat ::
{-# SPECIALIZE showGFloat ::
moussor:libraries/ grep "SPECIALI[SZ]E" `find . | grep 'hs$'` |
cut -d':' -f2- | grep Double
{-# SPECIALISE conjugate :: Complex Double -> Complex Double #-}
{-# SPECIALISE mkPolar :: Double -> Double -> Complex Double #-}
{-# SPECIALISE cis :: Double -> Complex Double #-}
{-# SPECIALISE polar :: Complex Double -> (Double,Double) #-}
{-# SPECIALISE magnitude :: Complex Double -> Double #-}
{-# SPECIALISE phase :: Complex Double -> Double #-}
{-# SPECIALISE instance Num (Complex Double) #-}
{-# SPECIALISE instance Fractional (Complex Double) #-}
{-# SPECIALISE instance Floating (Complex Double) #-}
{-# SPECIALIZE properFraction :: Double -> (Int, Double) #-}
{-# SPECIALIZE round :: Double -> Int #-}
{-# SPECIALIZE ceiling :: Double -> Int #-}
{-# SPECIALIZE floor :: Double -> Int #-}
{-# SPECIALIZE properFraction :: Double -> (Integer, Double) #-}
{-# SPECIALIZE truncate :: Double -> Integer #-}
{-# SPECIALIZE round :: Double -> Integer #-}
{-# SPECIALIZE ceiling :: Double -> Integer #-}
{-# SPECIALIZE floor :: Double -> Integer #-}
{-# SPECIALISE fromRat :: Rational -> Double,
--
Hal Daume III
"Computer science is no more about computers | hdaume@isi.edu
than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume