VandenBroeck and Keller, Equation (6)

Percentage Accurate: 76.5% → 97.7%
Time: 8.0s
Alternatives: 10
Speedup: 4.4×

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 10 alternatives:

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

Initial Program: 76.5% accurate, 1.0× speedup?

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

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

Alternative 1: 97.7% 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}\;l\_m \leq 5.6 \cdot 10^{-11}:\\ \;\;\;\;t\_0 - \frac{l\_m \cdot \frac{\mathsf{PI}\left(\right)}{F}}{F}\\ \mathbf{elif}\;l\_m \leq 3.35 \cdot 10^{+19}:\\ \;\;\;\;\frac{\left(F \cdot F\right) \cdot t\_0 - \tan t\_0}{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 (<= l_m 5.6e-11)
      (- t_0 (/ (* l_m (/ (PI) F)) F))
      (if (<= l_m 3.35e+19) (/ (- (* (* F F) t_0) (tan t_0)) (* F F)) t_0)))))
\begin{array}{l}
l\_m = \left|\ell\right|
\\
l\_s = \mathsf{copysign}\left(1, \ell\right)

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

\mathbf{elif}\;l\_m \leq 3.35 \cdot 10^{+19}:\\
\;\;\;\;\frac{\left(F \cdot F\right) \cdot t\_0 - \tan t\_0}{F \cdot F}\\

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


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < 5.6e-11

    1. Initial program 74.9%

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

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

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{1}{\color{blue}{F \cdot F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
      3. 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) \]
      4. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{{F}^{-1} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F \cdot \cos \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \ell\right)}} \]
      23. lift-PI.f6484.8

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

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

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

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

        \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{\ell \cdot \mathsf{PI}\left(\right)}{F}}}{F} \]
      3. Step-by-step derivation
        1. associate-/l*N/A

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

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

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\ell \cdot \frac{\mathsf{PI}\left(\right)}{\color{blue}{F}}}{F} \]
        4. lift-PI.f6480.0

          \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\ell \cdot \frac{\mathsf{PI}\left(\right)}{F}}{F} \]
      4. Applied rewrites80.0%

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

      if 5.6e-11 < l < 3.35e19

      1. Initial program 99.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 0

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{-1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
        11. lift-tan.f6463.7

          \[\leadsto \frac{-1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
      5. Applied rewrites63.7%

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

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

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

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

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

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

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

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

          \[\leadsto -\ell \cdot \frac{\mathsf{PI}\left(\right)}{F \cdot F} \]
        8. lift-*.f6437.6

          \[\leadsto -\ell \cdot \frac{\mathsf{PI}\left(\right)}{F \cdot F} \]
      8. Applied rewrites37.6%

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

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

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

        if 3.35e19 < l

        1. Initial program 60.9%

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

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

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

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

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

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

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

        1. Initial program 75.8%

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

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

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{1}{\color{blue}{F \cdot F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
          3. 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) \]
          4. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{{F}^{-1} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F \cdot \cos \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \ell\right)}} \]
          23. lift-PI.f6485.4

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{{F}^{-1} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F \cdot \sin \left(\left(-\mathsf{PI}\left(\right) \cdot \ell\right) + \color{blue}{\frac{\mathsf{PI}\left(\right)}{2}}\right)} \]
          14. lift-PI.f6485.1

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

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

        if 3.2e15 < l

        1. Initial program 61.5%

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

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

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

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

            \[\leadsto \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. Final simplification89.0%

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

      Alternative 3: 99.3% accurate, 0.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}\;l\_m \leq 2.5 \cdot 10^{+15}:\\ \;\;\;\;t\_0 - \frac{{F}^{-1} \cdot \sin t\_0}{F \cdot \cos t\_0}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
      l\_m = (fabs.f64 l)
      l\_s = (copysign.f64 #s(literal 1 binary64) l)
      (FPCore (l_s F l_m)
       :precision binary64
       (let* ((t_0 (* (PI) l_m)))
         (*
          l_s
          (if (<= l_m 2.5e+15)
            (- t_0 (/ (* (pow F -1.0) (sin t_0)) (* F (cos t_0))))
            t_0))))
      \begin{array}{l}
      l\_m = \left|\ell\right|
      \\
      l\_s = \mathsf{copysign}\left(1, \ell\right)
      
      \\
      \begin{array}{l}
      t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\
      l\_s \cdot \begin{array}{l}
      \mathbf{if}\;l\_m \leq 2.5 \cdot 10^{+15}:\\
      \;\;\;\;t\_0 - \frac{{F}^{-1} \cdot \sin t\_0}{F \cdot \cos t\_0}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if l < 2.5e15

        1. Initial program 75.8%

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

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

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{1}{\color{blue}{F \cdot F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
          3. 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) \]
          4. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{{F}^{-1} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F \cdot \cos \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \ell\right)}} \]
          23. lift-PI.f6485.4

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

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

        if 2.5e15 < l

        1. Initial program 61.5%

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

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

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

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

            \[\leadsto \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 4: 83.6% accurate, 0.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\\ t_1 := t\_0 - \frac{1}{F \cdot F} \cdot \tan t\_0\\ l\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+221} \lor \neg \left(t\_1 \leq -4 \cdot 10^{-213}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(-l\_m\right) \cdot \frac{\mathsf{PI}\left(\right)}{F \cdot F}\\ \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 (- t_0 (* (/ 1.0 (* F F)) (tan t_0)))))
         (*
          l_s
          (if (or (<= t_1 -2e+221) (not (<= t_1 -4e-213)))
            t_0
            (* (- l_m) (/ (PI) (* F F)))))))
      \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 := t\_0 - \frac{1}{F \cdot F} \cdot \tan t\_0\\
      l\_s \cdot \begin{array}{l}
      \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+221} \lor \neg \left(t\_1 \leq -4 \cdot 10^{-213}\right):\\
      \;\;\;\;t\_0\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(-l\_m\right) \cdot \frac{\mathsf{PI}\left(\right)}{F \cdot F}\\
      
      
      \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)))) < -2.0000000000000001e221 or -3.9999999999999998e-213 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l))))

        1. Initial program 64.6%

          \[\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 \mathsf{PI}\left(\right) \cdot \color{blue}{\ell} \]
          2. lift-*.f64N/A

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

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

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

        if -2.0000000000000001e221 < (-.f64 (*.f64 (PI.f64) l) (*.f64 (/.f64 #s(literal 1 binary64) (*.f64 F F)) (tan.f64 (*.f64 (PI.f64) l)))) < -3.9999999999999998e-213

        1. Initial program 93.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 0

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{-1}{F \cdot F} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
          11. lift-tan.f6432.5

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

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

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

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

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

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

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

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

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

            \[\leadsto -\ell \cdot \frac{\mathsf{PI}\left(\right)}{F \cdot F} \]
          8. lift-*.f6431.9

            \[\leadsto -\ell \cdot \frac{\mathsf{PI}\left(\right)}{F \cdot F} \]
        8. Applied rewrites31.9%

          \[\leadsto -\ell \cdot \frac{\mathsf{PI}\left(\right)}{F \cdot F} \]
      3. Recombined 2 regimes into one program.
      4. Final simplification61.0%

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

      Alternative 5: 98.1% 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}\;l\_m \leq 5.6 \cdot 10^{-11}:\\ \;\;\;\;t\_0 - \frac{l\_m \cdot \frac{\mathsf{PI}\left(\right)}{F}}{F}\\ \mathbf{elif}\;l\_m \leq 2.5 \cdot 10^{+15}:\\ \;\;\;\;\frac{\left(\left(F \cdot F\right) \cdot l\_m\right) \cdot \mathsf{PI}\left(\right) - \tan t\_0}{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 (<= l_m 5.6e-11)
            (- t_0 (/ (* l_m (/ (PI) F)) F))
            (if (<= l_m 2.5e+15)
              (/ (- (* (* (* F F) l_m) (PI)) (tan t_0)) (* F F))
              t_0)))))
      \begin{array}{l}
      l\_m = \left|\ell\right|
      \\
      l\_s = \mathsf{copysign}\left(1, \ell\right)
      
      \\
      \begin{array}{l}
      t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\
      l\_s \cdot \begin{array}{l}
      \mathbf{if}\;l\_m \leq 5.6 \cdot 10^{-11}:\\
      \;\;\;\;t\_0 - \frac{l\_m \cdot \frac{\mathsf{PI}\left(\right)}{F}}{F}\\
      
      \mathbf{elif}\;l\_m \leq 2.5 \cdot 10^{+15}:\\
      \;\;\;\;\frac{\left(\left(F \cdot F\right) \cdot l\_m\right) \cdot \mathsf{PI}\left(\right) - \tan t\_0}{F \cdot F}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if l < 5.6e-11

        1. Initial program 74.9%

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

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

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{1}{\color{blue}{F \cdot F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
          3. 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) \]
          4. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{{F}^{-1} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F \cdot \cos \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \ell\right)}} \]
          23. lift-PI.f6484.8

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

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

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

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

            \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{\ell \cdot \mathsf{PI}\left(\right)}{F}}}{F} \]
          3. Step-by-step derivation
            1. associate-/l*N/A

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

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

              \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\ell \cdot \frac{\mathsf{PI}\left(\right)}{\color{blue}{F}}}{F} \]
            4. lift-PI.f6480.0

              \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\ell \cdot \frac{\mathsf{PI}\left(\right)}{F}}{F} \]
          4. Applied rewrites80.0%

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

          if 5.6e-11 < l < 2.5e15

          1. Initial program 99.6%

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

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

              \[\leadsto \frac{{F}^{2} \cdot \left(\ell \cdot \mathsf{PI}\left(\right)\right) - \frac{\sin \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(\ell \cdot \mathsf{PI}\left(\right)\right)}}{\color{blue}{{F}^{2}}} \]
          5. Applied rewrites99.6%

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

          if 2.5e15 < l

          1. Initial program 61.5%

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

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

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

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

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

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

        Alternative 6: 99.3% 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}\;l\_m \leq 2.5 \cdot 10^{+15}:\\ \;\;\;\;t\_0 + \frac{-1}{F} \cdot \frac{\tan t\_0}{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 (<= l_m 2.5e+15) (+ t_0 (* (/ -1.0 F) (/ (tan t_0) 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}\;l\_m \leq 2.5 \cdot 10^{+15}:\\
        \;\;\;\;t\_0 + \frac{-1}{F} \cdot \frac{\tan t\_0}{F}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if l < 2.5e15

          1. Initial program 75.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 2.5e15 < l

          1. Initial program 61.5%

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

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

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

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

              \[\leadsto \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. Final simplification89.2%

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

        Alternative 7: 99.3% 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}\;l\_m \leq 1.15 \cdot 10^{-28}:\\ \;\;\;\;t\_0 - \frac{l\_m \cdot \frac{\mathsf{PI}\left(\right)}{F}}{F}\\ \mathbf{elif}\;l\_m \leq 2.5 \cdot 10^{+15}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-1}{F \cdot F}, \tan t\_0, t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \end{array} \]
        l\_m = (fabs.f64 l)
        l\_s = (copysign.f64 #s(literal 1 binary64) l)
        (FPCore (l_s F l_m)
         :precision binary64
         (let* ((t_0 (* (PI) l_m)))
           (*
            l_s
            (if (<= l_m 1.15e-28)
              (- t_0 (/ (* l_m (/ (PI) F)) F))
              (if (<= l_m 2.5e+15) (fma (/ -1.0 (* F F)) (tan t_0) t_0) t_0)))))
        \begin{array}{l}
        l\_m = \left|\ell\right|
        \\
        l\_s = \mathsf{copysign}\left(1, \ell\right)
        
        \\
        \begin{array}{l}
        t_0 := \mathsf{PI}\left(\right) \cdot l\_m\\
        l\_s \cdot \begin{array}{l}
        \mathbf{if}\;l\_m \leq 1.15 \cdot 10^{-28}:\\
        \;\;\;\;t\_0 - \frac{l\_m \cdot \frac{\mathsf{PI}\left(\right)}{F}}{F}\\
        
        \mathbf{elif}\;l\_m \leq 2.5 \cdot 10^{+15}:\\
        \;\;\;\;\mathsf{fma}\left(\frac{-1}{F \cdot F}, \tan t\_0, t\_0\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if l < 1.14999999999999993e-28

          1. Initial program 74.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. Step-by-step derivation
            1. lift-*.f64N/A

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

              \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{1}{\color{blue}{F \cdot F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
            3. 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) \]
            4. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{{F}^{-1} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F \cdot \cos \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \ell\right)}} \]
            23. lift-PI.f6484.5

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

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

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

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

              \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{\ell \cdot \mathsf{PI}\left(\right)}{F}}}{F} \]
            3. Step-by-step derivation
              1. associate-/l*N/A

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

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

                \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\ell \cdot \frac{\mathsf{PI}\left(\right)}{\color{blue}{F}}}{F} \]
              4. lift-PI.f6479.5

                \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\ell \cdot \frac{\mathsf{PI}\left(\right)}{F}}{F} \]
            4. Applied rewrites79.5%

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

            if 1.14999999999999993e-28 < l < 2.5e15

            1. Initial program 99.6%

              \[\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}{-1 \cdot \frac{\sin \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{{F}^{2} \cdot \cos \left(\ell \cdot \mathsf{PI}\left(\right)\right)} + \ell \cdot \mathsf{PI}\left(\right)} \]
            4. Step-by-step derivation
              1. associate-*r/N/A

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

                \[\leadsto \frac{-1}{{F}^{2}} \cdot \frac{\sin \left(\ell \cdot \mathsf{PI}\left(\right)\right)}{\cos \left(\ell \cdot \mathsf{PI}\left(\right)\right)} + \color{blue}{\ell} \cdot \mathsf{PI}\left(\right) \]
              3. quot-tanN/A

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(\frac{-1}{F \cdot F}, \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right), \mathsf{PI}\left(\right) \cdot \ell\right) \]
              14. lift-PI.f6499.6

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

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

            if 2.5e15 < l

            1. Initial program 61.5%

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

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

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

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

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

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

          Alternative 8: 98.5% accurate, 3.2× 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}\;l\_m \leq 2000000000:\\ \;\;\;\;t\_0 - \frac{l\_m \cdot \frac{\mathsf{PI}\left(\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 (<= l_m 2000000000.0) (- t_0 (/ (* 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}\;l\_m \leq 2000000000:\\
          \;\;\;\;t\_0 - \frac{l\_m \cdot \frac{\mathsf{PI}\left(\right)}{F}}{F}\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if l < 2e9

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

                \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{1}{\color{blue}{F \cdot F}} \cdot \tan \left(\mathsf{PI}\left(\right) \cdot \ell\right) \]
              3. 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) \]
              4. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{{F}^{-1} \cdot \sin \left(\mathsf{PI}\left(\right) \cdot \ell\right)}{F \cdot \cos \color{blue}{\left(\mathsf{PI}\left(\right) \cdot \ell\right)}} \]
              23. lift-PI.f6485.3

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

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

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

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

                \[\leadsto \mathsf{PI}\left(\right) \cdot \ell - \frac{\color{blue}{\frac{\ell \cdot \mathsf{PI}\left(\right)}{F}}}{F} \]
              3. Step-by-step derivation
                1. associate-/l*N/A

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

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

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

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

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

              if 2e9 < l

              1. Initial program 62.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 \mathsf{PI}\left(\right) \cdot \color{blue}{\ell} \]
                2. lift-*.f64N/A

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

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

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

            Alternative 9: 93.5% accurate, 4.4× speedup?

            \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ l\_s \cdot \begin{array}{l} \mathbf{if}\;l\_m \leq 2000000000:\\ \;\;\;\;\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F \cdot F}\right) \cdot l\_m\\ \mathbf{else}:\\ \;\;\;\;\mathsf{PI}\left(\right) \cdot l\_m\\ \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
             (*
              l_s
              (if (<= l_m 2000000000.0) (* (- (PI) (/ (PI) (* F F))) l_m) (* (PI) l_m))))
            \begin{array}{l}
            l\_m = \left|\ell\right|
            \\
            l\_s = \mathsf{copysign}\left(1, \ell\right)
            
            \\
            l\_s \cdot \begin{array}{l}
            \mathbf{if}\;l\_m \leq 2000000000:\\
            \;\;\;\;\left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F \cdot F}\right) \cdot l\_m\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{PI}\left(\right) \cdot l\_m\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if l < 2e9

              1. Initial program 75.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 \left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{{F}^{2}}\right) \cdot \color{blue}{\ell} \]
                2. lower-*.f64N/A

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

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

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

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

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

                  \[\leadsto \left(\mathsf{PI}\left(\right) - \frac{\mathsf{PI}\left(\right)}{F \cdot F}\right) \cdot \ell \]
                8. lift-*.f6470.5

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

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

              if 2e9 < l

              1. Initial program 62.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 \mathsf{PI}\left(\right) \cdot \color{blue}{\ell} \]
                2. lift-*.f64N/A

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

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

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

            Alternative 10: 74.4% accurate, 22.5× speedup?

            \[\begin{array}{l} l\_m = \left|\ell\right| \\ l\_s = \mathsf{copysign}\left(1, \ell\right) \\ l\_s \cdot \left(\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 71.9%

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

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

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

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

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

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

            Reproduce

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