Skip to content

Commit

Permalink
Exp rules
Browse files Browse the repository at this point in the history
  • Loading branch information
varun10p committed Aug 28, 2024
1 parent f5f47d0 commit 3b7f1ad
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/core/rules.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,6 @@
[rem-exp-log (exp (log x)) x]
[rem-log-exp (log (exp x)) x])

(define-ruleset* exp-constants
(exponents simplify fp-safe sound)
[exp-0 (exp 0) 1]
[exp-1-e (exp 1) (E)]
[1-exp 1 (exp 0)]
[e-exp-1 (E) (exp 1)])

(define-ruleset* exp-distribute
(exponents simplify sound)
#:type ([a real] [b real])
Expand Down
7 changes: 7 additions & 0 deletions src/platforms/binary32.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@
[fabs-div (fabs.f32 (/ a b)) (/ (fabs.f32 a) (fabs.f32 b))]
[neg-fabs (fabs.f32 x) (fabs.f32 (neg x))]))

(define-libm-impl/binary32 exp
(binary64)
binary64
#:identities ([exp-0 (exp.f32 0) 1] [exp-1-e (exp.f32 1) (E)]
[1-exp 1 (exp.f32 0)]
[e-exp-1 (E) (exp.f32 1)]))

(define-libm-impl/binary32 pow
(binary64 binary64)
binary64
Expand Down
7 changes: 7 additions & 0 deletions src/platforms/binary64.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@
[fabs-div (fabs.f64 (/ a b)) (/ (fabs.f64 a) (fabs.f64 b))]
[neg-fabs (fabs.f64 x) (fabs.f64 (neg x))]))

(define-libm-impl/binary64 exp
(binary64)
binary64
#:identities ([exp-0 (exp.f64 0) 1] [exp-1-e (exp.f64 1) (E)]
[1-exp 1 (exp.f64 0)]
[e-exp-1 (E) (exp.f64 1)]))

(define-libm-impl/binary64 pow
(binary64 binary64)
binary64
Expand Down

0 comments on commit 3b7f1ad

Please sign in to comment.