
(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 8 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 (/ (PI) 4.0)) (t_1 (/ (PI) -4.0)))
(*
(/ -1.0 t_0)
(log
(pow
(pow (/ (cosh (* t_1 f)) (sinh (* f t_0))) (pow (exp f) t_0))
(pow (exp f) t_1))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{PI}\left(\right)}{4}\\
t_1 := \frac{\mathsf{PI}\left(\right)}{-4}\\
\frac{-1}{t\_0} \cdot \log \left({\left({\left(\frac{\cosh \left(t\_1 \cdot f\right)}{\sinh \left(f \cdot t\_0\right)}\right)}^{\left({\left(e^{f}\right)}^{t\_0}\right)}\right)}^{\left({\left(e^{f}\right)}^{t\_1}\right)}\right)
\end{array}
\end{array}
Initial program 7.6%
Applied rewrites99.2%
Final simplification99.2%
(FPCore (f)
:precision binary64
(*
(/
(log
(/
(/
(fma (exp (* (/ f -4.0) (PI))) 2.0 (* 2.0 (pow (exp (PI)) (/ f 4.0))))
4.0)
(sinh (* (* (PI) f) 0.25))))
(PI))
-4.0))\begin{array}{l}
\\
\frac{\log \left(\frac{\frac{\mathsf{fma}\left(e^{\frac{f}{-4} \cdot \mathsf{PI}\left(\right)}, 2, 2 \cdot {\left(e^{\mathsf{PI}\left(\right)}\right)}^{\left(\frac{f}{4}\right)}\right)}{4}}{\sinh \left(\left(\mathsf{PI}\left(\right) \cdot f\right) \cdot 0.25\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4
\end{array}
Initial program 7.6%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites99.0%
Applied rewrites99.0%
lift-pow.f64N/A
pow-to-expN/A
lift-exp.f64N/A
rem-log-expN/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
associate-*r/N/A
associate-*l/N/A
lift-/.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-PI.f64N/A
lower-exp.f64N/A
Applied rewrites99.0%
Taylor expanded in f around 0
Applied rewrites99.0%
(FPCore (f) :precision binary64 (* (/ (- (log (cosh (* -0.25 (* (PI) f)))) (log (sinh (* (* 0.25 (PI)) f)))) (PI)) -4.0))
\begin{array}{l}
\\
\frac{\log \cosh \left(-0.25 \cdot \left(\mathsf{PI}\left(\right) \cdot f\right)\right) - \log \sinh \left(\left(0.25 \cdot \mathsf{PI}\left(\right)\right) \cdot f\right)}{\mathsf{PI}\left(\right)} \cdot -4
\end{array}
Initial program 7.6%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites99.0%
Taylor expanded in f around 0
Applied rewrites99.0%
Taylor expanded in f around 0
Applied rewrites99.0%
lift-log.f64N/A
lift-/.f64N/A
log-divN/A
lower--.f64N/A
lower-log.f64N/A
Applied rewrites99.0%
(FPCore (f) :precision binary64 (let* ((t_0 (* (PI) f))) (* (/ (log (/ (cosh (* t_0 -0.25)) (sinh (* t_0 0.25)))) (PI)) -4.0)))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot f\\
\frac{\log \left(\frac{\cosh \left(t\_0 \cdot -0.25\right)}{\sinh \left(t\_0 \cdot 0.25\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4
\end{array}
\end{array}
Initial program 7.6%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites99.0%
Taylor expanded in f around 0
Applied rewrites99.0%
Taylor expanded in f around 0
Applied rewrites99.0%
(FPCore (f)
:precision binary64
(*
(/
(log
(/ (fma (* (* 0.03125 f) f) (* (PI) (PI)) 1.0) (sinh (* (* (PI) f) 0.25))))
(PI))
-4.0))\begin{array}{l}
\\
\frac{\log \left(\frac{\mathsf{fma}\left(\left(0.03125 \cdot f\right) \cdot f, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), 1\right)}{\sinh \left(\left(\mathsf{PI}\left(\right) \cdot f\right) \cdot 0.25\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4
\end{array}
Initial program 7.6%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites99.0%
Taylor expanded in f around 0
Applied rewrites98.0%
Taylor expanded in f around 0
Applied rewrites98.0%
(FPCore (f) :precision binary64 (/ (* (log (/ (fma (* (PI) (PI)) (* (* 0.03125 f) f) 1.0) (* (* 0.25 (PI)) f))) -4.0) (PI)))
\begin{array}{l}
\\
\frac{\log \left(\frac{\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), \left(0.03125 \cdot f\right) \cdot f, 1\right)}{\left(0.25 \cdot \mathsf{PI}\left(\right)\right) \cdot f}\right) \cdot -4}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 7.6%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites99.0%
Taylor expanded in f around 0
Applied rewrites98.0%
Taylor expanded in f around 0
Applied rewrites97.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites97.6%
(FPCore (f) :precision binary64 (* (/ (log (/ (/ 4.0 f) (PI))) (PI)) -4.0))
\begin{array}{l}
\\
\frac{\log \left(\frac{\frac{4}{f}}{\mathsf{PI}\left(\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4
\end{array}
Initial program 7.6%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites99.0%
Taylor expanded in f around 0
Applied rewrites97.4%
Applied rewrites97.5%
(FPCore (f) :precision binary64 (* (/ (log (/ 4.0 (* f (PI)))) (PI)) -4.0))
\begin{array}{l}
\\
\frac{\log \left(\frac{4}{f \cdot \mathsf{PI}\left(\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4
\end{array}
Initial program 7.6%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites99.0%
Taylor expanded in f around 0
Applied rewrites97.4%
Applied rewrites97.4%
herbie shell --seed 2025022
(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)))))))))