Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple problems in Erf and InvErf methods #57

Merged
merged 1 commit into from Jun 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/instances.h
Expand Up @@ -97,9 +97,9 @@ instance BODY1(RealFrac a) => RealFrac (HEAD) where
instance BODY1(Erf a) => Erf (HEAD) where
erf = lift1 erf $ \x -> (2 / sqrt pi) * exp (negate x * x)
erfc = lift1 erfc $ \x -> ((-2) / sqrt pi) * exp (negate x * x)
normcdf = lift1 normcdf $ \x -> ((-1) / sqrt pi) * exp (x * x * fromRational (- recip 2) / sqrt (2))
normcdf = lift1 normcdf $ \x -> (recip $ sqrt (2 * pi)) * exp (- x * x / 2)

instance BODY1(InvErf a) => InvErf (HEAD) where
inverf = lift1 inverfc $ \x -> recip $ (2 / sqrt pi) * exp (negate x * x)
inverfc = lift1 inverfc $ \x -> recip $ negate (2 / sqrt pi) * exp (negate x * x)
invnormcdf = lift1 invnormcdf $ \x -> recip $ ((-1) / sqrt pi) * exp (x * x * fromRational (- recip 2) / sqrt 2)
inverf = lift1_ inverf $ \x _ -> sqrt pi / 2 * exp (x * x)
inverfc = lift1_ inverfc $ \x _ -> negate (sqrt pi / 2) * exp (x * x)
invnormcdf = lift1_ invnormcdf $ \x _ -> sqrt (2 * pi) * exp (x * x / 2)