
(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 7 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
(/
(*
(log
(*
(/ (sinh (* (/ (PI) -4.0) f)) -2.0)
(/ 2.0 (cosh (* -0.25 (* f (PI)))))))
4.0)
(PI)))\begin{array}{l}
\\
\frac{\log \left(\frac{\sinh \left(\frac{\mathsf{PI}\left(\right)}{-4} \cdot f\right)}{-2} \cdot \frac{2}{\cosh \left(-0.25 \cdot \left(f \cdot \mathsf{PI}\left(\right)\right)\right)}\right) \cdot 4}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 7.3%
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
Applied rewrites98.8%
Applied rewrites98.8%
Taylor expanded in f around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6498.8
Applied rewrites98.8%
Applied rewrites98.8%
(FPCore (f) :precision binary64 (/ (* (log (/ (sinh (* (/ (PI) 4.0) f)) (cosh (* (* (PI) f) -0.25)))) 4.0) (PI)))
\begin{array}{l}
\\
\frac{\log \left(\frac{\sinh \left(\frac{\mathsf{PI}\left(\right)}{4} \cdot f\right)}{\cosh \left(\left(\mathsf{PI}\left(\right) \cdot f\right) \cdot -0.25\right)}\right) \cdot 4}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 7.3%
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
Applied rewrites98.8%
Applied rewrites98.8%
Taylor expanded in f around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6498.8
Applied rewrites98.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.3%
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
Applied rewrites98.8%
Taylor expanded in f around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6498.8
Applied rewrites98.8%
(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.3%
Taylor expanded in f around 0
Applied rewrites98.0%
Final simplification98.0%
(FPCore (f) :precision binary64 (/ (* (log (* (* (PI) f) 0.25)) 4.0) (PI)))
\begin{array}{l}
\\
\frac{\log \left(\left(\mathsf{PI}\left(\right) \cdot f\right) \cdot 0.25\right) \cdot 4}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 7.3%
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
Applied rewrites98.8%
Applied rewrites98.8%
Taylor expanded in f around 0
*-commutativeN/A
associate-*r*N/A
distribute-rgt-out--N/A
metadata-evalN/A
associate-*l*N/A
metadata-evalN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6497.8
Applied rewrites97.8%
Final simplification97.8%
(FPCore (f) :precision binary64 (* (/ 4.0 (PI)) (log (* 0.25 (* f (PI))))))
\begin{array}{l}
\\
\frac{4}{\mathsf{PI}\left(\right)} \cdot \log \left(0.25 \cdot \left(f \cdot \mathsf{PI}\left(\right)\right)\right)
\end{array}
Initial program 7.3%
Applied rewrites83.0%
Taylor expanded in f around 0
*-commutativeN/A
associate-*r*N/A
distribute-rgt-out--N/A
metadata-evalN/A
associate-*l*N/A
metadata-evalN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6482.0
Applied rewrites82.0%
lift-log.f64N/A
lift-pow.f64N/A
log-powN/A
lower-*.f64N/A
lower-log.f6497.6
Applied rewrites97.6%
(FPCore (f) :precision binary64 (* (/ -4.0 (PI)) (log (* 0.25 (* f (PI))))))
\begin{array}{l}
\\
\frac{-4}{\mathsf{PI}\left(\right)} \cdot \log \left(0.25 \cdot \left(f \cdot \mathsf{PI}\left(\right)\right)\right)
\end{array}
Initial program 7.3%
Applied rewrites83.0%
Taylor expanded in f around 0
*-commutativeN/A
associate-*r*N/A
distribute-rgt-out--N/A
metadata-evalN/A
associate-*l*N/A
metadata-evalN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6482.0
Applied rewrites82.0%
lift-log.f64N/A
lift-pow.f64N/A
log-powN/A
lower-*.f64N/A
lower-log.f6497.6
Applied rewrites97.6%
Applied rewrites1.6%
herbie shell --seed 2024361
(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)))))))))