VandenBroeck and Keller, Equation (20)

Percentage Accurate: 6.6% → 97.1%
Time: 12.3s
Alternatives: 7
Speedup: 4.6×

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.6% 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: 97.1% accurate, 1.4× speedup?

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

\\
\frac{\log \cosh \left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot -0.25\right) - \log \sinh \left(\left(0.25 \cdot f\right) \cdot \mathsf{PI}\left(\right)\right)}{\mathsf{PI}\left(\right)} \cdot -4
\end{array}
Derivation
  1. Initial program 7.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 rewrites98.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 rewrites98.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\log \left(\frac{\cosh \left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{4}\right)}{\sinh \left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{4}\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    11. log-divN/A

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

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

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

Alternative 2: 97.1% 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)}{\mathsf{PI}\left(\right)} \cdot -4 \end{array} \end{array} \]
(FPCore (f)
 :precision binary64
 (let* ((t_0 (* (* f (PI)) 0.25)))
   (* (/ (log (/ (cosh t_0) (sinh t_0))) (PI)) -4.0)))
\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)}{\mathsf{PI}\left(\right)} \cdot -4
\end{array}
\end{array}
Derivation
  1. Initial program 7.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 rewrites98.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 rewrites98.6%

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

Alternative 3: 96.5% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \frac{{\left(f \cdot \mathsf{PI}\left(\right)\right)}^{2} \cdot 0.03125 - \log \sinh \left(\left(0.25 \cdot f\right) \cdot \mathsf{PI}\left(\right)\right)}{\mathsf{PI}\left(\right)} \cdot -4 \end{array} \]
(FPCore (f)
 :precision binary64
 (*
  (/
   (- (* (pow (* f (PI)) 2.0) 0.03125) (log (sinh (* (* 0.25 f) (PI)))))
   (PI))
  -4.0))
\begin{array}{l}

\\
\frac{{\left(f \cdot \mathsf{PI}\left(\right)\right)}^{2} \cdot 0.03125 - \log \sinh \left(\left(0.25 \cdot f\right) \cdot \mathsf{PI}\left(\right)\right)}{\mathsf{PI}\left(\right)} \cdot -4
\end{array}
Derivation
  1. Initial program 7.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 rewrites98.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 rewrites98.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\log \left(\frac{\cosh \left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{4}\right)}{\sinh \left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{4}\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    11. log-divN/A

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

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

    \[\leadsto \frac{\log \cosh \left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot -0.25\right) - \log \sinh \left(\left(0.25 \cdot f\right) \cdot \mathsf{PI}\left(\right)\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
  9. Taylor expanded in f around 0

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

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

      \[\leadsto \frac{\left({f}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) \cdot \frac{1}{32} - \log \sinh \left(\left(\frac{1}{4} \cdot f\right) \cdot \mathsf{PI}\left(\right)\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    3. pow-prod-downN/A

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

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

      \[\leadsto \frac{{\left(f \cdot \mathsf{PI}\left(\right)\right)}^{2} \cdot \frac{1}{32} - \log \sinh \left(\left(\frac{1}{4} \cdot f\right) \cdot \mathsf{PI}\left(\right)\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    6. lift-PI.f6497.8

      \[\leadsto \frac{{\left(f \cdot \mathsf{PI}\left(\right)\right)}^{2} \cdot 0.03125 - \log \sinh \left(\left(0.25 \cdot f\right) \cdot \mathsf{PI}\left(\right)\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
  11. Applied rewrites97.8%

    \[\leadsto \frac{{\left(f \cdot \mathsf{PI}\left(\right)\right)}^{2} \cdot 0.03125 - \log \sinh \left(\left(0.25 \cdot f\right) \cdot \mathsf{PI}\left(\right)\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
  12. Add Preprocessing

Alternative 4: 96.0% accurate, 2.7× speedup?

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

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

    \[\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. Step-by-step derivation
    1. lift-log.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\log 2 - \log \left(\left(\mathsf{PI}\left(\right) \cdot \left(\frac{1}{4} - \frac{-1}{4}\right)\right) \cdot f\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    10. distribute-rgt-out--N/A

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

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

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

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

      \[\leadsto \frac{\log 2 - \log \left(\left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right) \cdot f\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    15. distribute-rgt-out--N/A

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

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

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

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

      \[\leadsto \frac{\log 2 - \log \left(\left(0.5 \cdot \mathsf{PI}\left(\right)\right) \cdot f\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
  7. Applied rewrites97.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\log \left(\frac{\frac{4}{\mathsf{PI}\left(\right)}}{f}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    11. metadata-evalN/A

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

      \[\leadsto \frac{\log \left(\frac{4 \cdot \frac{1}{\mathsf{PI}\left(\right)}}{f}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    13. *-commutativeN/A

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

      \[\leadsto \frac{\log \left(\frac{\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}}}{f}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    15. log-divN/A

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

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

Alternative 5: 96.0% accurate, 4.6× speedup?

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

\\
\frac{-\log \left(\left(\left(0.5 \cdot \mathsf{PI}\left(\right)\right) \cdot 0.5\right) \cdot f\right)}{\mathsf{PI}\left(\right)} \cdot -4
\end{array}
Derivation
  1. Initial program 7.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 rewrites98.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 rewrites98.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\log \left(\frac{\cosh \left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{4}\right)}{\sinh \left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{4}\right)}\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    11. log-divN/A

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

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

    \[\leadsto \frac{\log \cosh \left(\left(f \cdot \mathsf{PI}\left(\right)\right) \cdot -0.25\right) - \log \sinh \left(\left(0.25 \cdot f\right) \cdot \mathsf{PI}\left(\right)\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
  9. Taylor expanded in f around 0

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

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

      \[\leadsto \frac{-\left(\log f + \log \left(\frac{1}{2} \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right)\right)\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    3. +-commutativeN/A

      \[\leadsto \frac{-\left(\log \left(\frac{1}{2} \cdot \left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right)\right) + \log f\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    4. sum-logN/A

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

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

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

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

      \[\leadsto \frac{-\log \left(\left(\left(\frac{1}{4} \cdot \mathsf{PI}\left(\right) - \frac{-1}{4} \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{2}\right) \cdot f\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
    9. distribute-rgt-out--N/A

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

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

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

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

      \[\leadsto \frac{-\log \left(\left(\left(0.5 \cdot \mathsf{PI}\left(\right)\right) \cdot 0.5\right) \cdot f\right)}{\mathsf{PI}\left(\right)} \cdot -4 \]
  11. Applied rewrites97.4%

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

Alternative 6: 95.9% 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 7.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 rewrites97.4%

    \[\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.f6497.4

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

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

Alternative 7: 1.6% accurate, 4.8× speedup?

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

\\
\frac{-4}{\mathsf{PI}\left(\right)} \cdot \log \left(\left(0.08333333333333333 \cdot \mathsf{PI}\left(\right)\right) \cdot f\right)
\end{array}
Derivation
  1. Initial program 7.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 rewrites97.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. Applied rewrites97.7%

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

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

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

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

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

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

      \[\leadsto -\frac{1}{\frac{\mathsf{PI}\left(\right)}{4}} \cdot \log \left(\left(\mathsf{PI}\left(\right) \cdot \left(\frac{-1}{24} + \frac{1}{8}\right)\right) \cdot f\right) \]
    6. metadata-eval1.6

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

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

    \[\leadsto \color{blue}{\frac{4}{\mathsf{PI}\left(\right)} \cdot \left(-\log \left(\left(0.08333333333333333 \cdot \mathsf{PI}\left(\right)\right) \cdot f\right)\right)} \]
  10. Final simplification1.6%

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

Reproduce

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