VandenBroeck and Keller, Equation (6)

Percentage Accurate: 75.9% → 99.0%
Time: 8.1s
Alternatives: 15
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 15 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: 75.9% 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: 99.0% 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)\\ t_1 := \mathsf{PI}\left(\right) \cdot l\_m\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq 2.5 \cdot 10^{-64}:\\ \;\;\;\;\mathsf{fma}\left(\frac{l\_m}{\frac{F}{\mathsf{PI}\left(\right)}}, \frac{-1}{F}, t\_0\right)\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+15}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{PI}\left(\right), l\_m, \frac{\tan t\_0}{\left(-F\right) \cdot F}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \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))) (t_1 (* (PI) l_m)))
   (*
    l_s
    (if (<= t_1 2.5e-64)
      (fma (/ l_m (/ F (PI))) (/ -1.0 F) t_0)
      (if (<= t_1 2e+15) (fma (PI) l_m (/ (tan t_0) (* (- F) F))) t_1)))))
\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)\\
t_1 := \mathsf{PI}\left(\right) \cdot l\_m\\
l\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 2.5 \cdot 10^{-64}:\\
\;\;\;\;\mathsf{fma}\left(\frac{l\_m}{\frac{F}{\mathsf{PI}\left(\right)}}, \frac{-1}{F}, t\_0\right)\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{PI}\left(\right), l\_m, \frac{\tan t\_0}{\left(-F\right) \cdot F}\right)\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (PI.f64) l) < 2.50000000000000017e-64

    1. Initial program 88.1%

      \[\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. lift-*.f64N/A

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

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

        \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}}{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. inv-powN/A

        \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \left(\mathsf{neg}\left(\color{blue}{{F}^{-1}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
    4. Applied rewrites92.9%

      \[\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.f6486.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 rewrites86.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) \]
    8. Step-by-step derivation
      1. Applied rewrites86.2%

        \[\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 2.50000000000000017e-64 < (*.f64 (PI.f64) l) < 2e15

      1. Initial program 97.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 \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. lift-*.f64N/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) \]
        4. lower-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\mathsf{PI}\left(\right), \ell, \frac{\tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{\mathsf{neg}\left(\color{blue}{F \cdot F}\right)}\right) \]
        15. distribute-lft-neg-inN/A

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

          \[\leadsto \mathsf{fma}\left(\mathsf{PI}\left(\right), \ell, \frac{\tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{\color{blue}{\left(\mathsf{neg}\left(F\right)\right) \cdot F}}\right) \]
        17. lower-neg.f6497.6

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

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

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

      1. Initial program 78.0%

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

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

        \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
    9. Recombined 3 regimes into one program.
    10. Add Preprocessing

    Alternative 2: 99.1% accurate, 0.3× speedup?

    \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 2 \cdot 10^{+15}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\frac{\sin t\_0}{F}}{\cos \left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot l\_m\right)}, \frac{-1}{F}, l\_m \cdot \mathsf{PI}\left(\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\mathsf{PI}\left(\right)}^{0.8333333333333334} \cdot \left({\mathsf{PI}\left(\right)}^{0.16666666666666666} \cdot l\_m\right)\\ \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 (* (PI) l_m)))
       (*
        l_s
        (if (<= t_0 2e+15)
          (fma
           (/ (/ (sin t_0) F) (cos (* (cbrt (pow (PI) 3.0)) l_m)))
           (/ -1.0 F)
           (* l_m (PI)))
          (*
           (pow (PI) 0.8333333333333334)
           (* (pow (PI) 0.16666666666666666) l_m))))))
    \begin{array}{l}
    l\_m = \left|\ell\right|
    \\
    l\_s = \mathsf{copysign}\left(1, \ell\right)
    
    \\
    \begin{array}{l}
    t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\
    l\_s \cdot \begin{array}{l}
    \mathbf{if}\;t\_0 \leq 2 \cdot 10^{+15}:\\
    \;\;\;\;\mathsf{fma}\left(\frac{\frac{\sin t\_0}{F}}{\cos \left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot l\_m\right)}, \frac{-1}{F}, l\_m \cdot \mathsf{PI}\left(\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;{\mathsf{PI}\left(\right)}^{0.8333333333333334} \cdot \left({\mathsf{PI}\left(\right)}^{0.16666666666666666} \cdot l\_m\right)\\
    
    
    \end{array}
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 (PI.f64) l) < 2e15

      1. Initial program 88.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 \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. lift-*.f64N/A

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

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

          \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}}{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. inv-powN/A

          \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \left(\mathsf{neg}\left(\color{blue}{{F}^{-1}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
      4. Applied rewrites93.2%

        \[\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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{\frac{\color{blue}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}}{F}}{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
        13. lower-cos.f6493.2

          \[\leadsto \mathsf{fma}\left(\frac{\frac{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F}}{\color{blue}{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
      6. Applied rewrites93.2%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\frac{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F}}{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
      7. Step-by-step derivation
        1. rem-cbrt-cubeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\frac{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F}}{\cos \left(\color{blue}{\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}}} \cdot \ell\right)}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
        2. lift-pow.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\frac{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F}}{\cos \left(\sqrt[3]{\color{blue}{{\mathsf{PI}\left(\right)}^{3}}} \cdot \ell\right)}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
        3. lift-cbrt.f6493.0

          \[\leadsto \mathsf{fma}\left(\frac{\frac{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F}}{\cos \left(\color{blue}{\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}}} \cdot \ell\right)}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
      8. Applied rewrites93.0%

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

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

      1. Initial program 78.0%

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

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

        \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
      6. Step-by-step derivation
        1. Applied rewrites99.0%

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

            \[\leadsto {\mathsf{PI}\left(\right)}^{0.8333333333333334} \cdot \color{blue}{\left({\mathsf{PI}\left(\right)}^{0.16666666666666666} \cdot \ell\right)} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 3: 99.1% accurate, 0.5× speedup?

        \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 2 \cdot 10^{+15}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\frac{\sin t\_0}{F}}{\cos t\_0}, \frac{-1}{F}, l\_m \cdot \mathsf{PI}\left(\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\mathsf{PI}\left(\right)}^{0.8333333333333334} \cdot \left({\mathsf{PI}\left(\right)}^{0.16666666666666666} \cdot l\_m\right)\\ \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 (* (PI) l_m)))
           (*
            l_s
            (if (<= t_0 2e+15)
              (fma (/ (/ (sin t_0) F) (cos t_0)) (/ -1.0 F) (* l_m (PI)))
              (*
               (pow (PI) 0.8333333333333334)
               (* (pow (PI) 0.16666666666666666) l_m))))))
        \begin{array}{l}
        l\_m = \left|\ell\right|
        \\
        l\_s = \mathsf{copysign}\left(1, \ell\right)
        
        \\
        \begin{array}{l}
        t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\
        l\_s \cdot \begin{array}{l}
        \mathbf{if}\;t\_0 \leq 2 \cdot 10^{+15}:\\
        \;\;\;\;\mathsf{fma}\left(\frac{\frac{\sin t\_0}{F}}{\cos t\_0}, \frac{-1}{F}, l\_m \cdot \mathsf{PI}\left(\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;{\mathsf{PI}\left(\right)}^{0.8333333333333334} \cdot \left({\mathsf{PI}\left(\right)}^{0.16666666666666666} \cdot l\_m\right)\\
        
        
        \end{array}
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (*.f64 (PI.f64) l) < 2e15

          1. Initial program 88.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 \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. lift-*.f64N/A

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

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

              \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}}{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. inv-powN/A

              \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \left(\mathsf{neg}\left(\color{blue}{{F}^{-1}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
          4. Applied rewrites93.2%

            \[\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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\frac{\frac{\color{blue}{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}}{F}}{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
            13. lower-cos.f6493.2

              \[\leadsto \mathsf{fma}\left(\frac{\frac{\sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F}}{\color{blue}{\cos \left(\mathsf{PI}\left(\right) \cdot \ell\right)}}, \frac{-1}{F}, \ell \cdot \mathsf{PI}\left(\right)\right) \]
          6. Applied rewrites93.2%

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

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

          1. Initial program 78.0%

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

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

            \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
          6. Step-by-step derivation
            1. Applied rewrites99.0%

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

                \[\leadsto {\mathsf{PI}\left(\right)}^{0.8333333333333334} \cdot \color{blue}{\left({\mathsf{PI}\left(\right)}^{0.16666666666666666} \cdot \ell\right)} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 4: 83.6% accurate, 0.5× speedup?

            \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 - {\left(F \cdot F\right)}^{-1} \cdot \tan t\_0 \leq -1 \cdot 10^{-273}:\\ \;\;\;\;\left(-\mathsf{PI}\left(\right)\right) \cdot \frac{l\_m}{F \cdot 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 (* (PI) l_m)))
               (*
                l_s
                (if (<= (- t_0 (* (pow (* F F) -1.0) (tan t_0))) -1e-273)
                  (* (- (PI)) (/ l_m (* 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 := \mathsf{PI}\left(\right) \cdot l\_m\\
            l\_s \cdot \begin{array}{l}
            \mathbf{if}\;t\_0 - {\left(F \cdot F\right)}^{-1} \cdot \tan t\_0 \leq -1 \cdot 10^{-273}:\\
            \;\;\;\;\left(-\mathsf{PI}\left(\right)\right) \cdot \frac{l\_m}{F \cdot 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-273

              1. Initial program 86.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 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-*.f6475.8

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

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

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

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

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

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

                  1. Initial program 87.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.f6466.1

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

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

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

                Alternative 5: 99.1% accurate, 0.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}\;\mathsf{PI}\left(\right) \cdot l\_m \leq 2 \cdot 10^{+15}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\tan t\_0}{F}, \frac{-1}{F}, t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;{\mathsf{PI}\left(\right)}^{0.8333333333333334} \cdot \left({\mathsf{PI}\left(\right)}^{0.16666666666666666} \cdot l\_m\right)\\ \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 (<= (* (PI) l_m) 2e+15)
                      (fma (/ (tan t_0) F) (/ -1.0 F) t_0)
                      (*
                       (pow (PI) 0.8333333333333334)
                       (* (pow (PI) 0.16666666666666666) l_m))))))
                \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}\;\mathsf{PI}\left(\right) \cdot l\_m \leq 2 \cdot 10^{+15}:\\
                \;\;\;\;\mathsf{fma}\left(\frac{\tan t\_0}{F}, \frac{-1}{F}, t\_0\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;{\mathsf{PI}\left(\right)}^{0.8333333333333334} \cdot \left({\mathsf{PI}\left(\right)}^{0.16666666666666666} \cdot l\_m\right)\\
                
                
                \end{array}
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (*.f64 (PI.f64) l) < 2e15

                  1. Initial program 88.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 \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. lift-*.f64N/A

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

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

                      \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}}{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. inv-powN/A

                      \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \left(\mathsf{neg}\left(\color{blue}{{F}^{-1}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
                  4. Applied rewrites93.2%

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

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

                  1. Initial program 78.0%

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

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

                    \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                  6. Step-by-step derivation
                    1. Applied rewrites99.0%

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

                        \[\leadsto {\mathsf{PI}\left(\right)}^{0.8333333333333334} \cdot \color{blue}{\left({\mathsf{PI}\left(\right)}^{0.16666666666666666} \cdot \ell\right)} \]
                    3. Recombined 2 regimes into one program.
                    4. Add Preprocessing

                    Alternative 6: 99.1% accurate, 0.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}\;\mathsf{PI}\left(\right) \cdot l\_m \leq 2 \cdot 10^{+15}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\tan t\_0}{F}, \frac{-1}{F}, t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;{\mathsf{PI}\left(\right)}^{0.16666666666666666} \cdot \left({\mathsf{PI}\left(\right)}^{0.8333333333333334} \cdot l\_m\right)\\ \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 (<= (* (PI) l_m) 2e+15)
                          (fma (/ (tan t_0) F) (/ -1.0 F) t_0)
                          (*
                           (pow (PI) 0.16666666666666666)
                           (* (pow (PI) 0.8333333333333334) l_m))))))
                    \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}\;\mathsf{PI}\left(\right) \cdot l\_m \leq 2 \cdot 10^{+15}:\\
                    \;\;\;\;\mathsf{fma}\left(\frac{\tan t\_0}{F}, \frac{-1}{F}, t\_0\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;{\mathsf{PI}\left(\right)}^{0.16666666666666666} \cdot \left({\mathsf{PI}\left(\right)}^{0.8333333333333334} \cdot l\_m\right)\\
                    
                    
                    \end{array}
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (*.f64 (PI.f64) l) < 2e15

                      1. Initial program 88.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 \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. lift-*.f64N/A

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

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

                          \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}}{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. inv-powN/A

                          \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \left(\mathsf{neg}\left(\color{blue}{{F}^{-1}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
                      4. Applied rewrites93.2%

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

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

                      1. Initial program 78.0%

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

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

                        \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                      6. Step-by-step derivation
                        1. Applied rewrites99.0%

                          \[\leadsto \sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot \ell \]
                        2. Step-by-step derivation
                          1. Applied rewrites99.5%

                            \[\leadsto {\mathsf{PI}\left(\right)}^{0.16666666666666666} \cdot \color{blue}{\left({\mathsf{PI}\left(\right)}^{0.8333333333333334} \cdot \ell\right)} \]
                        3. Recombined 2 regimes into one program.
                        4. Add Preprocessing

                        Alternative 7: 99.2% 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 := \mathsf{PI}\left(\right) \cdot l\_m\\ t_1 := l\_m \cdot \mathsf{PI}\left(\right)\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 2 \cdot 10^{+15}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\tan t\_1}{F}, \frac{-1}{F}, t\_1\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 (* (PI) l_m)) (t_1 (* l_m (PI))))
                           (* l_s (if (<= t_0 2e+15) (fma (/ (tan t_1) F) (/ -1.0 F) t_1) t_0))))
                        \begin{array}{l}
                        l\_m = \left|\ell\right|
                        \\
                        l\_s = \mathsf{copysign}\left(1, \ell\right)
                        
                        \\
                        \begin{array}{l}
                        t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\
                        t_1 := l\_m \cdot \mathsf{PI}\left(\right)\\
                        l\_s \cdot \begin{array}{l}
                        \mathbf{if}\;t\_0 \leq 2 \cdot 10^{+15}:\\
                        \;\;\;\;\mathsf{fma}\left(\frac{\tan t\_1}{F}, \frac{-1}{F}, t\_1\right)\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;t\_0\\
                        
                        
                        \end{array}
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if (*.f64 (PI.f64) l) < 2e15

                          1. Initial program 88.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 \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. lift-*.f64N/A

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

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

                              \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}}{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. inv-powN/A

                              \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \left(\mathsf{neg}\left(\color{blue}{{F}^{-1}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
                          4. Applied rewrites93.2%

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

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

                          1. Initial program 78.0%

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

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

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

                        Alternative 8: 99.2% 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 := \mathsf{PI}\left(\right) \cdot l\_m\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 2 \cdot 10^{+15}:\\ \;\;\;\;t\_0 - \frac{\frac{\tan \left(l\_m \cdot \mathsf{PI}\left(\right)\right)}{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 (* (PI) l_m)))
                           (* l_s (if (<= t_0 2e+15) (- t_0 (/ (/ (tan (* l_m (PI))) 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 := \mathsf{PI}\left(\right) \cdot l\_m\\
                        l\_s \cdot \begin{array}{l}
                        \mathbf{if}\;t\_0 \leq 2 \cdot 10^{+15}:\\
                        \;\;\;\;t\_0 - \frac{\frac{\tan \left(l\_m \cdot \mathsf{PI}\left(\right)\right)}{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) < 2e15

                          1. Initial program 88.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. 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-/.f6493.1

                              \[\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-*.f6493.1

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

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

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

                          1. Initial program 78.0%

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

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

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

                        Alternative 9: 92.0% accurate, 1.0× speedup?

                        \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000:\\ \;\;\;\;\left(\mathsf{PI}\left(\right) \cdot \left(1 - {\left(F \cdot F\right)}^{-1}\right)\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 (* (PI) l_m)))
                           (*
                            l_s
                            (if (<= t_0 50000.0) (* (* (PI) (- 1.0 (pow (* F F) -1.0))) 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 := \mathsf{PI}\left(\right) \cdot l\_m\\
                        l\_s \cdot \begin{array}{l}
                        \mathbf{if}\;t\_0 \leq 50000:\\
                        \;\;\;\;\left(\mathsf{PI}\left(\right) \cdot \left(1 - {\left(F \cdot F\right)}^{-1}\right)\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) < 5e4

                          1. Initial program 88.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. 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-*.f6481.7

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

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

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

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

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

                            1. Initial program 78.4%

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

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

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

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

                          Alternative 10: 98.2% 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 := \mathsf{PI}\left(\right) \cdot l\_m\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000:\\ \;\;\;\;\mathsf{fma}\left(\frac{l\_m}{\frac{F}{\mathsf{PI}\left(\right)}}, \frac{-1}{F}, l\_m \cdot \mathsf{PI}\left(\right)\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 (* (PI) l_m)))
                             (*
                              l_s
                              (if (<= t_0 50000.0)
                                (fma (/ l_m (/ F (PI))) (/ -1.0 F) (* l_m (PI)))
                                t_0))))
                          \begin{array}{l}
                          l\_m = \left|\ell\right|
                          \\
                          l\_s = \mathsf{copysign}\left(1, \ell\right)
                          
                          \\
                          \begin{array}{l}
                          t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\
                          l\_s \cdot \begin{array}{l}
                          \mathbf{if}\;t\_0 \leq 50000:\\
                          \;\;\;\;\mathsf{fma}\left(\frac{l\_m}{\frac{F}{\mathsf{PI}\left(\right)}}, \frac{-1}{F}, l\_m \cdot \mathsf{PI}\left(\right)\right)\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;t\_0\\
                          
                          
                          \end{array}
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if (*.f64 (PI.f64) l) < 5e4

                            1. Initial program 88.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 \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. lift-*.f64N/A

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

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

                                \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}}{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. inv-powN/A

                                \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \left(\mathsf{neg}\left(\color{blue}{{F}^{-1}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
                            4. Applied rewrites93.2%

                              \[\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.f6486.2

                                \[\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 rewrites86.2%

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

                                \[\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 5e4 < (*.f64 (PI.f64) l)

                              1. Initial program 78.4%

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

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

                                \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                            9. Recombined 2 regimes into one program.
                            10. Add Preprocessing

                            Alternative 11: 98.2% 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 := \mathsf{PI}\left(\right) \cdot l\_m\\ t_1 := l\_m \cdot \mathsf{PI}\left(\right)\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000:\\ \;\;\;\;\mathsf{fma}\left(\frac{t\_1}{F}, \frac{-1}{F}, t\_1\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 (* (PI) l_m)) (t_1 (* l_m (PI))))
                               (* l_s (if (<= t_0 50000.0) (fma (/ t_1 F) (/ -1.0 F) t_1) t_0))))
                            \begin{array}{l}
                            l\_m = \left|\ell\right|
                            \\
                            l\_s = \mathsf{copysign}\left(1, \ell\right)
                            
                            \\
                            \begin{array}{l}
                            t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\
                            t_1 := l\_m \cdot \mathsf{PI}\left(\right)\\
                            l\_s \cdot \begin{array}{l}
                            \mathbf{if}\;t\_0 \leq 50000:\\
                            \;\;\;\;\mathsf{fma}\left(\frac{t\_1}{F}, \frac{-1}{F}, t\_1\right)\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;t\_0\\
                            
                            
                            \end{array}
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if (*.f64 (PI.f64) l) < 5e4

                              1. Initial program 88.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 \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. lift-*.f64N/A

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

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

                                  \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}}{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. inv-powN/A

                                  \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \left(\mathsf{neg}\left(\color{blue}{{F}^{-1}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
                              4. Applied rewrites93.2%

                                \[\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.f6486.2

                                  \[\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 rewrites86.2%

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

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

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

                                1. Initial program 78.4%

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

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

                                  \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                              9. Recombined 2 regimes into one program.
                              10. Add Preprocessing

                              Alternative 12: 98.2% 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 := \mathsf{PI}\left(\right) \cdot l\_m\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \frac{l\_m}{F}, \frac{-1}{F}, l\_m \cdot \mathsf{PI}\left(\right)\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 (* (PI) l_m)))
                                 (*
                                  l_s
                                  (if (<= t_0 50000.0)
                                    (fma (* (PI) (/ l_m F)) (/ -1.0 F) (* l_m (PI)))
                                    t_0))))
                              \begin{array}{l}
                              l\_m = \left|\ell\right|
                              \\
                              l\_s = \mathsf{copysign}\left(1, \ell\right)
                              
                              \\
                              \begin{array}{l}
                              t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\
                              l\_s \cdot \begin{array}{l}
                              \mathbf{if}\;t\_0 \leq 50000:\\
                              \;\;\;\;\mathsf{fma}\left(\mathsf{PI}\left(\right) \cdot \frac{l\_m}{F}, \frac{-1}{F}, l\_m \cdot \mathsf{PI}\left(\right)\right)\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;t\_0\\
                              
                              
                              \end{array}
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if (*.f64 (PI.f64) l) < 5e4

                                1. Initial program 88.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 \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. lift-*.f64N/A

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

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

                                    \[\leadsto \frac{\color{blue}{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \cdot 1}}{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. inv-powN/A

                                    \[\leadsto \frac{\tan \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F} \cdot \left(\mathsf{neg}\left(\color{blue}{{F}^{-1}}\right)\right) + \mathsf{PI}\left(\right) \cdot \ell \]
                                4. Applied rewrites93.2%

                                  \[\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.f6486.2

                                    \[\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 rewrites86.2%

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

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

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

                                  1. Initial program 78.4%

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

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

                                    \[\leadsto \color{blue}{\mathsf{PI}\left(\right) \cdot \ell} \]
                                9. Recombined 2 regimes into one program.
                                10. Add Preprocessing

                                Alternative 13: 98.2% 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 := \mathsf{PI}\left(\right) \cdot l\_m\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{PI}\left(\right), l\_m, \frac{\mathsf{PI}\left(\right)}{F} \cdot \frac{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 (* (PI) l_m)))
                                   (*
                                    l_s
                                    (if (<= t_0 50000.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 := \mathsf{PI}\left(\right) \cdot l\_m\\
                                l\_s \cdot \begin{array}{l}
                                \mathbf{if}\;t\_0 \leq 50000:\\
                                \;\;\;\;\mathsf{fma}\left(\mathsf{PI}\left(\right), l\_m, \frac{\mathsf{PI}\left(\right)}{F} \cdot \frac{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) < 5e4

                                  1. Initial program 88.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 \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. lift-*.f64N/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) \]
                                    4. lower-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \mathsf{fma}\left(\mathsf{PI}\left(\right), \ell, \frac{\tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{\mathsf{neg}\left(\color{blue}{F \cdot F}\right)}\right) \]
                                    15. distribute-lft-neg-inN/A

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

                                      \[\leadsto \mathsf{fma}\left(\mathsf{PI}\left(\right), \ell, \frac{\tan \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{\color{blue}{\left(\mathsf{neg}\left(F\right)\right) \cdot F}}\right) \]
                                    17. lower-neg.f6489.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  1. Initial program 78.4%

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

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

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

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

                                Alternative 14: 92.0% 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 := \mathsf{PI}\left(\right) \cdot l\_m\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 50000:\\ \;\;\;\;\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 (* (PI) l_m)))
                                   (* l_s (if (<= t_0 50000.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 := \mathsf{PI}\left(\right) \cdot l\_m\\
                                l\_s \cdot \begin{array}{l}
                                \mathbf{if}\;t\_0 \leq 50000:\\
                                \;\;\;\;\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) < 5e4

                                  1. Initial program 88.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. 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-*.f6481.7

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

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

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

                                  1. Initial program 78.4%

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

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

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

                                Alternative 15: 73.5% accurate, 22.5× speedup?

                                \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ l\_s \cdot \left(\mathsf{PI}\left(\right) \cdot l\_m\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 (* (PI) l_m)))
                                \begin{array}{l}
                                l\_m = \left|\ell\right|
                                \\
                                l\_s = \mathsf{copysign}\left(1, \ell\right)
                                
                                \\
                                l\_s \cdot \left(\mathsf{PI}\left(\right) \cdot l\_m\right)
                                \end{array}
                                
                                Derivation
                                1. Initial program 86.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 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.f6471.9

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

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

                                Reproduce

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