
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (fabs x)))
(t_1 (* (* t_0 t_0) t_0))
(t_2 (* (* t_1 t_0) t_0)))
(*
(* (/ 1.0 (sqrt (PI))) (exp (* (fabs x) (fabs x))))
(+
(+ (+ t_0 (* (/ 1.0 2.0) t_1)) (* (/ 3.0 4.0) t_2))
(* (/ 15.0 8.0) (* (* t_2 t_0) t_0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\left|x\right|}\\
t_1 := \left(t\_0 \cdot t\_0\right) \cdot t\_0\\
t_2 := \left(t\_1 \cdot t\_0\right) \cdot t\_0\\
\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot e^{\left|x\right| \cdot \left|x\right|}\right) \cdot \left(\left(\left(t\_0 + \frac{1}{2} \cdot t\_1\right) + \frac{3}{4} \cdot t\_2\right) + \frac{15}{8} \cdot \left(\left(t\_2 \cdot t\_0\right) \cdot t\_0\right)\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (fabs x)))
(t_1 (* (* t_0 t_0) t_0))
(t_2 (* (* t_1 t_0) t_0)))
(*
(* (/ 1.0 (sqrt (PI))) (exp (* (fabs x) (fabs x))))
(+
(+ (+ t_0 (* (/ 1.0 2.0) t_1)) (* (/ 3.0 4.0) t_2))
(* (/ 15.0 8.0) (* (* t_2 t_0) t_0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\left|x\right|}\\
t_1 := \left(t\_0 \cdot t\_0\right) \cdot t\_0\\
t_2 := \left(t\_1 \cdot t\_0\right) \cdot t\_0\\
\left(\frac{1}{\sqrt{\mathsf{PI}\left(\right)}} \cdot e^{\left|x\right| \cdot \left|x\right|}\right) \cdot \left(\left(\left(t\_0 + \frac{1}{2} \cdot t\_1\right) + \frac{3}{4} \cdot t\_2\right) + \frac{15}{8} \cdot \left(\left(t\_2 \cdot t\_0\right) \cdot t\_0\right)\right)
\end{array}
\end{array}
(FPCore (x) :precision binary64 (* (* (pow (sqrt (PI)) -1.0) (pow (exp (- x)) (- x))) (- (/ (+ (+ (/ 0.75 (pow x 4.0)) (/ 0.5 (* x x))) 1.0) (fabs x)) (/ -1.875 (pow x 7.0)))))
\begin{array}{l}
\\
\left({\left(\sqrt{\mathsf{PI}\left(\right)}\right)}^{-1} \cdot {\left(e^{-x}\right)}^{\left(-x\right)}\right) \cdot \left(\frac{\left(\frac{0.75}{{x}^{4}} + \frac{0.5}{x \cdot x}\right) + 1}{\left|x\right|} - \frac{-1.875}{{x}^{7}}\right)
\end{array}
Initial program 99.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-timesN/A
*-rgt-identityN/A
*-lft-identityN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
lift-/.f64N/A
frac-timesN/A
metadata-evalN/A
Applied rewrites99.9%
Taylor expanded in x around inf
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites99.9%
lift-exp.f64N/A
lift-*.f64N/A
lift-fabs.f64N/A
lift-fabs.f64N/A
sqr-abs-revN/A
sqr-neg-revN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
Final simplification100.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (pow (fabs x) -1.0)) (t_1 (* (* t_0 t_0) t_0)))
(*
(* (pow (sqrt (PI)) -1.0) (exp (* x x)))
(+
(+ (+ t_0 (* (pow 2.0 -1.0) t_1)) (* (/ 3.0 4.0) (* (* t_1 t_0) t_0)))
(* (/ 15.0 8.0) (pow x -7.0))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\left|x\right|\right)}^{-1}\\
t_1 := \left(t\_0 \cdot t\_0\right) \cdot t\_0\\
\left({\left(\sqrt{\mathsf{PI}\left(\right)}\right)}^{-1} \cdot e^{x \cdot x}\right) \cdot \left(\left(\left(t\_0 + {2}^{-1} \cdot t\_1\right) + \frac{3}{4} \cdot \left(\left(t\_1 \cdot t\_0\right) \cdot t\_0\right)\right) + \frac{15}{8} \cdot {x}^{-7}\right)
\end{array}
\end{array}
Initial program 99.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x) :precision binary64 (* (/ (pow (exp x) x) (sqrt (PI))) (+ (- (/ (+ (/ 0.5 (* x x)) 1.0) (fabs x)) (/ -0.75 (pow (fabs x) 5.0))) (* (/ 15.0 8.0) (pow x -7.0)))))
\begin{array}{l}
\\
\frac{{\left(e^{x}\right)}^{x}}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left(\left(\frac{\frac{0.5}{x \cdot x} + 1}{\left|x\right|} - \frac{-0.75}{{\left(\left|x\right|\right)}^{5}}\right) + \frac{15}{8} \cdot {x}^{-7}\right)
\end{array}
Initial program 99.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
Applied rewrites99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites99.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f6499.9
lift-exp.f64N/A
lift-*.f64N/A
lift-fabs.f64N/A
lift-fabs.f64N/A
sqr-abs-revN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64100.0
Applied rewrites100.0%
(FPCore (x) :precision binary64 (* (/ (pow (exp x) x) (sqrt (PI))) (- (/ (+ (+ (/ 0.75 (pow x 4.0)) (/ 0.5 (* x x))) 1.0) (fabs x)) (/ -1.875 (pow x 7.0)))))
\begin{array}{l}
\\
\frac{{\left(e^{x}\right)}^{x}}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left(\frac{\left(\frac{0.75}{{x}^{4}} + \frac{0.5}{x \cdot x}\right) + 1}{\left|x\right|} - \frac{-1.875}{{x}^{7}}\right)
\end{array}
Initial program 99.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-timesN/A
*-rgt-identityN/A
*-lft-identityN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
lift-/.f64N/A
frac-timesN/A
metadata-evalN/A
Applied rewrites99.9%
Taylor expanded in x around inf
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites99.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f6499.9
lift-exp.f64N/A
lift-*.f64N/A
lift-fabs.f64N/A
lift-fabs.f64N/A
sqr-abs-revN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
(FPCore (x) :precision binary64 (* (exp (- (* x x) (log (sqrt (PI))))) (- (/ (+ (+ (/ 0.75 (pow x 4.0)) (/ 0.5 (* x x))) 1.0) (fabs x)) (/ -1.875 (pow (fabs x) 7.0)))))
\begin{array}{l}
\\
e^{x \cdot x - \log \left(\sqrt{\mathsf{PI}\left(\right)}\right)} \cdot \left(\frac{\left(\frac{0.75}{{x}^{4}} + \frac{0.5}{x \cdot x}\right) + 1}{\left|x\right|} - \frac{-1.875}{{\left(\left|x\right|\right)}^{7}}\right)
\end{array}
Initial program 99.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-timesN/A
*-rgt-identityN/A
*-lft-identityN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
lift-/.f64N/A
frac-timesN/A
metadata-evalN/A
Applied rewrites99.9%
Taylor expanded in x around inf
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites99.9%
lift-exp.f64N/A
lift-*.f64N/A
lift-fabs.f64N/A
lift-fabs.f64N/A
sqr-abs-revN/A
sqr-neg-revN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift-pow.f64N/A
lift-exp.f64N/A
pow-expN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqr-neg-revN/A
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
rem-log-expN/A
pow-to-expN/A
metadata-evalN/A
Applied rewrites99.9%
(FPCore (x) :precision binary64 (* (* (pow (sqrt (PI)) -1.0) (exp (* x x))) (+ (- (/ (+ (/ 0.5 (* x x)) 1.0) (fabs x)) (/ -0.75 (pow (fabs x) 5.0))) (* 1.875 (pow x -7.0)))))
\begin{array}{l}
\\
\left({\left(\sqrt{\mathsf{PI}\left(\right)}\right)}^{-1} \cdot e^{x \cdot x}\right) \cdot \left(\left(\frac{\frac{0.5}{x \cdot x} + 1}{\left|x\right|} - \frac{-0.75}{{\left(\left|x\right|\right)}^{5}}\right) + 1.875 \cdot {x}^{-7}\right)
\end{array}
Initial program 99.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
Applied rewrites99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites99.9%
lift-/.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x) :precision binary64 (* (* (pow (sqrt (PI)) -1.0) (exp (* x x))) (- (/ (+ (+ (/ (/ 0.75 (* x x)) (* x x)) (/ 0.5 (* x x))) 1.0) (fabs x)) (/ -1.875 (pow (fabs x) 7.0)))))
\begin{array}{l}
\\
\left({\left(\sqrt{\mathsf{PI}\left(\right)}\right)}^{-1} \cdot e^{x \cdot x}\right) \cdot \left(\frac{\left(\frac{\frac{0.75}{x \cdot x}}{x \cdot x} + \frac{0.5}{x \cdot x}\right) + 1}{\left|x\right|} - \frac{-1.875}{{\left(\left|x\right|\right)}^{7}}\right)
\end{array}
Initial program 99.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-timesN/A
*-rgt-identityN/A
*-lft-identityN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
lift-/.f64N/A
frac-timesN/A
metadata-evalN/A
Applied rewrites99.9%
Taylor expanded in x around inf
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites99.9%
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x) :precision binary64 (* (* (pow (sqrt (PI)) -1.0) (exp (* x x))) (- (/ (+ (/ 0.5 (* x x)) 1.0) (fabs x)) (/ -0.75 (pow (fabs x) 5.0)))))
\begin{array}{l}
\\
\left({\left(\sqrt{\mathsf{PI}\left(\right)}\right)}^{-1} \cdot e^{x \cdot x}\right) \cdot \left(\frac{\frac{0.5}{x \cdot x} + 1}{\left|x\right|} - \frac{-0.75}{{\left(\left|x\right|\right)}^{5}}\right)
\end{array}
Initial program 99.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
Applied rewrites99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites99.9%
Taylor expanded in x around inf
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites99.0%
Final simplification99.0%
(FPCore (x) :precision binary64 (* (* (pow (sqrt (PI)) -1.0) (exp (* x x))) (- (/ (+ (/ 0.5 (* x x)) 1.0) (fabs x)) (/ -1.875 (pow (fabs x) 7.0)))))
\begin{array}{l}
\\
\left({\left(\sqrt{\mathsf{PI}\left(\right)}\right)}^{-1} \cdot e^{x \cdot x}\right) \cdot \left(\frac{\frac{0.5}{x \cdot x} + 1}{\left|x\right|} - \frac{-1.875}{{\left(\left|x\right|\right)}^{7}}\right)
\end{array}
Initial program 99.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-timesN/A
*-rgt-identityN/A
*-lft-identityN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
lift-/.f64N/A
frac-timesN/A
metadata-evalN/A
Applied rewrites99.9%
Taylor expanded in x around inf
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites98.9%
lift-*.f64N/A
lift-fabs.f64N/A
lift-fabs.f64N/A
sqr-abs-revN/A
lift-*.f6498.9
Applied rewrites98.9%
Final simplification98.9%
(FPCore (x) :precision binary64 (* (* (pow (sqrt (PI)) -1.0) (exp (* x x))) (* (pow x -5.0) 0.75)))
\begin{array}{l}
\\
\left({\left(\sqrt{\mathsf{PI}\left(\right)}\right)}^{-1} \cdot e^{x \cdot x}\right) \cdot \left({x}^{-5} \cdot 0.75\right)
\end{array}
Initial program 99.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-timesN/A
*-rgt-identityN/A
*-lft-identityN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
lift-/.f64N/A
frac-timesN/A
metadata-evalN/A
Applied rewrites99.9%
Taylor expanded in x around 0
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fabs.f6417.4
Applied rewrites17.4%
Applied rewrites17.4%
Applied rewrites17.8%
Final simplification17.8%
(FPCore (x) :precision binary64 (* (* (pow (sqrt (PI)) -1.0) (exp (* x x))) (/ (/ (/ 0.75 (* x x)) (* x x)) (fabs x))))
\begin{array}{l}
\\
\left({\left(\sqrt{\mathsf{PI}\left(\right)}\right)}^{-1} \cdot e^{x \cdot x}\right) \cdot \frac{\frac{\frac{0.75}{x \cdot x}}{x \cdot x}}{\left|x\right|}
\end{array}
Initial program 99.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-timesN/A
*-rgt-identityN/A
*-lft-identityN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
lift-/.f64N/A
frac-timesN/A
metadata-evalN/A
Applied rewrites99.9%
Taylor expanded in x around 0
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-fabs.f6417.4
Applied rewrites17.4%
Applied rewrites17.4%
lift-*.f64N/A
lift-fabs.f64N/A
lift-fabs.f64N/A
sqr-abs-revN/A
lift-*.f6417.4
Applied rewrites17.4%
Final simplification17.4%
(FPCore (x) :precision binary64 (* (/ 0.75 (pow x 4.0)) (/ (sqrt (pow (PI) -1.0)) (fabs x))))
\begin{array}{l}
\\
\frac{0.75}{{x}^{4}} \cdot \frac{\sqrt{{\mathsf{PI}\left(\right)}^{-1}}}{\left|x\right|}
\end{array}
Initial program 99.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-timesN/A
*-rgt-identityN/A
*-lft-identityN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
lift-/.f64N/A
frac-timesN/A
metadata-evalN/A
Applied rewrites99.9%
Taylor expanded in x around inf
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites99.9%
lift-exp.f64N/A
lift-*.f64N/A
lift-fabs.f64N/A
lift-fabs.f64N/A
sqr-abs-revN/A
sqr-neg-revN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
associate-*r*N/A
associate-*r/N/A
metadata-evalN/A
associate-*l/N/A
times-fracN/A
*-rgt-identityN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
associate-*r/N/A
*-rgt-identityN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-PI.f64N/A
lower-fabs.f641.8
Applied rewrites1.8%
Final simplification1.8%
herbie shell --seed 2024350
(FPCore (x)
:name "Jmat.Real.erfi, branch x greater than or equal to 5"
:precision binary64
:pre (>= x 0.5)
(* (* (/ 1.0 (sqrt (PI))) (exp (* (fabs x) (fabs x)))) (+ (+ (+ (/ 1.0 (fabs x)) (* (/ 1.0 2.0) (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))))) (* (/ 3.0 4.0) (* (* (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))))) (* (/ 15.0 8.0) (* (* (* (* (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))))))