VandenBroeck and Keller, Equation (20)

Percentage Accurate: 6.8% → 98.8%
Time: 16.3s
Alternatives: 7
Speedup: 4.8×

Specification

?
\[\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)) (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:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 7 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 6.8% accurate, 1.0× speedup?

\[\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)) (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}

Alternative 1: 98.8% accurate, 2.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\\ \left(\log \tanh \left(\frac{f}{\frac{4}{\mathsf{PI}\left(\right)}}\right) \cdot t\_0\right) \cdot t\_0 \end{array} \end{array} \]
(FPCore (f)
 :precision binary64
 (let* ((t_0 (/ 2.0 (sqrt (PI)))))
   (* (* (log (tanh (/ f (/ 4.0 (PI))))) t_0) t_0)))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\\
\left(\log \tanh \left(\frac{f}{\frac{4}{\mathsf{PI}\left(\right)}}\right) \cdot t\_0\right) \cdot t\_0
\end{array}
\end{array}
Derivation
  1. Initial program 6.7%

    \[-\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-neg.f64N/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)}\right) \]
    3. distribute-rgt-neg-inN/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \left(\mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)\right)} \]
    4. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}}} \cdot \left(\mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)\right) \]
    5. inv-powN/A

      \[\leadsto \color{blue}{{\left(\frac{\mathsf{PI}\left(\right)}{4}\right)}^{-1}} \cdot \left(\mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)\right) \]
    6. sqr-powN/A

      \[\leadsto \color{blue}{\left({\left(\frac{\mathsf{PI}\left(\right)}{4}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{\mathsf{PI}\left(\right)}{4}\right)}^{\left(\frac{-1}{2}\right)}\right)} \cdot \left(\mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)\right) \]
  4. Applied rewrites99.1%

    \[\leadsto \color{blue}{{\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{0.5} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{0.5} \cdot \log \tanh \left(f \cdot \left(0.25 \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
  5. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \color{blue}{{\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    2. unpow1/2N/A

      \[\leadsto \color{blue}{\sqrt{\frac{4}{\mathsf{PI}\left(\right)}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    3. lift-/.f64N/A

      \[\leadsto \sqrt{\color{blue}{\frac{4}{\mathsf{PI}\left(\right)}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    4. sqrt-divN/A

      \[\leadsto \color{blue}{\frac{\sqrt{4}}{\sqrt{\mathsf{PI}\left(\right)}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \frac{\color{blue}{2}}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    6. lift-PI.f64N/A

      \[\leadsto \frac{2}{\sqrt{\color{blue}{\mathsf{PI}\left(\right)}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    7. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{2}{\sqrt{\mathsf{PI}\left(\right)}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    8. lift-PI.f64N/A

      \[\leadsto \frac{2}{\sqrt{\color{blue}{\mathsf{PI}\left(\right)}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    9. lower-sqrt.f6499.1

      \[\leadsto \frac{2}{\color{blue}{\sqrt{\mathsf{PI}\left(\right)}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{0.5} \cdot \log \tanh \left(f \cdot \left(0.25 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    10. lift-*.f64N/A

      \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \color{blue}{\left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
    11. *-commutativeN/A

      \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \color{blue}{\left(\log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}}\right)} \]
    12. lower-*.f6499.1

      \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \color{blue}{\left(\log \tanh \left(f \cdot \left(0.25 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{0.5}\right)} \]
  6. Applied rewrites99.1%

    \[\leadsto \color{blue}{\frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left(\log \tanh \left(\frac{f}{\frac{4}{\mathsf{PI}\left(\right)}}\right) \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\right)} \]
  7. Final simplification99.1%

    \[\leadsto \left(\log \tanh \left(\frac{f}{\frac{4}{\mathsf{PI}\left(\right)}}\right) \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\right) \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \]
  8. Add Preprocessing

Alternative 2: 98.8% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\\ \left(\log \tanh \left(0.25 \cdot \left(f \cdot \mathsf{PI}\left(\right)\right)\right) \cdot t\_0\right) \cdot t\_0 \end{array} \end{array} \]
(FPCore (f)
 :precision binary64
 (let* ((t_0 (/ 2.0 (sqrt (PI)))))
   (* (* (log (tanh (* 0.25 (* f (PI))))) t_0) t_0)))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\\
\left(\log \tanh \left(0.25 \cdot \left(f \cdot \mathsf{PI}\left(\right)\right)\right) \cdot t\_0\right) \cdot t\_0
\end{array}
\end{array}
Derivation
  1. Initial program 6.7%

    \[-\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-neg.f64N/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)}\right) \]
    3. distribute-rgt-neg-inN/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \left(\mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)\right)} \]
    4. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}}} \cdot \left(\mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)\right) \]
    5. inv-powN/A

      \[\leadsto \color{blue}{{\left(\frac{\mathsf{PI}\left(\right)}{4}\right)}^{-1}} \cdot \left(\mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)\right) \]
    6. sqr-powN/A

      \[\leadsto \color{blue}{\left({\left(\frac{\mathsf{PI}\left(\right)}{4}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{\mathsf{PI}\left(\right)}{4}\right)}^{\left(\frac{-1}{2}\right)}\right)} \cdot \left(\mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)\right) \]
  4. Applied rewrites99.1%

    \[\leadsto \color{blue}{{\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{0.5} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{0.5} \cdot \log \tanh \left(f \cdot \left(0.25 \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
  5. Step-by-step derivation
    1. lift-pow.f64N/A

      \[\leadsto \color{blue}{{\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    2. unpow1/2N/A

      \[\leadsto \color{blue}{\sqrt{\frac{4}{\mathsf{PI}\left(\right)}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    3. lift-/.f64N/A

      \[\leadsto \sqrt{\color{blue}{\frac{4}{\mathsf{PI}\left(\right)}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    4. sqrt-divN/A

      \[\leadsto \color{blue}{\frac{\sqrt{4}}{\sqrt{\mathsf{PI}\left(\right)}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    5. metadata-evalN/A

      \[\leadsto \frac{\color{blue}{2}}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    6. lift-PI.f64N/A

      \[\leadsto \frac{2}{\sqrt{\color{blue}{\mathsf{PI}\left(\right)}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    7. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{2}{\sqrt{\mathsf{PI}\left(\right)}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    8. lift-PI.f64N/A

      \[\leadsto \frac{2}{\sqrt{\color{blue}{\mathsf{PI}\left(\right)}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    9. lower-sqrt.f6499.1

      \[\leadsto \frac{2}{\color{blue}{\sqrt{\mathsf{PI}\left(\right)}}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{0.5} \cdot \log \tanh \left(f \cdot \left(0.25 \cdot \mathsf{PI}\left(\right)\right)\right)\right) \]
    10. lift-*.f64N/A

      \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \color{blue}{\left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
    11. *-commutativeN/A

      \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \color{blue}{\left(\log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}}\right)} \]
    12. lower-*.f6499.1

      \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \color{blue}{\left(\log \tanh \left(f \cdot \left(0.25 \cdot \mathsf{PI}\left(\right)\right)\right) \cdot {\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{0.5}\right)} \]
  6. Applied rewrites99.1%

    \[\leadsto \color{blue}{\frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left(\log \tanh \left(\frac{f}{\frac{4}{\mathsf{PI}\left(\right)}}\right) \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\right)} \]
  7. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left(\log \tanh \color{blue}{\left(\frac{f}{\frac{4}{\mathsf{PI}\left(\right)}}\right)} \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\right) \]
    2. lift-/.f64N/A

      \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left(\log \tanh \left(\frac{f}{\color{blue}{\frac{4}{\mathsf{PI}\left(\right)}}}\right) \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\right) \]
    3. associate-/r/N/A

      \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left(\log \tanh \color{blue}{\left(\frac{f}{4} \cdot \mathsf{PI}\left(\right)\right)} \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\right) \]
    4. associate-*l/N/A

      \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left(\log \tanh \color{blue}{\left(\frac{f \cdot \mathsf{PI}\left(\right)}{4}\right)} \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\right) \]
    5. lift-*.f64N/A

      \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left(\log \tanh \left(\frac{\color{blue}{f \cdot \mathsf{PI}\left(\right)}}{4}\right) \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\right) \]
    6. div-invN/A

      \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left(\log \tanh \color{blue}{\left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{4}\right)} \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\right) \]
    7. metadata-evalN/A

      \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left(\log \tanh \left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot \color{blue}{\frac{1}{4}}\right) \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\right) \]
    8. lower-*.f6499.1

      \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left(\log \tanh \color{blue}{\left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot 0.25\right)} \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\right) \]
  8. Applied rewrites99.1%

    \[\leadsto \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \left(\log \tanh \color{blue}{\left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot 0.25\right)} \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\right) \]
  9. Final simplification99.1%

    \[\leadsto \left(\log \tanh \left(0.25 \cdot \left(f \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}}\right) \cdot \frac{2}{\sqrt{\mathsf{PI}\left(\right)}} \]
  10. Add Preprocessing

Alternative 3: 98.9% accurate, 2.6× speedup?

\[\begin{array}{l} \\ \frac{\log \tanh \left(\frac{f}{\frac{4}{\mathsf{PI}\left(\right)}}\right) \cdot 4}{\mathsf{PI}\left(\right)} \end{array} \]
(FPCore (f)
 :precision binary64
 (/ (* (log (tanh (/ f (/ 4.0 (PI))))) 4.0) (PI)))
\begin{array}{l}

\\
\frac{\log \tanh \left(\frac{f}{\frac{4}{\mathsf{PI}\left(\right)}}\right) \cdot 4}{\mathsf{PI}\left(\right)}
\end{array}
Derivation
  1. Initial program 6.7%

    \[-\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-neg.f64N/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)}\right) \]
    3. distribute-rgt-neg-inN/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \left(\mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)\right)} \]
    4. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}}} \cdot \left(\mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)\right) \]
    5. inv-powN/A

      \[\leadsto \color{blue}{{\left(\frac{\mathsf{PI}\left(\right)}{4}\right)}^{-1}} \cdot \left(\mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)\right) \]
    6. sqr-powN/A

      \[\leadsto \color{blue}{\left({\left(\frac{\mathsf{PI}\left(\right)}{4}\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(\frac{\mathsf{PI}\left(\right)}{4}\right)}^{\left(\frac{-1}{2}\right)}\right)} \cdot \left(\mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)\right) \]
  4. Applied rewrites99.1%

    \[\leadsto \color{blue}{{\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{0.5} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{0.5} \cdot \log \tanh \left(f \cdot \left(0.25 \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \color{blue}{{\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
    2. lift-*.f64N/A

      \[\leadsto {\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \color{blue}{\left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right)} \]
    3. associate-*r*N/A

      \[\leadsto \color{blue}{\left({\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}} \cdot {\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}}\right) \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
    4. lift-pow.f64N/A

      \[\leadsto \left(\color{blue}{{\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}}\right) \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right) \]
    5. unpow1/2N/A

      \[\leadsto \left(\color{blue}{\sqrt{\frac{4}{\mathsf{PI}\left(\right)}}} \cdot {\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}}\right) \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right) \]
    6. lift-pow.f64N/A

      \[\leadsto \left(\sqrt{\frac{4}{\mathsf{PI}\left(\right)}} \cdot \color{blue}{{\left(\frac{4}{\mathsf{PI}\left(\right)}\right)}^{\frac{1}{2}}}\right) \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right) \]
    7. unpow1/2N/A

      \[\leadsto \left(\sqrt{\frac{4}{\mathsf{PI}\left(\right)}} \cdot \color{blue}{\sqrt{\frac{4}{\mathsf{PI}\left(\right)}}}\right) \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right) \]
    8. rem-square-sqrtN/A

      \[\leadsto \color{blue}{\frac{4}{\mathsf{PI}\left(\right)}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right) \]
    9. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{4}{\mathsf{PI}\left(\right)}} \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right) \]
    10. associate-*l/N/A

      \[\leadsto \color{blue}{\frac{4 \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)}{\mathsf{PI}\left(\right)}} \]
    11. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{4 \cdot \log \tanh \left(f \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)}{\mathsf{PI}\left(\right)}} \]
  6. Applied rewrites99.1%

    \[\leadsto \color{blue}{\frac{4 \cdot \log \tanh \left(\frac{f}{\frac{4}{\mathsf{PI}\left(\right)}}\right)}{\mathsf{PI}\left(\right)}} \]
  7. Final simplification99.1%

    \[\leadsto \frac{\log \tanh \left(\frac{f}{\frac{4}{\mathsf{PI}\left(\right)}}\right) \cdot 4}{\mathsf{PI}\left(\right)} \]
  8. Add Preprocessing

Alternative 4: 98.9% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.25 \cdot \mathsf{PI}\left(\right)\\ \frac{\log \tanh \left(t\_0 \cdot f\right)}{t\_0} \end{array} \end{array} \]
(FPCore (f)
 :precision binary64
 (let* ((t_0 (* 0.25 (PI)))) (/ (log (tanh (* t_0 f))) t_0)))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.25 \cdot \mathsf{PI}\left(\right)\\
\frac{\log \tanh \left(t\_0 \cdot f\right)}{t\_0}
\end{array}
\end{array}
Derivation
  1. Initial program 6.7%

    \[-\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-neg.f64N/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)}\right) \]
    3. *-commutativeN/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right) \cdot \frac{1}{\frac{\mathsf{PI}\left(\right)}{4}}}\right) \]
    4. lift-/.f64N/A

      \[\leadsto \mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right) \cdot \color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}}}\right) \]
    5. un-div-invN/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)}{\frac{\mathsf{PI}\left(\right)}{4}}}\right) \]
  4. Applied rewrites99.1%

    \[\leadsto \color{blue}{\frac{\log \tanh \left(f \cdot \left(0.25 \cdot \mathsf{PI}\left(\right)\right)\right)}{0.25 \cdot \mathsf{PI}\left(\right)}} \]
  5. Final simplification99.1%

    \[\leadsto \frac{\log \tanh \left(\left(0.25 \cdot \mathsf{PI}\left(\right)\right) \cdot f\right)}{0.25 \cdot \mathsf{PI}\left(\right)} \]
  6. Add Preprocessing

