summaryrefslogtreecommitdiff
path: root/lib/Numeric/GSL/Special/Internal.hsc
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2008-01-21 21:40:07 +0000
committerAlberto Ruiz <aruiz@um.es>2008-01-21 21:40:07 +0000
commit17749900a9146ddf6cd8ebf59dc35e56d6bff413 (patch)
treed352b7b155ebf650cd41a134aeb39450e54163b2 /lib/Numeric/GSL/Special/Internal.hsc
parent4fb0006a2227d3d5293a53b88ef67ce6ebd73440 (diff)
IO CInt results
Diffstat (limited to 'lib/Numeric/GSL/Special/Internal.hsc')
-rw-r--r--lib/Numeric/GSL/Special/Internal.hsc10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Numeric/GSL/Special/Internal.hsc b/lib/Numeric/GSL/Special/Internal.hsc
index 03a431c..e0744d7 100644
--- a/lib/Numeric/GSL/Special/Internal.hsc
+++ b/lib/Numeric/GSL/Special/Internal.hsc
@@ -30,7 +30,7 @@ where
30 30
31import Foreign 31import Foreign
32import Data.Packed.Internal(check,(//)) 32import Data.Packed.Internal(check,(//))
33import Foreign.C.Types(CSize) 33import Foreign.C.Types(CSize,CInt)
34 34
35 35
36data Precision = PrecDouble | PrecSingle | PrecApprox 36data Precision = PrecDouble | PrecSingle | PrecApprox
@@ -61,7 +61,7 @@ instance Storable Gsl_sf_result where
61 (#poke gsl_sf_result, err) ptr err 61 (#poke gsl_sf_result, err) ptr err
62 62
63 63
64data Gsl_sf_result_e10 = SFE Double Double Int 64data Gsl_sf_result_e10 = SFE Double Double CInt
65 deriving (Show) 65 deriving (Show)
66 66
67instance Storable Gsl_sf_result_e10 where 67instance Storable Gsl_sf_result_e10 where
@@ -80,7 +80,7 @@ instance Storable Gsl_sf_result_e10 where
80 80
81---------------------------------------------------------------- 81----------------------------------------------------------------
82-- | access to a sf_result 82-- | access to a sf_result
83createSFR :: String -> (Ptr a -> IO Int) -> (Double, Double) 83createSFR :: String -> (Ptr a -> IO CInt) -> (Double, Double)
84createSFR s f = unsafePerformIO $ do 84createSFR s f = unsafePerformIO $ do
85 p <- malloc :: IO (Ptr Gsl_sf_result) 85 p <- malloc :: IO (Ptr Gsl_sf_result)
86 f (castPtr p) // check s 86 f (castPtr p) // check s
@@ -93,10 +93,10 @@ createSFR s f = unsafePerformIO $ do
93-- the sf_result_e10 contains two doubles and the exponent 93-- the sf_result_e10 contains two doubles and the exponent
94 94
95-- | access to sf_result_e10 95-- | access to sf_result_e10
96createSFR_E10 :: String -> (Ptr a -> IO Int) -> (Double, Int, Double) 96createSFR_E10 :: String -> (Ptr a -> IO CInt) -> (Double, Int, Double)
97createSFR_E10 s f = unsafePerformIO $ do 97createSFR_E10 s f = unsafePerformIO $ do
98 p <- malloc :: IO (Ptr Gsl_sf_result_e10) 98 p <- malloc :: IO (Ptr Gsl_sf_result_e10)
99 f (castPtr p) // check s 99 f (castPtr p) // check s
100 SFE val err expo <- peek p 100 SFE val err expo <- peek p
101 free p 101 free p
102 return (val,expo,err) 102 return (val, fromIntegral expo,err)