VandenBroeck and Keller, Equation (6)

Percentage Accurate: 76.5% → 98.9%
Time: 8.0s
Alternatives: 12
Speedup: 3.7×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot \ell\\ t\_0 - \frac{1}{F \cdot F} \cdot \tan t\_0 \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (let* ((t_0 (* (PI) l))) (- t_0 (* (/ 1.0 (* F F)) (tan t_0)))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \ell\\
t\_0 - \frac{1}{F \cdot F} \cdot \tan t\_0
\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 12 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: 76.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot \ell\\ t\_0 - \frac{1}{F \cdot F} \cdot \tan t\_0 \end{array} \end{array} \]
(FPCore (F l)
 :precision binary64
 (let* ((t_0 (* (PI) l))) (- t_0 (* (/ 1.0 (* F F)) (tan t_0)))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \ell\\
t\_0 - \frac{1}{F \cdot F} \cdot \tan t\_0
\end{array}
\end{array}

Alternative 1: 98.9% accurate, 0.9× speedup?

\[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000000:\\ \;\;\;\;\frac{\tan t\_0 \cdot \frac{-1}{F}}{F} + t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
 :precision binary64
 (let* ((t_0 (* l_m (PI))))
   (*
    l_s
    (if (<= t_0 50000000.0) (+ (/ (* (tan t_0) (/ -1.0 F)) F) t_0) t_0))))
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)

\\
\begin{array}{l}
t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 50000000:\\
\;\;\;\;\frac{\tan t\_0 \cdot \frac{-1}{F}}{F} + t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (PI.f64) l) < 5e7

    1. Initial program 73.8%

      \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \]
      2. lift-/.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{1}{F \cdot F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
      3. lift-*.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{1}{\color{blue}{F \cdot F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
      4. associate-/r*N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\frac{1}{F}}{F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
      5. frac-2negN/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{F}\right)}{\mathsf{neg}\left(F\right)}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
      6. associate-*l/N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\left(\mathsf{neg}\left(\frac{1}{F}\right)\right) \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)}} \]
      7. lower-/.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\left(\mathsf{neg}\left(\frac{1}{F}\right)\right) \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)}} \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\left(\mathsf{neg}\left(\frac{1}{F}\right)\right) \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}}{\mathsf{neg}\left(F\right)} \]
      9. distribute-neg-fracN/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{\mathsf{neg}\left(1\right)}{F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)} \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\color{blue}{-1}}{F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)} \]
      11. lower-/.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{-1}{F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)} \]
      12. lift-*.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F} \cdot \tan \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \ell\right)}}{\mathsf{neg}\left(F\right)} \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F} \cdot \tan \color{blue}{\left(\ell \cdot \mathsf{PI}\left(\right)\right)}}{\mathsf{neg}\left(F\right)} \]
      14. lower-*.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F} \cdot \tan \color{blue}{\left(\ell \cdot \mathsf{PI}\left(\right)\right)}}{\mathsf{neg}\left(F\right)} \]
      15. lower-neg.f6484.8

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F} \cdot \tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{\color{blue}{-F}} \]
    4. Applied rewrites84.8%

      \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\frac{-1}{F} \cdot \tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{-F}} \]

    if 5e7 < (*.f64 (PI.f64) l)

    1. Initial program 69.9%

      \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
    2. Add Preprocessing
    3. Taylor expanded in F around inf

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

        \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
      3. lower-PI.f6499.9

        \[\leadsto \color{blue}{\mathsf{PI}\left(\right)} \cdot \ell \]
    5. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \mathsf{PI}\left(\right) \leq 50000000:\\ \;\;\;\;\frac{\tan \left(\ell \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{-1}{F}}{F} + \ell \cdot \mathsf{PI}\left(\right)\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \mathsf{PI}\left(\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 88.6% accurate, 0.8× speedup?

\[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 - \tan t\_0 \cdot \frac{1}{F \cdot F} \leq -1 \cdot 10^{-165}:\\ \;\;\;\;\frac{-\mathsf{PI}\left(\right)}{F} \cdot \frac{l\_m}{F}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
l\_m = (fabs.f64 l)
l\_s = (copysign.f64 #s(literal 1 binary64) l)
(FPCore (l_s F l_m)
 :precision binary64
 (let* ((t_0 (* l_m (PI))))
   (*
    l_s
    (if (<= (- t_0 (* (tan t_0) (/ 1.0 (* F F)))) -1e-165)
      (* (/ (- (PI)) F) (/ l_m F))
      t_0))))
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)

\\
\begin{array}{l}
t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 - \tan t\_0 \cdot \frac{1}{F \cdot F} \leq -1 \cdot 10^{-165}:\\
\;\;\;\;\frac{-\mathsf{PI}\left(\right)}{F} \cdot \frac{l\_m}{F}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) < -1e-165

    1. Initial program 68.2%

      \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \]
      2. lift-/.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{1}{F \cdot F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
      3. lift-*.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{1}{\color{blue}{F \cdot F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
      4. associate-/r*N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\frac{1}{F}}{F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
      5. frac-2negN/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{F}\right)}{\mathsf{neg}\left(F\right)}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
      6. associate-*l/N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\left(\mathsf{neg}\left(\frac{1}{F}\right)\right) \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)}} \]
      7. lower-/.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\left(\mathsf{neg}\left(\frac{1}{F}\right)\right) \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)}} \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\left(\mathsf{neg}\left(\frac{1}{F}\right)\right) \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}}{\mathsf{neg}\left(F\right)} \]
      9. distribute-neg-fracN/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{\mathsf{neg}\left(1\right)}{F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)} \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\color{blue}{-1}}{F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)} \]
      11. lower-/.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{-1}{F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)} \]
      12. lift-*.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F} \cdot \tan \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \ell\right)}}{\mathsf{neg}\left(F\right)} \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F} \cdot \tan \color{blue}{\left(\ell \cdot \mathsf{PI}\left(\right)\right)}}{\mathsf{neg}\left(F\right)} \]
      14. lower-*.f64N/A

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F} \cdot \tan \color{blue}{\left(\ell \cdot \mathsf{PI}\left(\right)\right)}}{\mathsf{neg}\left(F\right)} \]
      15. lower-neg.f6476.6

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F} \cdot \tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{\color{blue}{-F}} \]
    4. Applied rewrites76.6%

      \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\frac{-1}{F} \cdot \tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{-F}} \]
    5. Taylor expanded in l around 0

      \[\leadsto \color{blue}{\ell \cdot \left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{{F}^{2}}\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{{F}^{2}}\right) \cdot \ell} \]
      2. sub-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{PI}\left(\right) + \left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{{F}^{2}}\right)\right)\right)} \cdot \ell \]
      3. mul-1-negN/A

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

        \[\leadsto \color{blue}{\left(\mathsf{PI}\left(\right) + -1 \cdot \frac{\mathsf{PI}\left(\right)}{{F}^{2}}\right) \cdot \ell} \]
      5. mul-1-negN/A

        \[\leadsto \left(\mathsf{PI}\left(\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{\mathsf{PI}\left(\right)}{{F}^{2}}\right)\right)}\right) \cdot \ell \]
      6. sub-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{{F}^{2}}\right)} \cdot \ell \]
      7. lower--.f64N/A

        \[\leadsto \color{blue}{\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{{F}^{2}}\right)} \cdot \ell \]
      8. lower-PI.f64N/A

        \[\leadsto \left(\color{blue}{\mathsf{PI}\left(\right)} - \frac{\mathsf{PI}\left(\right)}{{F}^{2}}\right) \cdot \ell \]
      9. lower-/.f64N/A

        \[\leadsto \left(\mathsf{PI}\left(\right) - \color{blue}{\frac{\mathsf{PI}\left(\right)}{{F}^{2}}}\right) \cdot \ell \]
      10. lower-PI.f64N/A

        \[\leadsto \left(\mathsf{PI}\left(\right) - \frac{\color{blue}{\mathsf{PI}\left(\right)}}{{F}^{2}}\right) \cdot \ell \]
      11. unpow2N/A

        \[\leadsto \left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{\color{blue}{F \cdot F}}\right) \cdot \ell \]
      12. lower-*.f6459.1

        \[\leadsto \left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{\color{blue}{F \cdot F}}\right) \cdot \ell \]
    7. Applied rewrites59.1%

      \[\leadsto \color{blue}{\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F \cdot F}\right) \cdot \ell} \]
    8. Taylor expanded in F around 0

      \[\leadsto -1 \cdot \color{blue}{\frac{\ell \cdot \mathsf{PI}\left(\right)}{{F}^{2}}} \]
    9. Step-by-step derivation
      1. Applied rewrites21.8%

        \[\leadsto \frac{-\ell}{F} \cdot \color{blue}{\frac{\mathsf{PI}\left(\right)}{F}} \]

      if -1e-165 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l))))

      1. Initial program 76.5%

        \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
      2. Add Preprocessing
      3. Taylor expanded in F around inf

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

          \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
        2. lower-*.f64N/A

          \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
        3. lower-PI.f6476.7

          \[\leadsto \color{blue}{\mathsf{PI}\left(\right)} \cdot \ell \]
      5. Applied rewrites76.7%

        \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
    10. Recombined 2 regimes into one program.
    11. Final simplification52.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \mathsf{PI}\left(\right) - \tan \left(\ell \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{1}{F \cdot F} \leq -1 \cdot 10^{-165}:\\ \;\;\;\;\frac{-\mathsf{PI}\left(\right)}{F} \cdot \frac{\ell}{F}\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \mathsf{PI}\left(\right)\\ \end{array} \]
    12. Add Preprocessing

    Alternative 3: 98.9% accurate, 0.9× speedup?

    \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000000:\\ \;\;\;\;t\_0 - \frac{\frac{\tan t\_0}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
    l\_m = (fabs.f64 l)
    l\_s = (copysign.f64 #s(literal 1 binary64) l)
    (FPCore (l_s F l_m)
     :precision binary64
     (let* ((t_0 (* l_m (PI))))
       (* l_s (if (<= t_0 50000000.0) (- t_0 (/ (/ (tan t_0) F) F)) t_0))))
    \begin{array}{l}
    l\_m = \left|\ell\right|
    \\
    l\_s = \mathsf{copysign}\left(1, \ell\right)
    
    \\
    \begin{array}{l}
    t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
    l\_s \cdot \begin{array}{l}
    \mathbf{if}\;t\_0 \leq 50000000:\\
    \;\;\;\;t\_0 - \frac{\frac{\tan t\_0}{F}}{F}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 (PI.f64) l) < 5e7

      1. Initial program 73.8%

        \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \frac{1}{F \cdot F}} \]
        3. lift-/.f64N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \color{blue}{\frac{1}{F \cdot F}} \]
        4. un-div-invN/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F \cdot F}} \]
        5. lift-*.f64N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\color{blue}{F \cdot F}} \]
        6. associate-/r*N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F}}{F}} \]
        7. lower-/.f64N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F}}{F}} \]
        8. lower-/.f6484.8

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F}}}{F} \]
        9. lift-*.f64N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\tan \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \ell\right)}}{F}}{F} \]
        10. *-commutativeN/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\tan \color{blue}{\left(\ell \cdot \mathsf{PI}\left(\right)\right)}}{F}}{F} \]
        11. lower-*.f6484.8

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\tan \color{blue}{\left(\ell \cdot \mathsf{PI}\left(\right)\right)}}{F}}{F} \]
      4. Applied rewrites84.8%

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\frac{\tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{F}}{F}} \]

      if 5e7 < (*.f64 (PI.f64) l)

      1. Initial program 69.9%

        \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
      2. Add Preprocessing
      3. Taylor expanded in F around inf

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

          \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
        2. lower-*.f64N/A

          \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
        3. lower-PI.f6499.9

          \[\leadsto \color{blue}{\mathsf{PI}\left(\right)} \cdot \ell \]
      5. Applied rewrites99.9%

        \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification88.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \mathsf{PI}\left(\right) \leq 50000000:\\ \;\;\;\;\ell \cdot \mathsf{PI}\left(\right) - \frac{\frac{\tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{F}}{F}\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \mathsf{PI}\left(\right)\\ \end{array} \]
    5. Add Preprocessing

    Alternative 4: 98.2% accurate, 1.6× speedup?

    \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 2000:\\ \;\;\;\;t\_0 - \frac{\frac{-1}{F}}{\frac{\mathsf{fma}\left(0.3333333333333333 \cdot \mathsf{PI}\left(\right), l\_m \cdot l\_m, \frac{-1}{\mathsf{PI}\left(\right)}\right) \cdot F}{l\_m}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
    l\_m = (fabs.f64 l)
    l\_s = (copysign.f64 #s(literal 1 binary64) l)
    (FPCore (l_s F l_m)
     :precision binary64
     (let* ((t_0 (* l_m (PI))))
       (*
        l_s
        (if (<= t_0 2000.0)
          (-
           t_0
           (/
            (/ -1.0 F)
            (/
             (* (fma (* 0.3333333333333333 (PI)) (* l_m l_m) (/ -1.0 (PI))) F)
             l_m)))
          t_0))))
    \begin{array}{l}
    l\_m = \left|\ell\right|
    \\
    l\_s = \mathsf{copysign}\left(1, \ell\right)
    
    \\
    \begin{array}{l}
    t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
    l\_s \cdot \begin{array}{l}
    \mathbf{if}\;t\_0 \leq 2000:\\
    \;\;\;\;t\_0 - \frac{\frac{-1}{F}}{\frac{\mathsf{fma}\left(0.3333333333333333 \cdot \mathsf{PI}\left(\right), l\_m \cdot l\_m, \frac{-1}{\mathsf{PI}\left(\right)}\right) \cdot F}{l\_m}}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 (PI.f64) l) < 2e3

      1. Initial program 73.7%

        \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \frac{1}{F \cdot F}} \]
        3. lift-/.f64N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \color{blue}{\frac{1}{F \cdot F}} \]
        4. lift-*.f64N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \frac{1}{\color{blue}{F \cdot F}} \]
        5. associate-/r*N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \color{blue}{\frac{\frac{1}{F}}{F}} \]
        6. lift-tan.f64N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \frac{\frac{1}{F}}{F} \]
        7. tan-quotN/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}} \cdot \frac{\frac{1}{F}}{F} \]
        8. frac-2negN/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{F}\right)}{\mathsf{neg}\left(F\right)}} \]
        9. clear-numN/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{1}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}}} \cdot \frac{\mathsf{neg}\left(\frac{1}{F}\right)}{\mathsf{neg}\left(F\right)} \]
        10. frac-timesN/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{1 \cdot \left(\mathsf{neg}\left(\frac{1}{F}\right)\right)}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)}} \]
        11. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\mathsf{neg}\left(1 \cdot \frac{1}{F}\right)}}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)} \]
        12. div-invN/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\mathsf{neg}\left(\color{blue}{\frac{1}{F}}\right)}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)} \]
        13. lower-/.f64N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{F}\right)}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)}} \]
        14. distribute-neg-fracN/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{\mathsf{neg}\left(1\right)}{F}}}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)} \]
        15. metadata-evalN/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\color{blue}{-1}}{F}}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)} \]
        16. lower-/.f64N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{-1}{F}}}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)} \]
        17. lower-*.f64N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\color{blue}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)}} \]
      4. Applied rewrites84.8%

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\frac{-1}{F}}{\frac{1}{\tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(-F\right)}} \]
      5. Taylor expanded in l around 0

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\color{blue}{\frac{-1 \cdot \frac{F}{\mathsf{PI}\left(\right)} + \frac{F \cdot \left({\ell}^{2} \cdot \left(\frac{-1}{6} \cdot {\mathsf{PI}\left(\right)}^{3} - \frac{-1}{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)}{{\mathsf{PI}\left(\right)}^{2}}}{\ell}}} \]
      6. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\frac{\color{blue}{\frac{F \cdot \left({\ell}^{2} \cdot \left(\frac{-1}{6} \cdot {\mathsf{PI}\left(\right)}^{3} - \frac{-1}{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)}{{\mathsf{PI}\left(\right)}^{2}} + -1 \cdot \frac{F}{\mathsf{PI}\left(\right)}}}{\ell}} \]
        2. *-commutativeN/A

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

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\frac{\frac{\color{blue}{{\ell}^{2} \cdot \left(\left(\frac{-1}{6} \cdot {\mathsf{PI}\left(\right)}^{3} - \frac{-1}{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) \cdot F\right)}}{{\mathsf{PI}\left(\right)}^{2}} + -1 \cdot \frac{F}{\mathsf{PI}\left(\right)}}{\ell}} \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\frac{\frac{{\ell}^{2} \cdot \color{blue}{\left(F \cdot \left(\frac{-1}{6} \cdot {\mathsf{PI}\left(\right)}^{3} - \frac{-1}{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)}}{{\mathsf{PI}\left(\right)}^{2}} + -1 \cdot \frac{F}{\mathsf{PI}\left(\right)}}{\ell}} \]
        5. associate-*r/N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\frac{\color{blue}{{\ell}^{2} \cdot \frac{F \cdot \left(\frac{-1}{6} \cdot {\mathsf{PI}\left(\right)}^{3} - \frac{-1}{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{{\mathsf{PI}\left(\right)}^{2}}} + -1 \cdot \frac{F}{\mathsf{PI}\left(\right)}}{\ell}} \]
        6. lower-/.f64N/A

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\color{blue}{\frac{{\ell}^{2} \cdot \frac{F \cdot \left(\frac{-1}{6} \cdot {\mathsf{PI}\left(\right)}^{3} - \frac{-1}{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{{\mathsf{PI}\left(\right)}^{2}} + -1 \cdot \frac{F}{\mathsf{PI}\left(\right)}}{\ell}}} \]
      7. Applied rewrites90.5%

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\color{blue}{\frac{\mathsf{fma}\left(\frac{\left(\ell \cdot \ell\right) \cdot F}{\mathsf{PI}\left(\right)}, \frac{0.3333333333333333 \cdot {\mathsf{PI}\left(\right)}^{3}}{\mathsf{PI}\left(\right)}, \frac{-F}{\mathsf{PI}\left(\right)}\right)}{\ell}}} \]
      8. Taylor expanded in F around 0

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\frac{F \cdot \left(\frac{1}{3} \cdot \left({\ell}^{2} \cdot \mathsf{PI}\left(\right)\right) - \frac{1}{\mathsf{PI}\left(\right)}\right)}{\ell}} \]
      9. Step-by-step derivation
        1. Applied rewrites90.4%

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\frac{\mathsf{fma}\left(0.3333333333333333 \cdot \mathsf{PI}\left(\right), \ell \cdot \ell, \frac{-1}{\mathsf{PI}\left(\right)}\right) \cdot F}{\ell}} \]

        if 2e3 < (*.f64 (PI.f64) l)

        1. Initial program 70.3%

          \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
        2. Add Preprocessing
        3. Taylor expanded in F around inf

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

            \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
          2. lower-*.f64N/A

            \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
          3. lower-PI.f6498.3

            \[\leadsto \color{blue}{\mathsf{PI}\left(\right)} \cdot \ell \]
        5. Applied rewrites98.3%

          \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
      10. Recombined 2 regimes into one program.
      11. Final simplification92.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \mathsf{PI}\left(\right) \leq 2000:\\ \;\;\;\;\ell \cdot \mathsf{PI}\left(\right) - \frac{\frac{-1}{F}}{\frac{\mathsf{fma}\left(0.3333333333333333 \cdot \mathsf{PI}\left(\right), \ell \cdot \ell, \frac{-1}{\mathsf{PI}\left(\right)}\right) \cdot F}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \mathsf{PI}\left(\right)\\ \end{array} \]
      12. Add Preprocessing

      Alternative 5: 98.4% accurate, 2.0× speedup?

      \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000000:\\ \;\;\;\;t\_0 - \frac{\frac{-1}{F}}{\frac{\frac{-F}{\mathsf{PI}\left(\right)}}{l\_m}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
      l\_m = (fabs.f64 l)
      l\_s = (copysign.f64 #s(literal 1 binary64) l)
      (FPCore (l_s F l_m)
       :precision binary64
       (let* ((t_0 (* l_m (PI))))
         (*
          l_s
          (if (<= t_0 50000000.0)
            (- t_0 (/ (/ -1.0 F) (/ (/ (- F) (PI)) l_m)))
            t_0))))
      \begin{array}{l}
      l\_m = \left|\ell\right|
      \\
      l\_s = \mathsf{copysign}\left(1, \ell\right)
      
      \\
      \begin{array}{l}
      t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
      l\_s \cdot \begin{array}{l}
      \mathbf{if}\;t\_0 \leq 50000000:\\
      \;\;\;\;t\_0 - \frac{\frac{-1}{F}}{\frac{\frac{-F}{\mathsf{PI}\left(\right)}}{l\_m}}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (*.f64 (PI.f64) l) < 5e7

        1. Initial program 73.8%

          \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \]
          2. *-commutativeN/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \frac{1}{F \cdot F}} \]
          3. lift-/.f64N/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \color{blue}{\frac{1}{F \cdot F}} \]
          4. lift-*.f64N/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \frac{1}{\color{blue}{F \cdot F}} \]
          5. associate-/r*N/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \color{blue}{\frac{\frac{1}{F}}{F}} \]
          6. lift-tan.f64N/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \frac{\frac{1}{F}}{F} \]
          7. tan-quotN/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}} \cdot \frac{\frac{1}{F}}{F} \]
          8. frac-2negN/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{F}\right)}{\mathsf{neg}\left(F\right)}} \]
          9. clear-numN/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{1}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}}} \cdot \frac{\mathsf{neg}\left(\frac{1}{F}\right)}{\mathsf{neg}\left(F\right)} \]
          10. frac-timesN/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{1 \cdot \left(\mathsf{neg}\left(\frac{1}{F}\right)\right)}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)}} \]
          11. distribute-rgt-neg-inN/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\mathsf{neg}\left(1 \cdot \frac{1}{F}\right)}}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)} \]
          12. div-invN/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\mathsf{neg}\left(\color{blue}{\frac{1}{F}}\right)}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)} \]
          13. lower-/.f64N/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{F}\right)}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)}} \]
          14. distribute-neg-fracN/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{\mathsf{neg}\left(1\right)}{F}}}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)} \]
          15. metadata-evalN/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\color{blue}{-1}}{F}}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)} \]
          16. lower-/.f64N/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{-1}{F}}}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)} \]
          17. lower-*.f64N/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\color{blue}{\frac{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \cdot \left(\mathsf{neg}\left(F\right)\right)}} \]
        4. Applied rewrites84.7%

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\frac{-1}{F}}{\frac{1}{\tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)} \cdot \left(-F\right)}} \]
        5. Taylor expanded in l around 0

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\color{blue}{\frac{-1 \cdot \frac{F}{\mathsf{PI}\left(\right)} + \frac{F \cdot \left({\ell}^{2} \cdot \left(\frac{-1}{6} \cdot {\mathsf{PI}\left(\right)}^{3} - \frac{-1}{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)}{{\mathsf{PI}\left(\right)}^{2}}}{\ell}}} \]
        6. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\frac{\color{blue}{\frac{F \cdot \left({\ell}^{2} \cdot \left(\frac{-1}{6} \cdot {\mathsf{PI}\left(\right)}^{3} - \frac{-1}{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)}{{\mathsf{PI}\left(\right)}^{2}} + -1 \cdot \frac{F}{\mathsf{PI}\left(\right)}}}{\ell}} \]
          2. *-commutativeN/A

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

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\frac{\frac{\color{blue}{{\ell}^{2} \cdot \left(\left(\frac{-1}{6} \cdot {\mathsf{PI}\left(\right)}^{3} - \frac{-1}{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right) \cdot F\right)}}{{\mathsf{PI}\left(\right)}^{2}} + -1 \cdot \frac{F}{\mathsf{PI}\left(\right)}}{\ell}} \]
          4. *-commutativeN/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\frac{\frac{{\ell}^{2} \cdot \color{blue}{\left(F \cdot \left(\frac{-1}{6} \cdot {\mathsf{PI}\left(\right)}^{3} - \frac{-1}{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)\right)}}{{\mathsf{PI}\left(\right)}^{2}} + -1 \cdot \frac{F}{\mathsf{PI}\left(\right)}}{\ell}} \]
          5. associate-*r/N/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\frac{\color{blue}{{\ell}^{2} \cdot \frac{F \cdot \left(\frac{-1}{6} \cdot {\mathsf{PI}\left(\right)}^{3} - \frac{-1}{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{{\mathsf{PI}\left(\right)}^{2}}} + -1 \cdot \frac{F}{\mathsf{PI}\left(\right)}}{\ell}} \]
          6. lower-/.f64N/A

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\color{blue}{\frac{{\ell}^{2} \cdot \frac{F \cdot \left(\frac{-1}{6} \cdot {\mathsf{PI}\left(\right)}^{3} - \frac{-1}{2} \cdot {\mathsf{PI}\left(\right)}^{3}\right)}{{\mathsf{PI}\left(\right)}^{2}} + -1 \cdot \frac{F}{\mathsf{PI}\left(\right)}}{\ell}}} \]
        7. Applied rewrites90.1%

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\color{blue}{\frac{\mathsf{fma}\left(\frac{\left(\ell \cdot \ell\right) \cdot F}{\mathsf{PI}\left(\right)}, \frac{0.3333333333333333 \cdot {\mathsf{PI}\left(\right)}^{3}}{\mathsf{PI}\left(\right)}, \frac{-F}{\mathsf{PI}\left(\right)}\right)}{\ell}}} \]
        8. Taylor expanded in l around 0

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\frac{-1 \cdot \frac{F}{\mathsf{PI}\left(\right)}}{\ell}} \]
        9. Step-by-step derivation
          1. Applied rewrites79.1%

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F}}{\frac{\frac{-F}{\mathsf{PI}\left(\right)}}{\ell}} \]

          if 5e7 < (*.f64 (PI.f64) l)

          1. Initial program 69.9%

            \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
          2. Add Preprocessing
          3. Taylor expanded in F around inf

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

              \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
            2. lower-*.f64N/A

              \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
            3. lower-PI.f6499.9

              \[\leadsto \color{blue}{\mathsf{PI}\left(\right)} \cdot \ell \]
          5. Applied rewrites99.9%

            \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
        10. Recombined 2 regimes into one program.
        11. Final simplification84.0%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \mathsf{PI}\left(\right) \leq 50000000:\\ \;\;\;\;\ell \cdot \mathsf{PI}\left(\right) - \frac{\frac{-1}{F}}{\frac{\frac{-F}{\mathsf{PI}\left(\right)}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \mathsf{PI}\left(\right)\\ \end{array} \]
        12. Add Preprocessing

        Alternative 6: 98.4% accurate, 2.2× speedup?

        \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000000:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{F}{\mathsf{PI}\left(\right)}} \cdot l\_m, \frac{-1}{F}, t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
        l\_m = (fabs.f64 l)
        l\_s = (copysign.f64 #s(literal 1 binary64) l)
        (FPCore (l_s F l_m)
         :precision binary64
         (let* ((t_0 (* l_m (PI))))
           (*
            l_s
            (if (<= t_0 50000000.0)
              (fma (* (/ 1.0 (/ F (PI))) l_m) (/ -1.0 F) t_0)
              t_0))))
        \begin{array}{l}
        l\_m = \left|\ell\right|
        \\
        l\_s = \mathsf{copysign}\left(1, \ell\right)
        
        \\
        \begin{array}{l}
        t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
        l\_s \cdot \begin{array}{l}
        \mathbf{if}\;t\_0 \leq 50000000:\\
        \;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{F}{\mathsf{PI}\left(\right)}} \cdot l\_m, \frac{-1}{F}, t\_0\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (*.f64 (PI.f64) l) < 5e7

          1. Initial program 73.8%

            \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \]
            2. sub-negN/A

              \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell + \left(\mathsf{neg}\left(\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)\right)\right)} \]
            3. +-commutativeN/A

              \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)\right)\right) + \mathsf{PI}\left(\right) \cdot \ell} \]
            4. lift-*.f64N/A

              \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
            5. *-commutativeN/A

              \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \frac{1}{F \cdot F}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
            6. lift-/.f64N/A

              \[\leadsto \left(\mathsf{neg}\left(\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \color{blue}{\frac{1}{F \cdot F}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
            7. un-div-invN/A

              \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F \cdot F}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
            8. distribute-neg-frac2N/A

              \[\leadsto \color{blue}{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F \cdot F\right)}} + \mathsf{PI}\left(\right) \cdot \ell \]
            9. *-rgt-identityN/A

              \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}}{\mathsf{neg}\left(F \cdot F\right)} + \mathsf{PI}\left(\right) \cdot \ell \]
            10. lift-*.f64N/A

              \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}{\mathsf{neg}\left(\color{blue}{F \cdot F}\right)} + \mathsf{PI}\left(\right) \cdot \ell \]
            11. distribute-rgt-neg-inN/A

              \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}{\color{blue}{F \cdot \left(\mathsf{neg}\left(F\right)\right)}} + \mathsf{PI}\left(\right) \cdot \ell \]
            12. times-fracN/A

              \[\leadsto \color{blue}{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \frac{1}{\mathsf{neg}\left(F\right)}} + \mathsf{PI}\left(\right) \cdot \ell \]
            13. distribute-neg-frac2N/A

              \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{1}{F}\right)\right)} + \mathsf{PI}\left(\right) \cdot \ell \]
            14. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F}, \mathsf{neg}\left(\frac{1}{F}\right), \mathsf{PI}\left(\right) \cdot \ell\right)} \]
          4. Applied rewrites84.8%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right)} \]
          5. Step-by-step derivation
            1. lift-PI.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            2. add-sqr-sqrtN/A

              \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            3. lower-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            4. lift-PI.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \left(\sqrt{\color{blue}{\mathsf{PI}\left(\right)}} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            5. lower-sqrt.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \left(\color{blue}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            6. lift-PI.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\color{blue}{\mathsf{PI}\left(\right)}}\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            7. lower-sqrt.f6484.6

              \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \color{blue}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
          6. Applied rewrites84.6%

            \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
          7. Taylor expanded in l around 0

            \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\ell \cdot \mathsf{PI}\left(\right)}{F}}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
          8. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{PI}\left(\right) \cdot \ell}}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            2. associate-*l/N/A

              \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            3. lower-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            4. lower-/.f64N/A

              \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F}} \cdot \ell, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            5. lower-PI.f6479.1

              \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{PI}\left(\right)}}{F} \cdot \ell, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
          9. Applied rewrites79.1%

            \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
          10. Step-by-step derivation
            1. Applied rewrites79.1%

              \[\leadsto \mathsf{fma}\left(\frac{1}{\frac{F}{\mathsf{PI}\left(\right)}} \cdot \ell, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]

            if 5e7 < (*.f64 (PI.f64) l)

            1. Initial program 69.9%

              \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
            2. Add Preprocessing
            3. Taylor expanded in F around inf

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

                \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
              2. lower-*.f64N/A

                \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
              3. lower-PI.f6499.9

                \[\leadsto \color{blue}{\mathsf{PI}\left(\right)} \cdot \ell \]
            5. Applied rewrites99.9%

              \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
          11. Recombined 2 regimes into one program.
          12. Final simplification84.0%

            \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \mathsf{PI}\left(\right) \leq 50000000:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{F}{\mathsf{PI}\left(\right)}} \cdot \ell, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \mathsf{PI}\left(\right)\\ \end{array} \]
          13. Add Preprocessing

          Alternative 7: 98.4% accurate, 2.4× speedup?

          \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000000:\\ \;\;\;\;\mathsf{fma}\left(\frac{l\_m}{\frac{F}{\mathsf{PI}\left(\right)}}, \frac{-1}{F}, t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
          l\_m = (fabs.f64 l)
          l\_s = (copysign.f64 #s(literal 1 binary64) l)
          (FPCore (l_s F l_m)
           :precision binary64
           (let* ((t_0 (* l_m (PI))))
             (*
              l_s
              (if (<= t_0 50000000.0) (fma (/ l_m (/ F (PI))) (/ -1.0 F) t_0) t_0))))
          \begin{array}{l}
          l\_m = \left|\ell\right|
          \\
          l\_s = \mathsf{copysign}\left(1, \ell\right)
          
          \\
          \begin{array}{l}
          t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
          l\_s \cdot \begin{array}{l}
          \mathbf{if}\;t\_0 \leq 50000000:\\
          \;\;\;\;\mathsf{fma}\left(\frac{l\_m}{\frac{F}{\mathsf{PI}\left(\right)}}, \frac{-1}{F}, t\_0\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (*.f64 (PI.f64) l) < 5e7

            1. Initial program 73.8%

              \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift--.f64N/A

                \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \]
              2. sub-negN/A

                \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell + \left(\mathsf{neg}\left(\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)\right)\right)} \]
              3. +-commutativeN/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)\right)\right) + \mathsf{PI}\left(\right) \cdot \ell} \]
              4. lift-*.f64N/A

                \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
              5. *-commutativeN/A

                \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \frac{1}{F \cdot F}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
              6. lift-/.f64N/A

                \[\leadsto \left(\mathsf{neg}\left(\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \color{blue}{\frac{1}{F \cdot F}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
              7. un-div-invN/A

                \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F \cdot F}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
              8. distribute-neg-frac2N/A

                \[\leadsto \color{blue}{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F \cdot F\right)}} + \mathsf{PI}\left(\right) \cdot \ell \]
              9. *-rgt-identityN/A

                \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}}{\mathsf{neg}\left(F \cdot F\right)} + \mathsf{PI}\left(\right) \cdot \ell \]
              10. lift-*.f64N/A

                \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}{\mathsf{neg}\left(\color{blue}{F \cdot F}\right)} + \mathsf{PI}\left(\right) \cdot \ell \]
              11. distribute-rgt-neg-inN/A

                \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}{\color{blue}{F \cdot \left(\mathsf{neg}\left(F\right)\right)}} + \mathsf{PI}\left(\right) \cdot \ell \]
              12. times-fracN/A

                \[\leadsto \color{blue}{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \frac{1}{\mathsf{neg}\left(F\right)}} + \mathsf{PI}\left(\right) \cdot \ell \]
              13. distribute-neg-frac2N/A

                \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{1}{F}\right)\right)} + \mathsf{PI}\left(\right) \cdot \ell \]
              14. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F}, \mathsf{neg}\left(\frac{1}{F}\right), \mathsf{PI}\left(\right) \cdot \ell\right)} \]
            4. Applied rewrites84.8%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right)} \]
            5. Step-by-step derivation
              1. lift-PI.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              2. add-sqr-sqrtN/A

                \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              3. lower-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              4. lift-PI.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \left(\sqrt{\color{blue}{\mathsf{PI}\left(\right)}} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              5. lower-sqrt.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \left(\color{blue}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              6. lift-PI.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\color{blue}{\mathsf{PI}\left(\right)}}\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              7. lower-sqrt.f6484.6

                \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \color{blue}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            6. Applied rewrites84.6%

              \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            7. Taylor expanded in l around 0

              \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\ell \cdot \mathsf{PI}\left(\right)}{F}}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            8. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{PI}\left(\right) \cdot \ell}}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              2. associate-*l/N/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              3. lower-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              4. lower-/.f64N/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F}} \cdot \ell, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              5. lower-PI.f6479.1

                \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{PI}\left(\right)}}{F} \cdot \ell, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            9. Applied rewrites79.1%

              \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            10. Step-by-step derivation
              1. Applied rewrites79.1%

                \[\leadsto \mathsf{fma}\left(\frac{\ell}{\color{blue}{\frac{F}{\mathsf{PI}\left(\right)}}}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]

              if 5e7 < (*.f64 (PI.f64) l)

              1. Initial program 69.9%

                \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
              2. Add Preprocessing
              3. Taylor expanded in F around inf

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

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                2. lower-*.f64N/A

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                3. lower-PI.f6499.9

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right)} \cdot \ell \]
              5. Applied rewrites99.9%

                \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
            11. Recombined 2 regimes into one program.
            12. Final simplification84.0%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \mathsf{PI}\left(\right) \leq 50000000:\\ \;\;\;\;\mathsf{fma}\left(\frac{\ell}{\frac{F}{\mathsf{PI}\left(\right)}}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \mathsf{PI}\left(\right)\\ \end{array} \]
            13. Add Preprocessing

            Alternative 8: 98.4% accurate, 2.7× speedup?

            \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000000:\\ \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{F} \cdot l\_m, \frac{-1}{F}, t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
            l\_m = (fabs.f64 l)
            l\_s = (copysign.f64 #s(literal 1 binary64) l)
            (FPCore (l_s F l_m)
             :precision binary64
             (let* ((t_0 (* l_m (PI))))
               (*
                l_s
                (if (<= t_0 50000000.0) (fma (* (/ (PI) F) l_m) (/ -1.0 F) t_0) t_0))))
            \begin{array}{l}
            l\_m = \left|\ell\right|
            \\
            l\_s = \mathsf{copysign}\left(1, \ell\right)
            
            \\
            \begin{array}{l}
            t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
            l\_s \cdot \begin{array}{l}
            \mathbf{if}\;t\_0 \leq 50000000:\\
            \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{F} \cdot l\_m, \frac{-1}{F}, t\_0\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (*.f64 (PI.f64) l) < 5e7

              1. Initial program 73.8%

                \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift--.f64N/A

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \]
                2. sub-negN/A

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell + \left(\mathsf{neg}\left(\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)\right)\right)} \]
                3. +-commutativeN/A

                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)\right)\right) + \mathsf{PI}\left(\right) \cdot \ell} \]
                4. lift-*.f64N/A

                  \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
                5. *-commutativeN/A

                  \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \frac{1}{F \cdot F}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
                6. lift-/.f64N/A

                  \[\leadsto \left(\mathsf{neg}\left(\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \color{blue}{\frac{1}{F \cdot F}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
                7. un-div-invN/A

                  \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F \cdot F}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
                8. distribute-neg-frac2N/A

                  \[\leadsto \color{blue}{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F \cdot F\right)}} + \mathsf{PI}\left(\right) \cdot \ell \]
                9. *-rgt-identityN/A

                  \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}}{\mathsf{neg}\left(F \cdot F\right)} + \mathsf{PI}\left(\right) \cdot \ell \]
                10. lift-*.f64N/A

                  \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}{\mathsf{neg}\left(\color{blue}{F \cdot F}\right)} + \mathsf{PI}\left(\right) \cdot \ell \]
                11. distribute-rgt-neg-inN/A

                  \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}{\color{blue}{F \cdot \left(\mathsf{neg}\left(F\right)\right)}} + \mathsf{PI}\left(\right) \cdot \ell \]
                12. times-fracN/A

                  \[\leadsto \color{blue}{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \frac{1}{\mathsf{neg}\left(F\right)}} + \mathsf{PI}\left(\right) \cdot \ell \]
                13. distribute-neg-frac2N/A

                  \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{1}{F}\right)\right)} + \mathsf{PI}\left(\right) \cdot \ell \]
                14. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F}, \mathsf{neg}\left(\frac{1}{F}\right), \mathsf{PI}\left(\right) \cdot \ell\right)} \]
              4. Applied rewrites84.8%

                \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right)} \]
              5. Taylor expanded in l around 0

                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\ell \cdot \mathsf{PI}\left(\right)}{F}}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              6. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{PI}\left(\right) \cdot \ell}}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
                2. associate-*l/N/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
                3. lower-*.f64N/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
                4. lower-/.f64N/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F}} \cdot \ell, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
                5. lower-PI.f6479.1

                  \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{PI}\left(\right)}}{F} \cdot \ell, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              7. Applied rewrites79.1%

                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]

              if 5e7 < (*.f64 (PI.f64) l)

              1. Initial program 69.9%

                \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
              2. Add Preprocessing
              3. Taylor expanded in F around inf

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

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                2. lower-*.f64N/A

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                3. lower-PI.f6499.9

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right)} \cdot \ell \]
              5. Applied rewrites99.9%

                \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
            3. Recombined 2 regimes into one program.
            4. Final simplification84.0%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \mathsf{PI}\left(\right) \leq 50000000:\\ \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \mathsf{PI}\left(\right)\\ \end{array} \]
            5. Add Preprocessing

            Alternative 9: 98.4% accurate, 2.8× speedup?

            \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000000:\\ \;\;\;\;\frac{\frac{\left(-\mathsf{PI}\left(\right)\right) \cdot l\_m}{F}}{F} + t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
            l\_m = (fabs.f64 l)
            l\_s = (copysign.f64 #s(literal 1 binary64) l)
            (FPCore (l_s F l_m)
             :precision binary64
             (let* ((t_0 (* l_m (PI))))
               (* l_s (if (<= t_0 50000000.0) (+ (/ (/ (* (- (PI)) l_m) F) F) t_0) t_0))))
            \begin{array}{l}
            l\_m = \left|\ell\right|
            \\
            l\_s = \mathsf{copysign}\left(1, \ell\right)
            
            \\
            \begin{array}{l}
            t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
            l\_s \cdot \begin{array}{l}
            \mathbf{if}\;t\_0 \leq 50000000:\\
            \;\;\;\;\frac{\frac{\left(-\mathsf{PI}\left(\right)\right) \cdot l\_m}{F}}{F} + t\_0\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (*.f64 (PI.f64) l) < 5e7

              1. Initial program 73.8%

                \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \]
                2. lift-/.f64N/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{1}{F \cdot F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
                3. lift-*.f64N/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{1}{\color{blue}{F \cdot F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
                4. associate-/r*N/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\frac{1}{F}}{F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
                5. frac-2negN/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\mathsf{neg}\left(\frac{1}{F}\right)}{\mathsf{neg}\left(F\right)}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
                6. associate-*l/N/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\left(\mathsf{neg}\left(\frac{1}{F}\right)\right) \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)}} \]
                7. lower-/.f64N/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\left(\mathsf{neg}\left(\frac{1}{F}\right)\right) \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)}} \]
                8. lower-*.f64N/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\left(\mathsf{neg}\left(\frac{1}{F}\right)\right) \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}}{\mathsf{neg}\left(F\right)} \]
                9. distribute-neg-fracN/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{\mathsf{neg}\left(1\right)}{F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)} \]
                10. metadata-evalN/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\color{blue}{-1}}{F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)} \]
                11. lower-/.f64N/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{-1}{F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F\right)} \]
                12. lift-*.f64N/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F} \cdot \tan \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \ell\right)}}{\mathsf{neg}\left(F\right)} \]
                13. *-commutativeN/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F} \cdot \tan \color{blue}{\left(\ell \cdot \mathsf{PI}\left(\right)\right)}}{\mathsf{neg}\left(F\right)} \]
                14. lower-*.f64N/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F} \cdot \tan \color{blue}{\left(\ell \cdot \mathsf{PI}\left(\right)\right)}}{\mathsf{neg}\left(F\right)} \]
                15. lower-neg.f6484.8

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{-1}{F} \cdot \tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{\color{blue}{-F}} \]
              4. Applied rewrites84.8%

                \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \color{blue}{\frac{\frac{-1}{F} \cdot \tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{-F}} \]
              5. Taylor expanded in l around 0

                \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{-1 \cdot \frac{\ell \cdot \mathsf{PI}\left(\right)}{F}}}{-F} \]
              6. Step-by-step derivation
                1. mul-1-negN/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\mathsf{neg}\left(\frac{\ell \cdot \mathsf{PI}\left(\right)}{F}\right)}}{-F} \]
                2. distribute-neg-fracN/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{\mathsf{neg}\left(\ell \cdot \mathsf{PI}\left(\right)\right)}{F}}}{-F} \]
                3. *-commutativeN/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\mathsf{neg}\left(\color{blue}{\mathsf{PI}\left(\right) \cdot \ell}\right)}{F}}{-F} \]
                4. distribute-lft-neg-outN/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\color{blue}{\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right) \cdot \ell}}{F}}{-F} \]
                5. mul-1-negN/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\color{blue}{\left(-1 \cdot \mathsf{PI}\left(\right)\right)} \cdot \ell}{F}}{-F} \]
                6. lower-/.f64N/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{\left(-1 \cdot \mathsf{PI}\left(\right)\right) \cdot \ell}{F}}}{-F} \]
                7. lower-*.f64N/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\color{blue}{\left(-1 \cdot \mathsf{PI}\left(\right)\right) \cdot \ell}}{F}}{-F} \]
                8. mul-1-negN/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\color{blue}{\left(\mathsf{neg}\left(\mathsf{PI}\left(\right)\right)\right)} \cdot \ell}{F}}{-F} \]
                9. lower-neg.f64N/A

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\color{blue}{\left(-\mathsf{PI}\left(\right)\right)} \cdot \ell}{F}}{-F} \]
                10. lower-PI.f6479.1

                  \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\frac{\left(-\color{blue}{\mathsf{PI}\left(\right)}\right) \cdot \ell}{F}}{-F} \]
              7. Applied rewrites79.1%

                \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{\left(-\mathsf{PI}\left(\right)\right) \cdot \ell}{F}}}{-F} \]

              if 5e7 < (*.f64 (PI.f64) l)

              1. Initial program 69.9%

                \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
              2. Add Preprocessing
              3. Taylor expanded in F around inf

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

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                2. lower-*.f64N/A

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                3. lower-PI.f6499.9

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right)} \cdot \ell \]
              5. Applied rewrites99.9%

                \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
            3. Recombined 2 regimes into one program.
            4. Final simplification84.0%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \mathsf{PI}\left(\right) \leq 50000000:\\ \;\;\;\;\frac{\frac{\left(-\mathsf{PI}\left(\right)\right) \cdot \ell}{F}}{F} + \ell \cdot \mathsf{PI}\left(\right)\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \mathsf{PI}\left(\right)\\ \end{array} \]
            5. Add Preprocessing

            Alternative 10: 98.4% accurate, 2.9× speedup?

            \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{PI}\left(\right), l\_m, \frac{\frac{\mathsf{PI}\left(\right)}{F} \cdot l\_m}{-F}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
            l\_m = (fabs.f64 l)
            l\_s = (copysign.f64 #s(literal 1 binary64) l)
            (FPCore (l_s F l_m)
             :precision binary64
             (let* ((t_0 (* l_m (PI))))
               (*
                l_s
                (if (<= t_0 50000000.0) (fma (PI) l_m (/ (* (/ (PI) F) l_m) (- F))) t_0))))
            \begin{array}{l}
            l\_m = \left|\ell\right|
            \\
            l\_s = \mathsf{copysign}\left(1, \ell\right)
            
            \\
            \begin{array}{l}
            t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
            l\_s \cdot \begin{array}{l}
            \mathbf{if}\;t\_0 \leq 50000000:\\
            \;\;\;\;\mathsf{fma}\left(\mathsf{PI}\left(\right), l\_m, \frac{\frac{\mathsf{PI}\left(\right)}{F} \cdot l\_m}{-F}\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (*.f64 (PI.f64) l) < 5e7

              1. Initial program 73.8%

                \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift--.f64N/A

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)} \]
                2. sub-negN/A

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell + \left(\mathsf{neg}\left(\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)\right)\right)} \]
                3. +-commutativeN/A

                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)\right)\right) + \mathsf{PI}\left(\right) \cdot \ell} \]
                4. lift-*.f64N/A

                  \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
                5. *-commutativeN/A

                  \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \frac{1}{F \cdot F}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
                6. lift-/.f64N/A

                  \[\leadsto \left(\mathsf{neg}\left(\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot \color{blue}{\frac{1}{F \cdot F}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
                7. un-div-invN/A

                  \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F \cdot F}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
                8. distribute-neg-frac2N/A

                  \[\leadsto \color{blue}{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{\mathsf{neg}\left(F \cdot F\right)}} + \mathsf{PI}\left(\right) \cdot \ell \]
                9. *-rgt-identityN/A

                  \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}}{\mathsf{neg}\left(F \cdot F\right)} + \mathsf{PI}\left(\right) \cdot \ell \]
                10. lift-*.f64N/A

                  \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}{\mathsf{neg}\left(\color{blue}{F \cdot F}\right)} + \mathsf{PI}\left(\right) \cdot \ell \]
                11. distribute-rgt-neg-inN/A

                  \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}{\color{blue}{F \cdot \left(\mathsf{neg}\left(F\right)\right)}} + \mathsf{PI}\left(\right) \cdot \ell \]
                12. times-fracN/A

                  \[\leadsto \color{blue}{\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \frac{1}{\mathsf{neg}\left(F\right)}} + \mathsf{PI}\left(\right) \cdot \ell \]
                13. distribute-neg-frac2N/A

                  \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{1}{F}\right)\right)} + \mathsf{PI}\left(\right) \cdot \ell \]
                14. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F}, \mathsf{neg}\left(\frac{1}{F}\right), \mathsf{PI}\left(\right) \cdot \ell\right)} \]
              4. Applied rewrites84.8%

                \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right)} \]
              5. Step-by-step derivation
                1. lift-PI.f64N/A

                  \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \color{blue}{\mathsf{PI}\left(\right)}\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
                2. add-sqr-sqrtN/A

                  \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
                3. lower-*.f64N/A

                  \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
                4. lift-PI.f64N/A

                  \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \left(\sqrt{\color{blue}{\mathsf{PI}\left(\right)}} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
                5. lower-sqrt.f64N/A

                  \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \left(\color{blue}{\sqrt{\mathsf{PI}\left(\right)}} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
                6. lift-PI.f64N/A

                  \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\color{blue}{\mathsf{PI}\left(\right)}}\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
                7. lower-sqrt.f6484.6

                  \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \left(\sqrt{\mathsf{PI}\left(\right)} \cdot \color{blue}{\sqrt{\mathsf{PI}\left(\right)}}\right)\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              6. Applied rewrites84.6%

                \[\leadsto \mathsf{fma}\left(\frac{\tan \left(\ell \cdot \color{blue}{\left(\sqrt{\mathsf{PI}\left(\right)} \cdot \sqrt{\mathsf{PI}\left(\right)}\right)}\right)}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              7. Taylor expanded in l around 0

                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\ell \cdot \mathsf{PI}\left(\right)}{F}}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              8. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{PI}\left(\right) \cdot \ell}}{F}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
                2. associate-*l/N/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
                3. lower-*.f64N/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
                4. lower-/.f64N/A

                  \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F}} \cdot \ell, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
                5. lower-PI.f6479.1

                  \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\mathsf{PI}\left(\right)}}{F} \cdot \ell, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              9. Applied rewrites79.1%

                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
              10. Step-by-step derivation
                1. lift-fma.f64N/A

                  \[\leadsto \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell\right) \cdot \frac{-1}{F} + \ell \cdot \mathsf{PI}\left(\right)} \]
                2. +-commutativeN/A

                  \[\leadsto \color{blue}{\ell \cdot \mathsf{PI}\left(\right) + \left(\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell\right) \cdot \frac{-1}{F}} \]
                3. lift-*.f64N/A

                  \[\leadsto \color{blue}{\ell \cdot \mathsf{PI}\left(\right)} + \left(\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell\right) \cdot \frac{-1}{F} \]
                4. *-commutativeN/A

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} + \left(\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell\right) \cdot \frac{-1}{F} \]
                5. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{PI}\left(\right), \ell, \left(\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell\right) \cdot \frac{-1}{F}\right)} \]
                6. lift-/.f64N/A

                  \[\leadsto \mathsf{fma}\left(\mathsf{PI}\left(\right), \ell, \left(\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell\right) \cdot \color{blue}{\frac{-1}{F}}\right) \]
                7. frac-2negN/A

                  \[\leadsto \mathsf{fma}\left(\mathsf{PI}\left(\right), \ell, \left(\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(-1\right)}{\mathsf{neg}\left(F\right)}}\right) \]
                8. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(\mathsf{PI}\left(\right), \ell, \left(\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell\right) \cdot \frac{\color{blue}{1}}{\mathsf{neg}\left(F\right)}\right) \]
                9. lift-neg.f64N/A

                  \[\leadsto \mathsf{fma}\left(\mathsf{PI}\left(\right), \ell, \left(\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell\right) \cdot \frac{1}{\color{blue}{-F}}\right) \]
                10. un-div-invN/A

                  \[\leadsto \mathsf{fma}\left(\mathsf{PI}\left(\right), \ell, \color{blue}{\frac{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}{-F}}\right) \]
                11. lower-/.f6479.0

                  \[\leadsto \mathsf{fma}\left(\mathsf{PI}\left(\right), \ell, \color{blue}{\frac{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}{-F}}\right) \]
              11. Applied rewrites79.0%

                \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{PI}\left(\right), \ell, \frac{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}{-F}\right)} \]

              if 5e7 < (*.f64 (PI.f64) l)

              1. Initial program 69.9%

                \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
              2. Add Preprocessing
              3. Taylor expanded in F around inf

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

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                2. lower-*.f64N/A

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                3. lower-PI.f6499.9

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right)} \cdot \ell \]
              5. Applied rewrites99.9%

                \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
            3. Recombined 2 regimes into one program.
            4. Final simplification84.0%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \mathsf{PI}\left(\right) \leq 50000000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{PI}\left(\right), \ell, \frac{\frac{\mathsf{PI}\left(\right)}{F} \cdot \ell}{-F}\right)\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \mathsf{PI}\left(\right)\\ \end{array} \]
            5. Add Preprocessing

            Alternative 11: 92.3% accurate, 3.7× speedup?

            \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000000:\\ \;\;\;\;\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F \cdot F}\right) \cdot l\_m\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
            l\_m = (fabs.f64 l)
            l\_s = (copysign.f64 #s(literal 1 binary64) l)
            (FPCore (l_s F l_m)
             :precision binary64
             (let* ((t_0 (* l_m (PI))))
               (* l_s (if (<= t_0 50000000.0) (* (- (PI) (/ (PI) (* F F))) l_m) t_0))))
            \begin{array}{l}
            l\_m = \left|\ell\right|
            \\
            l\_s = \mathsf{copysign}\left(1, \ell\right)
            
            \\
            \begin{array}{l}
            t_0 := l\_m \cdot \mathsf{PI}\left(\right)\\
            l\_s \cdot \begin{array}{l}
            \mathbf{if}\;t\_0 \leq 50000000:\\
            \;\;\;\;\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F \cdot F}\right) \cdot l\_m\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (*.f64 (PI.f64) l) < 5e7

              1. Initial program 73.8%

                \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
              2. Add Preprocessing
              3. Taylor expanded in l around 0

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

                  \[\leadsto \color{blue}{\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{{F}^{2}}\right) \cdot \ell} \]
                2. lower-*.f64N/A

                  \[\leadsto \color{blue}{\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{{F}^{2}}\right) \cdot \ell} \]
                3. lower--.f64N/A

                  \[\leadsto \color{blue}{\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{{F}^{2}}\right)} \cdot \ell \]
                4. lower-PI.f64N/A

                  \[\leadsto \left(\color{blue}{\mathsf{PI}\left(\right)} - \frac{\mathsf{PI}\left(\right)}{{F}^{2}}\right) \cdot \ell \]
                5. lower-/.f64N/A

                  \[\leadsto \left(\mathsf{PI}\left(\right) - \color{blue}{\frac{\mathsf{PI}\left(\right)}{{F}^{2}}}\right) \cdot \ell \]
                6. lower-PI.f64N/A

                  \[\leadsto \left(\mathsf{PI}\left(\right) - \frac{\color{blue}{\mathsf{PI}\left(\right)}}{{F}^{2}}\right) \cdot \ell \]
                7. unpow2N/A

                  \[\leadsto \left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{\color{blue}{F \cdot F}}\right) \cdot \ell \]
                8. lower-*.f6468.1

                  \[\leadsto \left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{\color{blue}{F \cdot F}}\right) \cdot \ell \]
              5. Applied rewrites68.1%

                \[\leadsto \color{blue}{\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F \cdot F}\right) \cdot \ell} \]

              if 5e7 < (*.f64 (PI.f64) l)

              1. Initial program 69.9%

                \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
              2. Add Preprocessing
              3. Taylor expanded in F around inf

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

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                2. lower-*.f64N/A

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                3. lower-PI.f6499.9

                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right)} \cdot \ell \]
              5. Applied rewrites99.9%

                \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
            3. Recombined 2 regimes into one program.
            4. Final simplification75.7%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \cdot \mathsf{PI}\left(\right) \leq 50000000:\\ \;\;\;\;\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F \cdot F}\right) \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\ell \cdot \mathsf{PI}\left(\right)\\ \end{array} \]
            5. Add Preprocessing

            Alternative 12: 73.4% accurate, 22.5× speedup?

            \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ l\_s \cdot \left(l\_m \cdot \mathsf{PI}\left(\right)\right) \end{array} \]
            l\_m = (fabs.f64 l)
            l\_s = (copysign.f64 #s(literal 1 binary64) l)
            (FPCore (l_s F l_m) :precision binary64 (* l_s (* l_m (PI))))
            \begin{array}{l}
            l\_m = \left|\ell\right|
            \\
            l\_s = \mathsf{copysign}\left(1, \ell\right)
            
            \\
            l\_s \cdot \left(l\_m \cdot \mathsf{PI}\left(\right)\right)
            \end{array}
            
            Derivation
            1. Initial program 72.9%

              \[\mathsf{PI}\left(\right) \cdot \ell - \frac{1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
            2. Add Preprocessing
            3. Taylor expanded in F around inf

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

                \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
              2. lower-*.f64N/A

                \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
              3. lower-PI.f6476.8

                \[\leadsto \color{blue}{\mathsf{PI}\left(\right)} \cdot \ell \]
            5. Applied rewrites76.8%

              \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
            6. Final simplification76.8%

              \[\leadsto \ell \cdot \mathsf{PI}\left(\right) \]
            7. Add Preprocessing

            Reproduce

            ?
            herbie shell --seed 2024331 
            (FPCore (F l)
              :name "VandenBroeck and Keller, Equation (6)"
              :precision binary64
              (- (* (PI) l) (* (/ 1.0 (* F F)) (tan (* (PI) l)))))