Alternative 5: 98.8% accurate, 2.7× speedup?

\[\begin{array}{l} \\ \log \tanh \left(\left(0.25 \cdot \mathsf{PI}\left(\right)\right) \cdot f\right) \cdot \frac{4}{\mathsf{PI}\left(\right)} \end{array} \]
(FPCore (f)
 :precision binary64
 (* (log (tanh (* (* 0.25 (PI)) f))) (/ 4.0 (PI))))
\begin{array}{l}

\\
\log \tanh \left(\left(0.25 \cdot \mathsf{PI}\left(\right)\right) \cdot f\right) \cdot \frac{4}{\mathsf{PI}\left(\right)}
\end{array}
Derivation
  1. Initial program 6.7%

    \[-\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-neg.f64N/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)}\right) \]
    3. distribute-rgt-neg-inN/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \left(\mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)\right)} \]
    4. lower-*.f64N/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \left(\mathsf{neg}\left(\log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right)\right)\right)} \]
  4. Applied rewrites98.9%

    \[\leadsto \color{blue}{\frac{4}{\mathsf{PI}\left(\right)} \cdot \log \tanh \left(f \cdot \left(0.25 \cdot \mathsf{PI}\left(\right)\right)\right)} \]
  5. Final simplification98.9%

    \[\leadsto \log \tanh \left(\left(0.25 \cdot \mathsf{PI}\left(\right)\right) \cdot f\right) \cdot \frac{4}{\mathsf{PI}\left(\right)} \]
  6. Add Preprocessing

