
(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) f)))
(*
(/ -1.0 (/ (PI) 4.0))
(- (log (* (cosh t_0) 2.0)) (log (* -2.0 (sinh t_0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{PI}\left(\right)}{-4} \cdot f\\
\frac{-1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \left(\log \left(\cosh t\_0 \cdot 2\right) - \log \left(-2 \cdot \sinh t\_0\right)\right)
\end{array}
\end{array}
Initial program 7.2%
lift-log.f64N/A
lift-/.f64N/A
log-divN/A
lower--.f64N/A
Applied rewrites97.4%
Final simplification97.4%
(FPCore (f)
:precision binary64
(let* ((t_0 (* f (/ (PI) -4.0))))
(*
-4.0
(- (/ (log (* (cosh t_0) 2.0)) (PI)) (/ (log (* (sinh t_0) -2.0)) (PI))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := f \cdot \frac{\mathsf{PI}\left(\right)}{-4}\\
-4 \cdot \left(\frac{\log \left(\cosh t\_0 \cdot 2\right)}{\mathsf{PI}\left(\right)} - \frac{\log \left(\sinh t\_0 \cdot -2\right)}{\mathsf{PI}\left(\right)}\right)
\end{array}
\end{array}
Initial program 7.2%
Applied rewrites97.3%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-rgt-out--N/A
lower-*.f64N/A
Applied rewrites97.3%
(FPCore (f) :precision binary64 (* (/ (log (/ (cosh (* (/ (PI) -4.0) f)) (sinh (* f (/ (PI) 4.0))))) (PI)) -4.0))
\begin{array}{l}
\\
\frac{\log \left(\frac{\cosh \left(\frac{\mathsf{PI}\left(\right)}{-4} \cdot f\right)}{\sinh \left(f \cdot \frac{\mathsf{PI}\left(\right)}{4}\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.3%
(FPCore (f)
:precision binary64
(-
(/
(fma
4.0
(- (log (/ 2.0 (* 0.5 (PI)))) (log f))
(* (* (* (* (PI) 0.08333333333333333) (PI)) f) f))
(PI))))\begin{array}{l}
\\
-\frac{\mathsf{fma}\left(4, \log \left(\frac{2}{0.5 \cdot \mathsf{PI}\left(\right)}\right) - \log f, \left(\left(\left(\mathsf{PI}\left(\right) \cdot 0.08333333333333333\right) \cdot \mathsf{PI}\left(\right)\right) \cdot f\right) \cdot f\right)}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 7.2%
Taylor expanded in f around 0
Applied rewrites97.2%
Taylor expanded in f around 0
Applied rewrites97.2%
(FPCore (f)
:precision binary64
(-
(/
(fma
(log (/ (/ 4.0 (PI)) f))
4.0
(*
(* f (* 2.0 f))
(* (* (fma (PI) -0.041666666666666664 (* 0.125 (PI))) (PI)) 0.5)))
(PI))))\begin{array}{l}
\\
-\frac{\mathsf{fma}\left(\log \left(\frac{\frac{4}{\mathsf{PI}\left(\right)}}{f}\right), 4, \left(f \cdot \left(2 \cdot f\right)\right) \cdot \left(\left(\mathsf{fma}\left(\mathsf{PI}\left(\right), -0.041666666666666664, 0.125 \cdot \mathsf{PI}\left(\right)\right) \cdot \mathsf{PI}\left(\right)\right) \cdot 0.5\right)\right)}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 7.2%
Taylor expanded in f around 0
Applied rewrites97.2%
Applied rewrites96.2%
Applied rewrites96.7%
(FPCore (f) :precision binary64 (* (/ -4.0 (PI)) (log (/ (fma (* (* f f) (PI)) 0.08333333333333333 (/ 4.0 (PI))) f))))
\begin{array}{l}
\\
\frac{-4}{\mathsf{PI}\left(\right)} \cdot \log \left(\frac{\mathsf{fma}\left(\left(f \cdot f\right) \cdot \mathsf{PI}\left(\right), 0.08333333333333333, \frac{4}{\mathsf{PI}\left(\right)}\right)}{f}\right)
\end{array}
Initial program 7.2%
Taylor expanded in f around 0
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
associate-*r/N/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6496.0
Applied rewrites96.0%
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites96.0%
Taylor expanded in f around 0
Applied rewrites96.6%
Taylor expanded in f around 0
Applied rewrites96.6%
(FPCore (f) :precision binary64 (/ (* (log (/ 4.0 (* (PI) f))) -4.0) (PI)))
\begin{array}{l}
\\
\frac{\log \left(\frac{4}{\mathsf{PI}\left(\right) \cdot f}\right) \cdot -4}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 7.2%
Taylor expanded in f around 0
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
associate-*r/N/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6496.0
Applied rewrites96.0%
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites96.0%
Applied rewrites96.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites96.1%
(FPCore (f) :precision binary64 (* (/ -4.0 (PI)) (log (/ 4.0 (* f (PI))))))
\begin{array}{l}
\\
\frac{-4}{\mathsf{PI}\left(\right)} \cdot \log \left(\frac{4}{f \cdot \mathsf{PI}\left(\right)}\right)
\end{array}
Initial program 7.2%
Taylor expanded in f around 0
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
associate-*r/N/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6496.0
Applied rewrites96.0%
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites96.0%
Applied rewrites96.0%
herbie shell --seed 2025006
(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)))))))))