
(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 6 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 (* (* f (PI)) 0.25))) (/ (* (log (/ (cosh t_0) (sinh t_0))) -4.0) (PI))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(f \cdot \mathsf{PI}\left(\right)\right) \cdot 0.25\\
\frac{\log \left(\frac{\cosh t\_0}{\sinh t\_0}\right) \cdot -4}{\mathsf{PI}\left(\right)}
\end{array}
\end{array}
Initial program 7.0%
Taylor expanded in f around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.7%
Applied rewrites96.7%
(FPCore (f) :precision binary64 (let* ((t_0 (* f (PI)))) (* (/ (- (* (pow t_0 2.0) 0.03125) (log (sinh (* t_0 0.25)))) (PI)) -4.0)))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := f \cdot \mathsf{PI}\left(\right)\\
\frac{{t\_0}^{2} \cdot 0.03125 - \log \sinh \left(t\_0 \cdot 0.25\right)}{\mathsf{PI}\left(\right)} \cdot -4
\end{array}
\end{array}
Initial program 7.0%
Taylor expanded in f around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.7%
lift-log.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-cosh.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sinh.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
Applied rewrites96.7%
Taylor expanded in f around 0
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lift-*.f64N/A
lift-PI.f6496.2
Applied rewrites96.2%
(FPCore (f) :precision binary64 (* (/ -1.0 (/ (PI) 4.0)) (log (/ (fma (* (PI) 0.08333333333333333) (* f f) (/ 4.0 (PI))) f))))
\begin{array}{l}
\\
\frac{-1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot 0.08333333333333333, f \cdot f, \frac{4}{\mathsf{PI}\left(\right)}\right)}{f}\right)
\end{array}
Initial program 7.0%
Taylor expanded in f around 0
Applied rewrites96.1%
Taylor expanded in f around 0
*-commutativeN/A
lower-fma.f64N/A
distribute-rgt-outN/A
lower-*.f64N/A
lift-PI.f64N/A
metadata-evalN/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift-PI.f6496.1
Applied rewrites96.1%
Final simplification96.1%
(FPCore (f) :precision binary64 (/ (* (log (/ (/ 2.0 (* 0.5 (PI))) f)) -4.0) (PI)))
\begin{array}{l}
\\
\frac{\log \left(\frac{\frac{2}{0.5 \cdot \mathsf{PI}\left(\right)}}{f}\right) \cdot -4}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 7.0%
Taylor expanded in f around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.7%
lift-log.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
metadata-evalN/A
distribute-rgt-out--N/A
*-commutativeN/A
associate-/r*N/A
log-divN/A
lower--.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-log.f64N/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lift-PI.f6495.6
Applied rewrites95.6%
Applied rewrites95.7%
(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.0%
Taylor expanded in f around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.7%
Taylor expanded in f around 0
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f6495.7
Applied rewrites95.7%
(FPCore (f) :precision binary64 (* (/ (- 4.0) (PI)) (log (* (* 0.08333333333333333 (PI)) f))))
\begin{array}{l}
\\
\frac{-4}{\mathsf{PI}\left(\right)} \cdot \log \left(\left(0.08333333333333333 \cdot \mathsf{PI}\left(\right)\right) \cdot f\right)
\end{array}
Initial program 7.0%
Taylor expanded in f around 0
Applied rewrites96.1%
Taylor expanded in f around inf
*-commutativeN/A
lower-*.f64N/A
distribute-rgt-outN/A
lower-*.f64N/A
lift-PI.f64N/A
metadata-eval1.7
Applied rewrites1.7%
lift-neg.f64N/A
Applied rewrites1.7%
Final simplification1.7%
herbie shell --seed 2025073
(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)))))))))