Alternative 6: 95.9% accurate, 4.0× speedup?

\[\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)}{-0.25 \cdot \mathsf{PI}\left(\right)} \end{array} \]
(FPCore (f)
 :precision binary64
 (/
  (log (/ (fma (* (* 0.08333333333333333 (PI)) f) f (/ 4.0 (PI))) f))
  (* -0.25 (PI))))
\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)}{-0.25 \cdot \mathsf{PI}\left(\right)}
\end{array}
Derivation
  1. Initial program 6.7%

    \[-\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right) \]
  2. Add Preprocessing
  3. Taylor expanded in f around 0

    \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \color{blue}{\left(\frac{f \cdot \left(\frac{-1}{4} \cdot \frac{\mathsf{PI}\left(\right)}{\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)} + \left(\frac{1}{4} \cdot \frac{\mathsf{PI}\left(\right)}{\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)} + f \cdot \left(\frac{1}{16} \cdot \frac{{\mathsf{PI}\left(\right)}^{2}}{\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)} - 2 \cdot \frac{\frac{1}{384} \cdot {\mathsf{PI}\left(\right)}^{3} - \frac{-1}{384} \cdot {\mathsf{PI}\left(\right)}^{3}}{{\left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right)}^{2}}\right)\right)\right) + 2 \cdot \frac{1}{\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)}}{f}\right)} \]
  4. Applied rewrites95.4%

    \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \color{blue}{\left(\frac{\mathsf{fma}\left(\mathsf{fma}\left(-2, \left(\left(\mathsf{PI}\left(\right) \cdot 2\right) \cdot 2\right) \cdot 0.005208333333333333, \left(0.0625 \cdot \mathsf{PI}\left(\right)\right) \cdot 2\right) \cdot f, f, \frac{4}{\mathsf{PI}\left(\right)}\right)}{f}\right)} \]
  5. Taylor expanded in f around 0

    \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(f \cdot \left(\frac{-1}{24} \cdot \mathsf{PI}\left(\right) + \frac{1}{8} \cdot \mathsf{PI}\left(\right)\right), f, \frac{4}{\mathsf{PI}\left(\right)}\right)}{f}\right) \]
  6. Step-by-step derivation
    1. Applied rewrites95.4%

      \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \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) \]
    2. Step-by-step derivation
      1. lift-neg.f64N/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(\left(\frac{1}{12} \cdot \mathsf{PI}\left(\right)\right) \cdot f, f, \frac{4}{\mathsf{PI}\left(\right)}\right)}{f}\right)\right)} \]
      2. lift-*.f64N/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(\left(\frac{1}{12} \cdot \mathsf{PI}\left(\right)\right) \cdot f, f, \frac{4}{\mathsf{PI}\left(\right)}\right)}{f}\right)}\right) \]
    3. Applied rewrites95.5%

      \[\leadsto \color{blue}{\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)}{-0.25 \cdot \mathsf{PI}\left(\right)}} \]
    4. Add Preprocessing

    Alternative 7: 95.4% accurate, 4.8× speedup?

    \[\begin{array}{l} \\ \frac{\log \left(0.25 \cdot \left(f \cdot \mathsf{PI}\left(\right)\right)\right)}{0.25 \cdot \mathsf{PI}\left(\right)} \end{array} \]
    (FPCore (f) :precision binary64 (/ (log (* 0.25 (* f (PI)))) (* 0.25 (PI))))
    \begin{array}{l}
    
    \\
    \frac{\log \left(0.25 \cdot \left(f \cdot \mathsf{PI}\left(\right)\right)\right)}{0.25 \cdot \mathsf{PI}\left(\right)}
    \end{array}
    
    Derivation
    1. Initial program 6.7%

      \[-\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} + e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}{e^{\frac{\mathsf{PI}\left(\right)}{4} \cdot f} - e^{-\frac{\mathsf{PI}\left(\right)}{4} \cdot f}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in f around 0

      \[\leadsto \color{blue}{-4 \cdot \frac{\log \left(\frac{2}{\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)}\right) + -1 \cdot \log f}{\mathsf{PI}\left(\right)}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{\log \left(\frac{2}{\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)}\right) + -1 \cdot \log f}{\mathsf{PI}\left(\right)} \cdot -4} \]
      2. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{\left(\log \left(\frac{2}{\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)}\right) + -1 \cdot \log f\right) \cdot -4}{\mathsf{PI}\left(\right)}} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{\left(\log \left(\frac{2}{\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)}\right) + -1 \cdot \log f\right) \cdot \frac{-4}{\mathsf{PI}\left(\right)}} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\log \left(\frac{2}{\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)}\right) + -1 \cdot \log f\right) \cdot \frac{-4}{\mathsf{PI}\left(\right)}} \]
    5. Applied rewrites95.5%

      \[\leadsto \color{blue}{\left(\log \left(\frac{4}{\mathsf{PI}\left(\right)}\right) - \log f\right) \cdot \frac{-4}{\mathsf{PI}\left(\right)}} \]
    6. Step-by-step derivation
      1. Applied rewrites95.4%

        \[\leadsto \frac{\log \left(\frac{f}{\frac{4}{\mathsf{PI}\left(\right)}}\right)}{\color{blue}{0.25 \cdot \mathsf{PI}\left(\right)}} \]
      2. Step-by-step derivation
        1. Applied rewrites95.4%

          \[\leadsto \frac{\log \left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot 0.25\right)}{0.25 \cdot \mathsf{PI}\left(\right)} \]
        2. Final simplification95.4%

          \[\leadsto \frac{\log \left(0.25 \cdot \left(f \cdot \mathsf{PI}\left(\right)\right)\right)}{0.25 \cdot \mathsf{PI}\left(\right)} \]
        3. Add Preprocessing

        Reproduce

        ?
        herbie shell --seed 2024255 
        (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)))))))))