Skip to content

Commit

Permalink
add instance definitions for log1p, expm1, log1pexp, and log1mexp
Browse files Browse the repository at this point in the history
  • Loading branch information
julmb committed Mar 11, 2024
1 parent 06d70bd commit d226855
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/instances.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ instance BODY1(Floating a) Floating HEAD where
acosh = lift1 acosh $ \x -> recip (sqrt (join (*) x - 1))
atanh = lift1 atanh $ \x -> recip (1 - join (*) x)

log1p = lift1 log1p $ recip . (+) 1
expm1 = lift1 expm1 exp
log1pexp = lift1 log1pexp $ recip . (+) 1 . exp . negate
log1mexp = lift1 log1mexp $ recip . negate . expm1 . negate

instance BODY2(Num a, Enum a) Enum HEAD where
succ = lift1 succ (const 1)
pred = lift1 pred (const 1)
Expand Down

0 comments on commit d226855

Please sign in to comment.