
(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 7 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
(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}
Initial program 100.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (PI))))
(t_1 (/ 1.0 (fabs x)))
(t_2 (* (* t_1 t_1) t_1)))
(*
(* t_0 (exp (* (fabs x) (fabs x))))
(+
(+ (+ t_1 (* (/ 1.0 2.0) t_2)) (* (/ 3.0 4.0) (* (* t_2 t_1) t_1)))
(* (/ 15.0 8.0) (* (* (* (* (* t_0 t_1) t_1) t_1) t_1) t_1))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\\
t_1 := \frac{1}{\left|x\right|}\\
t_2 := \left(t\_1 \cdot t\_1\right) \cdot t\_1\\
\left(t\_0 \cdot e^{\left|x\right| \cdot \left|x\right|}\right) \cdot \left(\left(\left(t\_1 + \frac{1}{2} \cdot t\_2\right) + \frac{3}{4} \cdot \left(\left(t\_2 \cdot t\_1\right) \cdot t\_1\right)\right) + \frac{15}{8} \cdot \left(\left(\left(\left(\left(t\_0 \cdot t\_1\right) \cdot t\_1\right) \cdot t\_1\right) \cdot t\_1\right) \cdot t\_1\right)\right)
\end{array}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites99.8%
(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)))
(*
(* (/ 1.0 (sqrt (PI))) (exp (* (fabs x) (fabs x))))
(+
(+ (+ t_0 (* (/ 1.0 2.0) t_1)) (* (/ 3.0 4.0) (* t_2 t_0)))
(* (/ 15.0 8.0) t_2)))))\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 := t\_1 \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 \left(t\_2 \cdot t\_0\right)\right) + \frac{15}{8} \cdot t\_2\right)
\end{array}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites99.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (PI))))
(t_1 (/ 1.0 (fabs x)))
(t_2 (* (* t_1 t_1) t_1)))
(*
(* t_0 (exp (* (fabs x) (fabs x))))
(+
(+
(+ t_1 (* (/ 1.0 2.0) t_2))
(* (/ 3.0 4.0) (* (* (* t_0 t_1) t_1) t_1)))
(* (/ 15.0 8.0) (* t_2 t_1))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\mathsf{PI}\left(\right)}}\\
t_1 := \frac{1}{\left|x\right|}\\
t_2 := \left(t\_1 \cdot t\_1\right) \cdot t\_1\\
\left(t\_0 \cdot e^{\left|x\right| \cdot \left|x\right|}\right) \cdot \left(\left(\left(t\_1 + \frac{1}{2} \cdot t\_2\right) + \frac{3}{4} \cdot \left(\left(\left(t\_0 \cdot t\_1\right) \cdot t\_1\right) \cdot t\_1\right)\right) + \frac{15}{8} \cdot \left(t\_2 \cdot t\_1\right)\right)
\end{array}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites99.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (PI))) (t_1 (/ 1.0 (fabs x))) (t_2 (* (* t_1 t_1) t_1)))
(*
(* (/ 1.0 t_0) (exp (* (fabs x) (fabs x))))
(+
(+
(+ t_1 (* (/ 1.0 2.0) t_2))
(* (/ 3.0 4.0) (* (* (* t_0 t_1) t_1) t_1)))
(* (/ 15.0 8.0) (* t_2 t_1))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{PI}\left(\right)}\\
t_1 := \frac{1}{\left|x\right|}\\
t_2 := \left(t\_1 \cdot t\_1\right) \cdot t\_1\\
\left(\frac{1}{t\_0} \cdot e^{\left|x\right| \cdot \left|x\right|}\right) \cdot \left(\left(\left(t\_1 + \frac{1}{2} \cdot t\_2\right) + \frac{3}{4} \cdot \left(\left(\left(t\_0 \cdot t\_1\right) \cdot t\_1\right) \cdot t\_1\right)\right) + \frac{15}{8} \cdot \left(t\_2 \cdot t\_1\right)\right)
\end{array}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites99.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (PI))) (t_1 (/ 1.0 t_0)) (t_2 (/ 1.0 (fabs x))))
(*
(* t_1 (exp (* (fabs x) (fabs x))))
(+
(+
(+ t_2 (* (/ 1.0 2.0) (* (* t_2 t_2) t_2)))
(* (/ 3.0 4.0) (* (* (* t_0 t_2) t_2) t_2)))
(* (/ 15.0 8.0) (* (* t_1 t_2) t_2))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{PI}\left(\right)}\\
t_1 := \frac{1}{t\_0}\\
t_2 := \frac{1}{\left|x\right|}\\
\left(t\_1 \cdot e^{\left|x\right| \cdot \left|x\right|}\right) \cdot \left(\left(\left(t\_2 + \frac{1}{2} \cdot \left(\left(t\_2 \cdot t\_2\right) \cdot t\_2\right)\right) + \frac{3}{4} \cdot \left(\left(\left(t\_0 \cdot t\_2\right) \cdot t\_2\right) \cdot t\_2\right)\right) + \frac{15}{8} \cdot \left(\left(t\_1 \cdot t\_2\right) \cdot t\_2\right)\right)
\end{array}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites99.7%
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (PI))) (t_1 (/ 1.0 (fabs x))) (t_2 (* (* t_0 t_1) t_1)))
(*
(* (/ 1.0 t_0) (exp (* (fabs x) (fabs x))))
(+
(+
(+ t_1 (* (/ 1.0 2.0) (* (* t_1 t_1) t_1)))
(* (/ 3.0 4.0) (* t_2 t_1)))
(* (/ 15.0 8.0) t_2)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{PI}\left(\right)}\\
t_1 := \frac{1}{\left|x\right|}\\
t_2 := \left(t\_0 \cdot t\_1\right) \cdot t\_1\\
\left(\frac{1}{t\_0} \cdot e^{\left|x\right| \cdot \left|x\right|}\right) \cdot \left(\left(\left(t\_1 + \frac{1}{2} \cdot \left(\left(t\_1 \cdot t\_1\right) \cdot t\_1\right)\right) + \frac{3}{4} \cdot \left(t\_2 \cdot t\_1\right)\right) + \frac{15}{8} \cdot t\_2\right)
\end{array}
\end{array}
Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites99.7%
herbie shell --seed 2024321
(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)))))))