-- Run a test against a table generated by a C program with about -- 6 digits accuracy. import Erf -- can divide by 0 relError :: Double -> Double -> Double relError x y = abs ((x-y) / (x+y)) main :: IO () main = do let tbad = [(x, relError (erf x) y) | (x, y) <- table, relError (erf x) y > 4e-6] if null tbad then putStrLn "Test OK" else do putStrLn "Failed tests:" print tbad table :: [(Double, Double)] table = [ #include "table" (0, 0) ]