VandenBroeck and Keller, Equation (20)

Percentage Accurate: 7.0% → 96.8%
Time: 11.6s
Alternatives: 4
Speedup: 4.6×

Specification

?
\[\mathsf{TRUE}\left(\right)\]
\[\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 4 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: 7.0% 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: 96.8% accurate, 1.8× speedup?

\[\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} \]
(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}
Derivation
  1. Initial program 8.1%

    \[-\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 inf

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

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

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

    \[\leadsto \color{blue}{\frac{\log \left(\frac{2 \cdot \cosh \left(\left(\mathsf{PI}\left(\right) \cdot f\right) \cdot -0.25\right)}{2 \cdot \sinh \left(\left(\mathsf{PI}\left(\right) \cdot f\right) \cdot 0.25\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4} \]
  6. Applied rewrites97.6%

    \[\leadsto \frac{\log \left(\frac{\cosh \left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot 0.25\right)}{\sinh \left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot 0.25\right)}\right) \cdot -4}{\color{blue}{\mathsf{PI}\left(\right)}} \]
  7. Add Preprocessing

Alternative 2: 96.1% accurate, 3.9× 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)}{-\mathsf{PI}\left(\right)} \cdot 4 \end{array} \]
(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}
Derivation
  1. Initial program 8.1%

    \[-\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 rewrites96.6%

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

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

      \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\left(\frac{-1}{24} \cdot \mathsf{PI}\left(\right) + \frac{1}{8} \cdot \mathsf{PI}\left(\right)\right) \cdot {f}^{2} + 4 \cdot \frac{1}{\mathsf{PI}\left(\right)}}{f}\right) \]
    2. lower-fma.f64N/A

      \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(\frac{-1}{24} \cdot \mathsf{PI}\left(\right) + \frac{1}{8} \cdot \mathsf{PI}\left(\right), {f}^{2}, 4 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}{f}\right) \]
    3. distribute-rgt-outN/A

      \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \left(\frac{-1}{24} + \frac{1}{8}\right), {f}^{2}, 4 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}{f}\right) \]
    4. lower-*.f64N/A

      \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \left(\frac{-1}{24} + \frac{1}{8}\right), {f}^{2}, 4 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}{f}\right) \]
    5. lift-PI.f64N/A

      \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \left(\frac{-1}{24} + \frac{1}{8}\right), {f}^{2}, 4 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}{f}\right) \]
    6. metadata-evalN/A

      \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \frac{1}{12}, {f}^{2}, 4 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}{f}\right) \]
    7. unpow2N/A

      \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \frac{1}{12}, f \cdot f, 4 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}{f}\right) \]
    8. lower-*.f64N/A

      \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \frac{1}{12}, f \cdot f, 4 \cdot \frac{1}{\mathsf{PI}\left(\right)}\right)}{f}\right) \]
    9. associate-*r/N/A

      \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \frac{1}{12}, f \cdot f, \frac{4 \cdot 1}{\mathsf{PI}\left(\right)}\right)}{f}\right) \]
    10. metadata-evalN/A

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

      \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \frac{1}{12}, f \cdot f, \frac{4}{\mathsf{PI}\left(\right)}\right)}{f}\right) \]
    12. lift-PI.f6496.6

      \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot 0.08333333333333333, f \cdot f, \frac{4}{\mathsf{PI}\left(\right)}\right)}{f}\right) \]
  7. Applied rewrites96.6%

    \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\frac{\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot 0.08333333333333333, f \cdot f, \frac{4}{\mathsf{PI}\left(\right)}\right)}{f}\right) \]
  8. Applied rewrites96.8%

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

      \[\leadsto -\color{blue}{\frac{1 \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)}{\frac{\mathsf{PI}\left(\right)}{4}}} \]
    2. lift-PI.f64N/A

      \[\leadsto -\frac{1 \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)}{\frac{\color{blue}{\mathsf{PI}\left(\right)}}{4}} \]
    3. lift-/.f64N/A

      \[\leadsto -\frac{1 \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)}{\color{blue}{\frac{\mathsf{PI}\left(\right)}{4}}} \]
  10. Applied rewrites96.8%

    \[\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)}{\mathsf{PI}\left(\right)} \cdot 4} \]
  11. Final simplification96.8%

    \[\leadsto \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 \]
  12. Add Preprocessing

Alternative 3: 95.4% accurate, 4.4× speedup?

\[\begin{array}{l} \\ \frac{\log \left(\frac{\frac{4}{f}}{\mathsf{PI}\left(\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \end{array} \]
(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}
Derivation
  1. Initial program 8.1%

    \[-\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 \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 \color{blue}{-4} \]
    2. lower-*.f64N/A

      \[\leadsto \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 \color{blue}{-4} \]
  5. Applied rewrites96.1%

    \[\leadsto \color{blue}{\frac{\log \left(\frac{2}{\left(\mathsf{PI}\left(\right) \cdot 0.5\right) \cdot f}\right)}{\mathsf{PI}\left(\right)} \cdot -4} \]
  6. Taylor expanded in f around 0

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

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

      \[\leadsto \frac{\log \left(\frac{4}{f \cdot \mathsf{PI}\left(\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    3. lift-PI.f6496.1

      \[\leadsto \frac{\log \left(\frac{4}{f \cdot \mathsf{PI}\left(\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
  8. Applied rewrites96.1%

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

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

      \[\leadsto \frac{\log \left(\frac{4}{f \cdot \mathsf{PI}\left(\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    3. lift-*.f64N/A

      \[\leadsto \frac{\log \left(\frac{4}{f \cdot \mathsf{PI}\left(\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    4. associate-/r*N/A

      \[\leadsto \frac{\log \left(\frac{\frac{4}{f}}{\mathsf{PI}\left(\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    5. lower-/.f64N/A

      \[\leadsto \frac{\log \left(\frac{\frac{4}{f}}{\mathsf{PI}\left(\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    6. lower-/.f64N/A

      \[\leadsto \frac{\log \left(\frac{\frac{4}{f}}{\mathsf{PI}\left(\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    7. lift-PI.f6496.1

      \[\leadsto \frac{\log \left(\frac{\frac{4}{f}}{\mathsf{PI}\left(\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
  10. Applied rewrites96.1%

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

Alternative 4: 95.5% accurate, 4.6× speedup?

\[\begin{array}{l} \\ \frac{\log \left(\frac{4}{f \cdot \mathsf{PI}\left(\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \end{array} \]
(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}
Derivation
  1. Initial program 8.1%

    \[-\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 \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 \color{blue}{-4} \]
    2. lower-*.f64N/A

      \[\leadsto \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 \color{blue}{-4} \]
  5. Applied rewrites96.1%

    \[\leadsto \color{blue}{\frac{\log \left(\frac{2}{\left(\mathsf{PI}\left(\right) \cdot 0.5\right) \cdot f}\right)}{\mathsf{PI}\left(\right)} \cdot -4} \]
  6. Taylor expanded in f around 0

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

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

      \[\leadsto \frac{\log \left(\frac{4}{f \cdot \mathsf{PI}\left(\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    3. lift-PI.f6496.1

      \[\leadsto \frac{\log \left(\frac{4}{f \cdot \mathsf{PI}\left(\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
  8. Applied rewrites96.1%

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

Reproduce

?
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)))))))))