
(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 (* (fma (PI) (/ (log (cosh (* f (/ (PI) -4.0)))) (* (PI) (PI))) (/ (log (sinh (* (/ (PI) 4.0) f))) (- (PI)))) -4.0))
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{PI}\left(\right), \frac{\log \cosh \left(f \cdot \frac{\mathsf{PI}\left(\right)}{-4}\right)}{\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)}, \frac{\log \sinh \left(\frac{\mathsf{PI}\left(\right)}{4} \cdot f\right)}{-\mathsf{PI}\left(\right)}\right) \cdot -4
\end{array}
Initial program 7.2%
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
Applied rewrites97.4%
lift-log.f64N/A
lift-/.f64N/A
log-divN/A
lift-log.f64N/A
lower--.f64N/A
Applied rewrites97.8%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
frac-subN/A
lift-PI.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
Applied rewrites97.7%
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
div-addN/A
Applied rewrites97.8%
Final simplification97.8%
(FPCore (f) :precision binary64 (let* ((t_0 (* f (/ (PI) 4.0)))) (* (/ (- (log (cosh t_0)) (log (sinh t_0))) (PI)) -4.0)))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := f \cdot \frac{\mathsf{PI}\left(\right)}{4}\\
\frac{\log \cosh t\_0 - \log \sinh t\_0}{\mathsf{PI}\left(\right)} \cdot -4
\end{array}
\end{array}
Initial program 7.2%
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
Applied rewrites97.4%
lift-log.f64N/A
lift-/.f64N/A
log-divN/A
lift-log.f64N/A
lower--.f64N/A
Applied rewrites97.8%
(FPCore (f) :precision binary64 (* (/ (log (/ (cosh (* (/ (PI) -4.0) f)) (sinh (* (* (PI) f) 0.25)))) (PI)) -4.0))
\begin{array}{l}
\\
\frac{\log \left(\frac{\cosh \left(\frac{\mathsf{PI}\left(\right)}{-4} \cdot f\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.2%
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
Applied rewrites97.4%
Taylor expanded in f around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6497.4
Applied rewrites97.4%
(FPCore (f)
:precision binary64
(let* ((t_0 (* (PI) 2.0)) (t_1 (* 0.5 (PI))))
(-
(/
(fma
4.0
(- (log (/ 2.0 t_1)) (log f))
(*
(*
(* 2.0 f)
(* (fma (* (* t_0 2.0) 0.005208333333333333) -2.0 (* t_0 0.0625)) t_1))
f))
(PI)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot 2\\
t_1 := 0.5 \cdot \mathsf{PI}\left(\right)\\
-\frac{\mathsf{fma}\left(4, \log \left(\frac{2}{t\_1}\right) - \log f, \left(\left(2 \cdot f\right) \cdot \left(\mathsf{fma}\left(\left(t\_0 \cdot 2\right) \cdot 0.005208333333333333, -2, t\_0 \cdot 0.0625\right) \cdot t\_1\right)\right) \cdot f\right)}{\mathsf{PI}\left(\right)}
\end{array}
\end{array}
Initial program 7.2%
Taylor expanded in f around 0
Applied rewrites96.6%
(FPCore (f)
:precision binary64
(let* ((t_0 (* (PI) 2.0)))
(*
(/ -1.0 (/ (PI) 4.0))
(log
(fma
(* (fma (* (* t_0 2.0) 0.005208333333333333) -2.0 (* t_0 0.0625)) f)
1.0
(/ (/ 2.0 (* 0.5 (PI))) f))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot 2\\
\frac{-1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\mathsf{fma}\left(\mathsf{fma}\left(\left(t\_0 \cdot 2\right) \cdot 0.005208333333333333, -2, t\_0 \cdot 0.0625\right) \cdot f, 1, \frac{\frac{2}{0.5 \cdot \mathsf{PI}\left(\right)}}{f}\right)\right)
\end{array}
\end{array}
Initial program 7.2%
Taylor expanded in f around 0
Applied rewrites96.2%
Final simplification96.2%
(FPCore (f) :precision binary64 (let* ((t_0 (sqrt (PI)))) (* (/ (log (/ 2.0 (* (* 0.5 (* t_0 t_0)) f))) (PI)) -4.0)))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{PI}\left(\right)}\\
\frac{\log \left(\frac{2}{\left(0.5 \cdot \left(t\_0 \cdot t\_0\right)\right) \cdot f}\right)}{\mathsf{PI}\left(\right)} \cdot -4
\end{array}
\end{array}
Initial program 7.2%
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
Applied rewrites97.4%
Taylor expanded in f around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6495.7
Applied rewrites95.7%
Applied rewrites95.7%
(FPCore (f) :precision binary64 (/ (* (log (/ (/ 4.0 (PI)) f)) -4.0) (PI)))
\begin{array}{l}
\\
\frac{\log \left(\frac{\frac{4}{\mathsf{PI}\left(\right)}}{f}\right) \cdot -4}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 7.2%
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
Applied rewrites97.4%
Taylor expanded in f around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6495.7
Applied rewrites95.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites95.7%
(FPCore (f) :precision binary64 (* (/ (log (/ 4.0 (* (PI) f))) (PI)) -4.0))
\begin{array}{l}
\\
\frac{\log \left(\frac{4}{\mathsf{PI}\left(\right) \cdot f}\right)}{\mathsf{PI}\left(\right)} \cdot -4
\end{array}
Initial program 7.2%
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
Applied rewrites97.4%
Taylor expanded in f around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6495.7
Applied rewrites95.7%
Applied rewrites95.7%
herbie shell --seed 2024353
(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)))))))))