[project @ 1998-04-14 09:29:26 by simonm]
[ghc-hetmet.git] / ghc / tests / codeGen / should_run / cg035.hs
1 {-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
2
3 -- The above option is required because 'erf' isn't a POSIX function, and we
4 -- need a prototype for it in order to compile the following code correctly.
5 -- Defining NON_POSIX_SOURCE tells the RTS not to define _POSIX_SOURCE.
6
7 module Main (main) where
8
9 import IOExts ( unsafePerformIO )
10
11 po :: Double -> Double
12 po rd = 0.5 + 0.5 * erf ((rd / 1.04) / sqrt 2)
13   where
14     erf :: Double -> Double
15     erf x = unsafePerformIO (_ccall_ erf x)
16
17 main = putStr (shows (po 2.0) "\n")