
(FPCore (f) :precision binary64 (let* ((t_0 (/ (PI) 4.0)) (t_1 (* t_0 f)) (t_2 (exp t_1)) (t_3 (exp (- t_1)))) (- (* (/ 1.0 t_0) (log (/ (+ t_2 t_3) (- t_2 t_3)))))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{PI}\left(\right)}{4}\\
t_1 := t\_0 \cdot f\\
t_2 := e^{t\_1}\\
t_3 := e^{-t\_1}\\
-\frac{1}{t\_0} \cdot \log \left(\frac{t\_2 + t\_3}{t\_2 - t\_3}\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (f) :precision binary64 (let* ((t_0 (/ (PI) 4.0)) (t_1 (* t_0 f)) (t_2 (exp t_1)) (t_3 (exp (- t_1)))) (- (* (/ 1.0 t_0) (log (/ (+ t_2 t_3) (- t_2 t_3)))))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{PI}\left(\right)}{4}\\
t_1 := t\_0 \cdot f\\
t_2 := e^{t\_1}\\
t_3 := e^{-t\_1}\\
-\frac{1}{t\_0} \cdot \log \left(\frac{t\_2 + t\_3}{t\_2 - t\_3}\right)
\end{array}
\end{array}
(FPCore (f) :precision binary64 (let* ((t_0 (/ 2.0 (sqrt (PI))))) (* (* (log (tanh (* 0.25 (* f (PI))))) t_0) t_0)))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\\
\left(\log \tanh \left(0.25 \cdot \left(f \cdot \mathsf{PI}\left(\right)\right)\right) \cdot t\_0\right) \cdot t\_0
\end{array}
\end{array}
Initial program 6.9%
lift-neg.f64N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-/.f64N/A
inv-powN/A
sqr-powN/A
Applied rewrites98.6%
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f64N/A
lower-sqrt.f6498.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.6
Applied rewrites98.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
*-commutativeN/A
associate-/l*N/A
div-invN/A
metadata-evalN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6498.6
Applied rewrites98.6%
Final simplification98.6%
(FPCore (f) :precision binary64 (let* ((t_0 (* 0.25 (PI)))) (/ (log (tanh (* t_0 f))) t_0)))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.25 \cdot \mathsf{PI}\left(\right)\\
\frac{\log \tanh \left(t\_0 \cdot f\right)}{t\_0}
\end{array}
\end{array}
Initial program 6.9%
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
Applied rewrites98.6%
Final simplification98.6%
(FPCore (f)
:precision binary64
(let* ((t_0 (* (PI) 2.0)))
(*
(log
(/
(fma
(* (fma (* (* t_0 2.0) 0.005208333333333333) -2.0 (* 0.0625 t_0)) f)
f
(/ 2.0 (* 0.5 (PI))))
f))
(/ -4.0 (PI)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot 2\\
\log \left(\frac{\mathsf{fma}\left(\mathsf{fma}\left(\left(t\_0 \cdot 2\right) \cdot 0.005208333333333333, -2, 0.0625 \cdot t\_0\right) \cdot f, f, \frac{2}{0.5 \cdot \mathsf{PI}\left(\right)}\right)}{f}\right) \cdot \frac{-4}{\mathsf{PI}\left(\right)}
\end{array}
\end{array}
Initial program 6.9%
Taylor expanded in f around 0
associate-/l/N/A
metadata-evalN/A
associate-*r/N/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lower-/.f64N/A
lower-PI.f6494.8
Applied rewrites94.8%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
Applied rewrites94.8%
Taylor expanded in f around 0
Applied rewrites95.5%
Final simplification95.5%
(FPCore (f) :precision binary64 (let* ((t_0 (sqrt (PI)))) (* (* (/ (- 2.0) t_0) (log (/ (/ 4.0 (PI)) f))) (/ 2.0 t_0))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{PI}\left(\right)}\\
\left(\frac{-2}{t\_0} \cdot \log \left(\frac{\frac{4}{\mathsf{PI}\left(\right)}}{f}\right)\right) \cdot \frac{2}{t\_0}
\end{array}
\end{array}
Initial program 6.9%
Taylor expanded in f around 0
associate-/l/N/A
metadata-evalN/A
associate-*r/N/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lower-/.f64N/A
lower-PI.f6494.8
Applied rewrites94.8%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
Applied rewrites94.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
distribute-neg-fracN/A
lift-/.f64N/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
Applied rewrites95.0%
Final simplification95.0%
(FPCore (f) :precision binary64 (/ (log (* 0.25 (* f (PI)))) (* 0.25 (PI))))
\begin{array}{l}
\\
\frac{\log \left(0.25 \cdot \left(f \cdot \mathsf{PI}\left(\right)\right)\right)}{0.25 \cdot \mathsf{PI}\left(\right)}
\end{array}
Initial program 6.9%
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
un-div-invN/A
Applied rewrites98.6%
Taylor expanded in f around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6495.0
Applied rewrites95.0%
Final simplification95.0%
herbie shell --seed 2024256
(FPCore (f)
:name "VandenBroeck and Keller, Equation (20)"
:precision binary64
(- (* (/ 1.0 (/ (PI) 4.0)) (log (/ (+ (exp (* (/ (PI) 4.0) f)) (exp (- (* (/ (PI) 4.0) f)))) (- (exp (* (/ (PI) 4.0) f)) (exp (- (* (/ (PI) 4.0) f)))))))))