
(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 4 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 8.1%
Taylor expanded in f around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.6%
Applied rewrites97.6%
(FPCore (f) :precision binary64 (* (/ (log (/ (fma (* (* 0.08333333333333333 (PI)) f) f (/ 4.0 (PI))) f)) (- (PI))) 4.0))
\begin{array}{l}
\\
\frac{\log \left(\frac{\mathsf{fma}\left(\left(0.08333333333333333 \cdot \mathsf{PI}\left(\right)\right) \cdot f, f, \frac{4}{\mathsf{PI}\left(\right)}\right)}{f}\right)}{-\mathsf{PI}\left(\right)} \cdot 4
\end{array}
Initial program 8.1%
Taylor expanded in f around 0
Applied rewrites96.6%
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.6
Applied rewrites96.6%
Applied rewrites96.8%
lift-/.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
Applied rewrites96.8%
Final simplification96.8%
(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 8.1%
Taylor expanded in f around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.1%
Taylor expanded in f around 0
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f6496.1
Applied rewrites96.1%
lift-/.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-PI.f6496.1
Applied rewrites96.1%
(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 8.1%
Taylor expanded in f around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.1%
Taylor expanded in f around 0
lower-/.f64N/A
lower-*.f64N/A
lift-PI.f6496.1
Applied rewrites96.1%
herbie shell --seed 2025050
(FPCore (f)
:name "VandenBroeck and Keller, Equation (20)"
:precision binary64
:pre (TRUE)
(- (* (/ 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)))))))))