
(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 5 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 (tanh (* (/ (PI) 4.0) f))) 4.0) (PI)))
\begin{array}{l}
\\
\frac{\log \tanh \left(\frac{\mathsf{PI}\left(\right)}{4} \cdot f\right) \cdot 4}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 6.9%
Applied rewrites77.4%
lift-log.f64N/A
lift-pow.f64N/A
pow-to-expN/A
rem-log-expN/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites96.9%
Applied rewrites99.3%
(FPCore (f) :precision binary64 (* (/ 4.0 (PI)) (log (tanh (* (/ (PI) 4.0) f)))))
\begin{array}{l}
\\
\frac{4}{\mathsf{PI}\left(\right)} \cdot \log \tanh \left(\frac{\mathsf{PI}\left(\right)}{4} \cdot f\right)
\end{array}
Initial program 6.9%
Applied rewrites77.4%
lift-log.f64N/A
lift-pow.f64N/A
pow-to-expN/A
rem-log-expN/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites96.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.8
lift-/.f64N/A
Applied rewrites99.2%
(FPCore (f) :precision binary64 (* (/ (+ (log (* (PI) 0.25)) (log f)) (PI)) 4.0))
\begin{array}{l}
\\
\frac{\log \left(\mathsf{PI}\left(\right) \cdot 0.25\right) + \log f}{\mathsf{PI}\left(\right)} \cdot 4
\end{array}
Initial program 6.9%
Applied rewrites96.5%
lift-neg.f64N/A
lift-log.f64N/A
neg-logN/A
lower-log.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites96.9%
Taylor expanded in f around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.0%
Applied rewrites96.0%
(FPCore (f) :precision binary64 (* (/ (log (* 0.25 (* (PI) f))) (PI)) 4.0))
\begin{array}{l}
\\
\frac{\log \left(0.25 \cdot \left(\mathsf{PI}\left(\right) \cdot f\right)\right)}{\mathsf{PI}\left(\right)} \cdot 4
\end{array}
Initial program 6.9%
Applied rewrites96.5%
lift-neg.f64N/A
lift-log.f64N/A
neg-logN/A
lower-log.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites96.9%
Taylor expanded in f around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.0%
Applied rewrites95.9%
(FPCore (f) :precision binary64 (* (log (* 0.25 (* (PI) f))) (/ 4.0 (PI))))
\begin{array}{l}
\\
\log \left(0.25 \cdot \left(\mathsf{PI}\left(\right) \cdot f\right)\right) \cdot \frac{4}{\mathsf{PI}\left(\right)}
\end{array}
Initial program 6.9%
Applied rewrites96.5%
lift-neg.f64N/A
lift-log.f64N/A
neg-logN/A
lower-log.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites96.9%
Taylor expanded in f around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.0%
Applied rewrites95.8%
herbie shell --seed 2024351
(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)))))))))