raw-angle from scale-rotated-ellipse

Percentage Accurate: 13.6% → 56.2%
Time: 25.7s
Alternatives: 9
Speedup: 21.5×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\ t_1 := \cos t\_0\\ t_2 := \sin t\_0\\ t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_2\right) \cdot t\_1}{x-scale}}{y-scale}\\ t_4 := \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{y-scale}}{y-scale}\\ t_5 := \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{x-scale}}{x-scale}\\ 180 \cdot \frac{\tan^{-1} \left(\frac{\left(t\_4 - t\_5\right) - \sqrt{{\left(t\_5 - t\_4\right)}^{2} + {t\_3}^{2}}}{t\_3}\right)}{\mathsf{PI}\left(\right)} \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (* (/ angle 180.0) (PI)))
        (t_1 (cos t_0))
        (t_2 (sin t_0))
        (t_3
         (/
          (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_2) t_1) x-scale)
          y-scale))
        (t_4
         (/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) y-scale) y-scale))
        (t_5
         (/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) x-scale) x-scale)))
   (*
    180.0
    (/
     (atan
      (/ (- (- t_4 t_5) (sqrt (+ (pow (- t_5 t_4) 2.0) (pow t_3 2.0)))) t_3))
     (PI)))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
t_1 := \cos t\_0\\
t_2 := \sin t\_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_2\right) \cdot t\_1}{x-scale}}{y-scale}\\
t_4 := \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{y-scale}}{y-scale}\\
t_5 := \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{x-scale}}{x-scale}\\
180 \cdot \frac{\tan^{-1} \left(\frac{\left(t\_4 - t\_5\right) - \sqrt{{\left(t\_5 - t\_4\right)}^{2} + {t\_3}^{2}}}{t\_3}\right)}{\mathsf{PI}\left(\right)}
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 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: 13.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\ t_1 := \cos t\_0\\ t_2 := \sin t\_0\\ t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_2\right) \cdot t\_1}{x-scale}}{y-scale}\\ t_4 := \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{y-scale}}{y-scale}\\ t_5 := \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{x-scale}}{x-scale}\\ 180 \cdot \frac{\tan^{-1} \left(\frac{\left(t\_4 - t\_5\right) - \sqrt{{\left(t\_5 - t\_4\right)}^{2} + {t\_3}^{2}}}{t\_3}\right)}{\mathsf{PI}\left(\right)} \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (* (/ angle 180.0) (PI)))
        (t_1 (cos t_0))
        (t_2 (sin t_0))
        (t_3
         (/
          (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_2) t_1) x-scale)
          y-scale))
        (t_4
         (/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) y-scale) y-scale))
        (t_5
         (/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) x-scale) x-scale)))
   (*
    180.0
    (/
     (atan
      (/ (- (- t_4 t_5) (sqrt (+ (pow (- t_5 t_4) 2.0) (pow t_3 2.0)))) t_3))
     (PI)))))
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
t_1 := \cos t\_0\\
t_2 := \sin t\_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_2\right) \cdot t\_1}{x-scale}}{y-scale}\\
t_4 := \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{y-scale}}{y-scale}\\
t_5 := \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{x-scale}}{x-scale}\\
180 \cdot \frac{\tan^{-1} \left(\frac{\left(t\_4 - t\_5\right) - \sqrt{{\left(t\_5 - t\_4\right)}^{2} + {t\_3}^{2}}}{t\_3}\right)}{\mathsf{PI}\left(\right)}
\end{array}
\end{array}

Alternative 1: 56.2% accurate, 4.0× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} t_0 := angle \cdot \mathsf{PI}\left(\right)\\ t_1 := 0.005555555555555556 \cdot t\_0\\ \mathbf{if}\;a\_m \leq 4.5 \cdot 10^{+29}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\cos \left(-0.005555555555555556 \cdot t\_0\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \frac{\sin t\_1}{\cos t\_1}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (* angle (PI))) (t_1 (* 0.005555555555555556 t_0)))
   (if (<= a_m 4.5e+29)
     (*
      180.0
      (/
       (atan
        (*
         (/
          (*
           -2.0
           (/
            (* y-scale (pow (cos (* -0.005555555555555556 t_0)) 2.0))
            x-scale))
          (*
           (sin (* (* (PI) angle) 0.005555555555555556))
           (cos (* -0.005555555555555556 (* (cbrt (pow (PI) 3.0)) angle)))))
         0.5))
       (PI)))
     (*
      180.0
      (/
       (atan (* -0.5 (* (/ y-scale x-scale) (* -2.0 (/ (sin t_1) (cos t_1))))))
       (PI))))))
\begin{array}{l}
a_m = \left|a\right|

\\
\begin{array}{l}
t_0 := angle \cdot \mathsf{PI}\left(\right)\\
t_1 := 0.005555555555555556 \cdot t\_0\\
\mathbf{if}\;a\_m \leq 4.5 \cdot 10^{+29}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\cos \left(-0.005555555555555556 \cdot t\_0\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\

\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \frac{\sin t\_1}{\cos t\_1}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 4.5000000000000002e29

    1. Initial program 15.3%

      \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(\frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}} - \left(\sqrt{4 \cdot \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} + {\left(\frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}} - \frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}}\right)}^{2}} + \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}}\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
    4. Applied rewrites30.6%

      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\left(x-scale \cdot y-scale\right) \cdot \left(\left(\frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale} - \sqrt{\mathsf{fma}\left({\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2} \cdot \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)}, 4, {\left(\frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale} - \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale}\right)}^{2}\right)}\right) - \frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale}\right)}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]
    5. Taylor expanded in x-scale around 0

      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\cos \left(\frac{-1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{180}\right) \cdot \cos \left(\frac{-1}{180} \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot \frac{1}{2}\right)}{\mathsf{PI}\left(\right)} \]
    6. Step-by-step derivation
      1. Applied rewrites50.5%

        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\cos \left(-0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]
      2. Step-by-step derivation
        1. Applied rewrites51.8%

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\cos \left(-0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]

        if 4.5000000000000002e29 < a

        1. Initial program 7.5%

          \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in b around inf

          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(\frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}} - \left(\sqrt{4 \cdot \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} + {\left(\frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}} - \frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}}\right)}^{2}} + \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}}\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
        4. Applied rewrites20.0%

          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\left(x-scale \cdot y-scale\right) \cdot \left(\left(\frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale} - \sqrt{\mathsf{fma}\left({\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2} \cdot \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)}, 4, {\left(\frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale} - \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale}\right)}^{2}\right)}\right) - \frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale}\right)}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]
        5. Taylor expanded in x-scale around 0

          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{y-scale \cdot \left(2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
        6. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{y-scale \cdot \left(2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
          2. times-fracN/A

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}\right)}{\mathsf{PI}\left(\right)} \]
          3. lower-*.f64N/A

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}\right)}{\mathsf{PI}\left(\right)} \]
        7. Applied rewrites29.0%

          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\mathsf{fma}\left(2, \left(a \cdot a\right) \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}, 2 \cdot \left(\left(b \cdot b\right) \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - a \cdot a\right)\right)}\right)\right)}}{\mathsf{PI}\left(\right)} \]
        8. Taylor expanded in a around inf

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \color{blue}{\frac{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
        9. Step-by-step derivation
          1. Applied rewrites56.6%

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \color{blue}{\frac{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
        10. Recombined 2 regimes into one program.
        11. Add Preprocessing

        Alternative 2: 55.9% accurate, 4.6× speedup?

        \[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} t_0 := 0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\\ \mathbf{if}\;a\_m \leq 4.5 \cdot 10^{+29}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {1}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \frac{\sin t\_0}{\cos t\_0}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
        a_m = (fabs.f64 a)
        (FPCore (a_m b angle x-scale y-scale)
         :precision binary64
         (let* ((t_0 (* 0.005555555555555556 (* angle (PI)))))
           (if (<= a_m 4.5e+29)
             (*
              180.0
              (/
               (atan
                (*
                 (/
                  (* -2.0 (/ (* y-scale (pow 1.0 2.0)) x-scale))
                  (*
                   (sin (* (* (PI) angle) 0.005555555555555556))
                   (cos (* -0.005555555555555556 (* (cbrt (pow (PI) 3.0)) angle)))))
                 0.5))
               (PI)))
             (*
              180.0
              (/
               (atan (* -0.5 (* (/ y-scale x-scale) (* -2.0 (/ (sin t_0) (cos t_0))))))
               (PI))))))
        \begin{array}{l}
        a_m = \left|a\right|
        
        \\
        \begin{array}{l}
        t_0 := 0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\\
        \mathbf{if}\;a\_m \leq 4.5 \cdot 10^{+29}:\\
        \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {1}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \frac{\sin t\_0}{\cos t\_0}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if a < 4.5000000000000002e29

          1. Initial program 15.3%

            \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in b around inf

            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(\frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}} - \left(\sqrt{4 \cdot \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} + {\left(\frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}} - \frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}}\right)}^{2}} + \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}}\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
          4. Applied rewrites30.6%

            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\left(x-scale \cdot y-scale\right) \cdot \left(\left(\frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale} - \sqrt{\mathsf{fma}\left({\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2} \cdot \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)}, 4, {\left(\frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale} - \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale}\right)}^{2}\right)}\right) - \frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale}\right)}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]
          5. Taylor expanded in x-scale around 0

            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\cos \left(\frac{-1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{180}\right) \cdot \cos \left(\frac{-1}{180} \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot \frac{1}{2}\right)}{\mathsf{PI}\left(\right)} \]
          6. Step-by-step derivation
            1. Applied rewrites50.5%

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\cos \left(-0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]
            2. Step-by-step derivation
              1. Applied rewrites51.8%

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\cos \left(-0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]
              2. Taylor expanded in angle around 0

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {1}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{180}\right) \cdot \cos \left(\frac{-1}{180} \cdot \left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot angle\right)\right)} \cdot \frac{1}{2}\right)}{\mathsf{PI}\left(\right)} \]
              3. Step-by-step derivation
                1. Applied rewrites51.3%

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {1}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\sqrt[3]{{\mathsf{PI}\left(\right)}^{3}} \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]

                if 4.5000000000000002e29 < a

                1. Initial program 7.5%

                  \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
                2. Add Preprocessing
                3. Taylor expanded in b around inf

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(\frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}} - \left(\sqrt{4 \cdot \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} + {\left(\frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}} - \frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}}\right)}^{2}} + \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}}\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                4. Applied rewrites20.0%

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\left(x-scale \cdot y-scale\right) \cdot \left(\left(\frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale} - \sqrt{\mathsf{fma}\left({\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2} \cdot \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)}, 4, {\left(\frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale} - \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale}\right)}^{2}\right)}\right) - \frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale}\right)}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]
                5. Taylor expanded in x-scale around 0

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{y-scale \cdot \left(2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                6. Step-by-step derivation
                  1. lower-*.f64N/A

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{y-scale \cdot \left(2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                  2. times-fracN/A

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}\right)}{\mathsf{PI}\left(\right)} \]
                  3. lower-*.f64N/A

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}\right)}{\mathsf{PI}\left(\right)} \]
                7. Applied rewrites29.0%

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\mathsf{fma}\left(2, \left(a \cdot a\right) \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}, 2 \cdot \left(\left(b \cdot b\right) \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - a \cdot a\right)\right)}\right)\right)}}{\mathsf{PI}\left(\right)} \]
                8. Taylor expanded in a around inf

                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \color{blue}{\frac{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
                9. Step-by-step derivation
                  1. Applied rewrites56.6%

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \color{blue}{\frac{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
                10. Recombined 2 regimes into one program.
                11. Add Preprocessing

                Alternative 3: 56.2% accurate, 5.2× speedup?

                \[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} t_0 := 0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\\ t_1 := \mathsf{PI}\left(\right) \cdot angle\\ \mathbf{if}\;a\_m \leq 9.5 \cdot 10^{+30}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\sin \left(t\_1 \cdot \left(--0.005555555555555556\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}^{2}}{x-scale}}{\sin \left(t\_1 \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot t\_1\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \frac{\sin t\_0}{\cos t\_0}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
                a_m = (fabs.f64 a)
                (FPCore (a_m b angle x-scale y-scale)
                 :precision binary64
                 (let* ((t_0 (* 0.005555555555555556 (* angle (PI)))) (t_1 (* (PI) angle)))
                   (if (<= a_m 9.5e+30)
                     (*
                      180.0
                      (/
                       (atan
                        (*
                         (/
                          (*
                           -2.0
                           (/
                            (*
                             y-scale
                             (pow
                              (sin (+ (* t_1 (- -0.005555555555555556)) (/ (PI) 2.0)))
                              2.0))
                            x-scale))
                          (*
                           (sin (* t_1 0.005555555555555556))
                           (cos (* -0.005555555555555556 t_1))))
                         0.5))
                       (PI)))
                     (*
                      180.0
                      (/
                       (atan (* -0.5 (* (/ y-scale x-scale) (* -2.0 (/ (sin t_0) (cos t_0))))))
                       (PI))))))
                \begin{array}{l}
                a_m = \left|a\right|
                
                \\
                \begin{array}{l}
                t_0 := 0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\\
                t_1 := \mathsf{PI}\left(\right) \cdot angle\\
                \mathbf{if}\;a\_m \leq 9.5 \cdot 10^{+30}:\\
                \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\sin \left(t\_1 \cdot \left(--0.005555555555555556\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}^{2}}{x-scale}}{\sin \left(t\_1 \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot t\_1\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
                
                \mathbf{else}:\\
                \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \frac{\sin t\_0}{\cos t\_0}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if a < 9.5000000000000003e30

                  1. Initial program 15.3%

                    \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
                  2. Add Preprocessing
                  3. Taylor expanded in b around inf

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(\frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}} - \left(\sqrt{4 \cdot \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} + {\left(\frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}} - \frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}}\right)}^{2}} + \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}}\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                  4. Applied rewrites30.6%

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\left(x-scale \cdot y-scale\right) \cdot \left(\left(\frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale} - \sqrt{\mathsf{fma}\left({\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2} \cdot \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)}, 4, {\left(\frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale} - \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale}\right)}^{2}\right)}\right) - \frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale}\right)}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]
                  5. Taylor expanded in x-scale around 0

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\cos \left(\frac{-1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{180}\right) \cdot \cos \left(\frac{-1}{180} \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot \frac{1}{2}\right)}{\mathsf{PI}\left(\right)} \]
                  6. Step-by-step derivation
                    1. Applied rewrites50.5%

                      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\cos \left(-0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]
                    2. Step-by-step derivation
                      1. Applied rewrites50.5%

                        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\sin \left(\left(-\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot -0.005555555555555556\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]

                      if 9.5000000000000003e30 < a

                      1. Initial program 7.5%

                        \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
                      2. Add Preprocessing
                      3. Taylor expanded in b around inf

                        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(\frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}} - \left(\sqrt{4 \cdot \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} + {\left(\frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}} - \frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}}\right)}^{2}} + \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}}\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                      4. Applied rewrites20.0%

                        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\left(x-scale \cdot y-scale\right) \cdot \left(\left(\frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale} - \sqrt{\mathsf{fma}\left({\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2} \cdot \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)}, 4, {\left(\frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale} - \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale}\right)}^{2}\right)}\right) - \frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale}\right)}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]
                      5. Taylor expanded in x-scale around 0

                        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{y-scale \cdot \left(2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                      6. Step-by-step derivation
                        1. lower-*.f64N/A

                          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{y-scale \cdot \left(2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                        2. times-fracN/A

                          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}\right)}{\mathsf{PI}\left(\right)} \]
                        3. lower-*.f64N/A

                          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}\right)}{\mathsf{PI}\left(\right)} \]
                      7. Applied rewrites29.0%

                        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\mathsf{fma}\left(2, \left(a \cdot a\right) \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}, 2 \cdot \left(\left(b \cdot b\right) \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - a \cdot a\right)\right)}\right)\right)}}{\mathsf{PI}\left(\right)} \]
                      8. Taylor expanded in a around inf

                        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \color{blue}{\frac{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
                      9. Step-by-step derivation
                        1. Applied rewrites56.6%

                          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \color{blue}{\frac{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
                      10. Recombined 2 regimes into one program.
                      11. Final simplification51.8%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 9.5 \cdot 10^{+30}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \left(--0.005555555555555556\right) + \frac{\mathsf{PI}\left(\right)}{2}\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \frac{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
                      12. Add Preprocessing

                      Alternative 4: 56.2% accurate, 5.3× speedup?

                      \[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} t_0 := 0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\\ t_1 := \mathsf{PI}\left(\right) \cdot angle\\ \mathbf{if}\;a\_m \leq 9.5 \cdot 10^{+30}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\left(-\cos \left(\mathsf{fma}\left(-0.005555555555555556 \cdot angle, \mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)}^{2}}{x-scale}}{\sin \left(t\_1 \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot t\_1\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \frac{\sin t\_0}{\cos t\_0}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
                      a_m = (fabs.f64 a)
                      (FPCore (a_m b angle x-scale y-scale)
                       :precision binary64
                       (let* ((t_0 (* 0.005555555555555556 (* angle (PI)))) (t_1 (* (PI) angle)))
                         (if (<= a_m 9.5e+30)
                           (*
                            180.0
                            (/
                             (atan
                              (*
                               (/
                                (*
                                 -2.0
                                 (/
                                  (*
                                   y-scale
                                   (pow
                                    (- (cos (fma (* -0.005555555555555556 angle) (PI) (PI))))
                                    2.0))
                                  x-scale))
                                (*
                                 (sin (* t_1 0.005555555555555556))
                                 (cos (* -0.005555555555555556 t_1))))
                               0.5))
                             (PI)))
                           (*
                            180.0
                            (/
                             (atan (* -0.5 (* (/ y-scale x-scale) (* -2.0 (/ (sin t_0) (cos t_0))))))
                             (PI))))))
                      \begin{array}{l}
                      a_m = \left|a\right|
                      
                      \\
                      \begin{array}{l}
                      t_0 := 0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\\
                      t_1 := \mathsf{PI}\left(\right) \cdot angle\\
                      \mathbf{if}\;a\_m \leq 9.5 \cdot 10^{+30}:\\
                      \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\left(-\cos \left(\mathsf{fma}\left(-0.005555555555555556 \cdot angle, \mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)}^{2}}{x-scale}}{\sin \left(t\_1 \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot t\_1\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \frac{\sin t\_0}{\cos t\_0}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if a < 9.5000000000000003e30

                        1. Initial program 15.3%

                          \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
                        2. Add Preprocessing
                        3. Taylor expanded in b around inf

                          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(\frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}} - \left(\sqrt{4 \cdot \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} + {\left(\frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}} - \frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}}\right)}^{2}} + \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}}\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                        4. Applied rewrites30.6%

                          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\left(x-scale \cdot y-scale\right) \cdot \left(\left(\frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale} - \sqrt{\mathsf{fma}\left({\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2} \cdot \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)}, 4, {\left(\frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale} - \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale}\right)}^{2}\right)}\right) - \frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale}\right)}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]
                        5. Taylor expanded in x-scale around 0

                          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\cos \left(\frac{-1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot \frac{1}{180}\right) \cdot \cos \left(\frac{-1}{180} \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot \frac{1}{2}\right)}{\mathsf{PI}\left(\right)} \]
                        6. Step-by-step derivation
                          1. Applied rewrites50.5%

                            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\cos \left(-0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]
                          2. Step-by-step derivation
                            1. Applied rewrites50.5%

                              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\left(\mathsf{fma}\left(\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot -0.005555555555555556\right), \cos \left(\frac{\mathsf{PI}\left(\right)}{2}\right), \cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot -0.005555555555555556\right) \cdot \sin \left(\frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]
                            2. Applied rewrites50.5%

                              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\left(0 - \cos \left(\mathsf{fma}\left(-0.005555555555555556 \cdot angle, \mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)} \]

                            if 9.5000000000000003e30 < a

                            1. Initial program 7.5%

                              \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
                            2. Add Preprocessing
                            3. Taylor expanded in b around inf

                              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(\frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}} - \left(\sqrt{4 \cdot \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} + {\left(\frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}} - \frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}}\right)}^{2}} + \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}}\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                            4. Applied rewrites20.0%

                              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\left(x-scale \cdot y-scale\right) \cdot \left(\left(\frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale} - \sqrt{\mathsf{fma}\left({\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2} \cdot \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)}, 4, {\left(\frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale} - \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale}\right)}^{2}\right)}\right) - \frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale}\right)}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]
                            5. Taylor expanded in x-scale around 0

                              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{y-scale \cdot \left(2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                            6. Step-by-step derivation
                              1. lower-*.f64N/A

                                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{y-scale \cdot \left(2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                              2. times-fracN/A

                                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}\right)}{\mathsf{PI}\left(\right)} \]
                              3. lower-*.f64N/A

                                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}\right)}{\mathsf{PI}\left(\right)} \]
                            7. Applied rewrites29.0%

                              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\mathsf{fma}\left(2, \left(a \cdot a\right) \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}, 2 \cdot \left(\left(b \cdot b\right) \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - a \cdot a\right)\right)}\right)\right)}}{\mathsf{PI}\left(\right)} \]
                            8. Taylor expanded in a around inf

                              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \color{blue}{\frac{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
                            9. Step-by-step derivation
                              1. Applied rewrites56.6%

                                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \color{blue}{\frac{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
                            10. Recombined 2 regimes into one program.
                            11. Final simplification51.8%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 9.5 \cdot 10^{+30}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-2 \cdot \frac{y-scale \cdot {\left(-\cos \left(\mathsf{fma}\left(-0.005555555555555556 \cdot angle, \mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right)\right)}^{2}}{x-scale}}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \frac{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
                            12. Add Preprocessing

                            Alternative 5: 56.2% accurate, 8.4× speedup?

                            \[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} t_0 := 0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\\ t_1 := \cos t\_0\\ t_2 := \sin t\_0\\ \mathbf{if}\;a\_m \leq 9.5 \cdot 10^{+30}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(2 \cdot \frac{t\_1}{t\_2}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \frac{t\_2}{t\_1}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
                            a_m = (fabs.f64 a)
                            (FPCore (a_m b angle x-scale y-scale)
                             :precision binary64
                             (let* ((t_0 (* 0.005555555555555556 (* angle (PI))))
                                    (t_1 (cos t_0))
                                    (t_2 (sin t_0)))
                               (if (<= a_m 9.5e+30)
                                 (*
                                  180.0
                                  (/ (atan (* -0.5 (* (/ y-scale x-scale) (* 2.0 (/ t_1 t_2))))) (PI)))
                                 (*
                                  180.0
                                  (/ (atan (* -0.5 (* (/ y-scale x-scale) (* -2.0 (/ t_2 t_1))))) (PI))))))
                            \begin{array}{l}
                            a_m = \left|a\right|
                            
                            \\
                            \begin{array}{l}
                            t_0 := 0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\\
                            t_1 := \cos t\_0\\
                            t_2 := \sin t\_0\\
                            \mathbf{if}\;a\_m \leq 9.5 \cdot 10^{+30}:\\
                            \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(2 \cdot \frac{t\_1}{t\_2}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \frac{t\_2}{t\_1}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if a < 9.5000000000000003e30

                              1. Initial program 15.3%

                                \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
                              2. Add Preprocessing
                              3. Taylor expanded in b around inf

                                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(\frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}} - \left(\sqrt{4 \cdot \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} + {\left(\frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}} - \frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}}\right)}^{2}} + \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}}\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                              4. Applied rewrites30.6%

                                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\left(x-scale \cdot y-scale\right) \cdot \left(\left(\frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale} - \sqrt{\mathsf{fma}\left({\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2} \cdot \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)}, 4, {\left(\frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale} - \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale}\right)}^{2}\right)}\right) - \frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale}\right)}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]
                              5. Taylor expanded in x-scale around 0

                                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{y-scale \cdot \left(2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                              6. Step-by-step derivation
                                1. lower-*.f64N/A

                                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{y-scale \cdot \left(2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                                2. times-fracN/A

                                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}\right)}{\mathsf{PI}\left(\right)} \]
                                3. lower-*.f64N/A

                                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}\right)}{\mathsf{PI}\left(\right)} \]
                              7. Applied rewrites30.1%

                                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\mathsf{fma}\left(2, \left(a \cdot a\right) \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}, 2 \cdot \left(\left(b \cdot b\right) \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - a \cdot a\right)\right)}\right)\right)}}{\mathsf{PI}\left(\right)} \]
                              8. Taylor expanded in a around 0

                                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \left(\frac{y-scale}{x-scale} \cdot \left(2 \cdot \color{blue}{\frac{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
                              9. Step-by-step derivation
                                1. Applied rewrites50.5%

                                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(2 \cdot \color{blue}{\frac{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]

                                if 9.5000000000000003e30 < a

                                1. Initial program 7.5%

                                  \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
                                2. Add Preprocessing
                                3. Taylor expanded in b around inf

                                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(\frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}} - \left(\sqrt{4 \cdot \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} + {\left(\frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}} - \frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}}\right)}^{2}} + \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}}\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                                4. Applied rewrites20.0%

                                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\left(x-scale \cdot y-scale\right) \cdot \left(\left(\frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale} - \sqrt{\mathsf{fma}\left({\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2} \cdot \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)}, 4, {\left(\frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale} - \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale}\right)}^{2}\right)}\right) - \frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale}\right)}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]
                                5. Taylor expanded in x-scale around 0

                                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{y-scale \cdot \left(2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                                6. Step-by-step derivation
                                  1. lower-*.f64N/A

                                    \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{y-scale \cdot \left(2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                                  2. times-fracN/A

                                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}\right)}{\mathsf{PI}\left(\right)} \]
                                  3. lower-*.f64N/A

                                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}\right)}{\mathsf{PI}\left(\right)} \]
                                7. Applied rewrites29.0%

                                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\mathsf{fma}\left(2, \left(a \cdot a\right) \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}, 2 \cdot \left(\left(b \cdot b\right) \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - a \cdot a\right)\right)}\right)\right)}}{\mathsf{PI}\left(\right)} \]
                                8. Taylor expanded in a around inf

                                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \color{blue}{\frac{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
                                9. Step-by-step derivation
                                  1. Applied rewrites56.6%

                                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \color{blue}{\frac{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
                                10. Recombined 2 regimes into one program.
                                11. Add Preprocessing

                                Alternative 6: 53.6% accurate, 8.4× speedup?

                                \[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} t_0 := 0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\\ \mathbf{if}\;a\_m \leq 1.6 \cdot 10^{-112}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \frac{\sin t\_0}{\cos t\_0}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
                                a_m = (fabs.f64 a)
                                (FPCore (a_m b angle x-scale y-scale)
                                 :precision binary64
                                 (let* ((t_0 (* 0.005555555555555556 (* angle (PI)))))
                                   (if (<= a_m 1.6e-112)
                                     (*
                                      180.0
                                      (/ (atan (* (* -2.0 (/ y-scale (* angle (* x-scale (PI))))) 90.0)) (PI)))
                                     (*
                                      180.0
                                      (/
                                       (atan (* -0.5 (* (/ y-scale x-scale) (* -2.0 (/ (sin t_0) (cos t_0))))))
                                       (PI))))))
                                \begin{array}{l}
                                a_m = \left|a\right|
                                
                                \\
                                \begin{array}{l}
                                t_0 := 0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\\
                                \mathbf{if}\;a\_m \leq 1.6 \cdot 10^{-112}:\\
                                \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \frac{\sin t\_0}{\cos t\_0}\right)\right)\right)}{\mathsf{PI}\left(\right)}\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if a < 1.59999999999999997e-112

                                  1. Initial program 15.6%

                                    \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
                                  2. Add Preprocessing
                                  3. Taylor expanded in angle around 0

                                    \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(90 \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(2 \cdot \frac{{a}^{2}}{{y-scale}^{2}} - 2 \cdot \frac{{b}^{2}}{{x-scale}^{2}}\right)\right)}{angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                                  4. Step-by-step derivation
                                    1. *-commutativeN/A

                                      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{x-scale \cdot \left(y-scale \cdot \left(2 \cdot \frac{{a}^{2}}{{y-scale}^{2}} - 2 \cdot \frac{{b}^{2}}{{x-scale}^{2}}\right)\right)}{angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \cdot 90\right)}}{\mathsf{PI}\left(\right)} \]
                                    2. lower-*.f64N/A

                                      \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{x-scale \cdot \left(y-scale \cdot \left(2 \cdot \frac{{a}^{2}}{{y-scale}^{2}} - 2 \cdot \frac{{b}^{2}}{{x-scale}^{2}}\right)\right)}{angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \cdot 90\right)}}{\mathsf{PI}\left(\right)} \]
                                  5. Applied rewrites11.9%

                                    \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{x-scale}{angle} \cdot \frac{\left(2 \cdot \left(\frac{a \cdot a}{y-scale \cdot y-scale} - \frac{b \cdot b}{x-scale \cdot x-scale}\right)\right) \cdot y-scale}{\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \mathsf{PI}\left(\right)}\right) \cdot 90\right)}}{\mathsf{PI}\left(\right)} \]
                                  6. Taylor expanded in a around inf

                                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{x-scale}{angle} \cdot \frac{-2}{y-scale \cdot \mathsf{PI}\left(\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                  7. Step-by-step derivation
                                    1. Applied rewrites12.3%

                                      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{x-scale}{angle} \cdot \frac{-2}{y-scale \cdot \mathsf{PI}\left(\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                    2. Taylor expanded in a around 0

                                      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites43.2%

                                        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]

                                      if 1.59999999999999997e-112 < a

                                      1. Initial program 9.4%

                                        \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
                                      2. Add Preprocessing
                                      3. Taylor expanded in b around inf

                                        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{1}{2} \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(\frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}} - \left(\sqrt{4 \cdot \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} + {\left(\frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}} - \frac{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{y-scale}^{2}}\right)}^{2}} + \frac{{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{{x-scale}^{2}}\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                                      4. Applied rewrites22.0%

                                        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\left(x-scale \cdot y-scale\right) \cdot \left(\left(\frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale} - \sqrt{\mathsf{fma}\left({\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2} \cdot \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)}, 4, {\left(\frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale} - \frac{{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}}{y-scale \cdot y-scale}\right)}^{2}\right)}\right) - \frac{{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)}^{2}}{x-scale \cdot x-scale}\right)}{\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\right)\right)} \cdot 0.5\right)}}{\mathsf{PI}\left(\right)} \]
                                      5. Taylor expanded in x-scale around 0

                                        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{y-scale \cdot \left(2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                                      6. Step-by-step derivation
                                        1. lower-*.f64N/A

                                          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{-1}{2} \cdot \frac{y-scale \cdot \left(2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                                        2. times-fracN/A

                                          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}\right)}{\mathsf{PI}\left(\right)} \]
                                        3. lower-*.f64N/A

                                          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \color{blue}{\left(\frac{y-scale}{x-scale} \cdot \frac{2 \cdot \left({a}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}\right)}{\mathsf{PI}\left(\right)} \]
                                      7. Applied rewrites29.7%

                                        \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\mathsf{fma}\left(2, \left(a \cdot a\right) \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}, 2 \cdot \left(\left(b \cdot b\right) \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(b \cdot b - a \cdot a\right)\right)}\right)\right)}}{\mathsf{PI}\left(\right)} \]
                                      8. Taylor expanded in a around inf

                                        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{-1}{2} \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \color{blue}{\frac{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
                                      9. Step-by-step derivation
                                        1. Applied rewrites51.3%

                                          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(\frac{y-scale}{x-scale} \cdot \left(-2 \cdot \color{blue}{\frac{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)\right)\right)}{\mathsf{PI}\left(\right)} \]
                                      10. Recombined 2 regimes into one program.
                                      11. Add Preprocessing

                                      Alternative 7: 36.8% accurate, 14.9× speedup?

                                      \[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 6.5 \cdot 10^{-162}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale \cdot \mathsf{fma}\left(-180, \frac{b \cdot b}{x-scale \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right)\right)}, 0.5 \cdot \left(\left(angle \cdot angle\right) \cdot \left(0.011111111111111112 \cdot \frac{\mathsf{PI}\left(\right)}{x-scale}\right)\right)\right)}{angle}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \end{array} \]
                                      a_m = (fabs.f64 a)
                                      (FPCore (a_m b angle x-scale y-scale)
                                       :precision binary64
                                       (if (<= b 6.5e-162)
                                         (*
                                          180.0
                                          (/
                                           (atan
                                            (/
                                             (*
                                              y-scale
                                              (fma
                                               -180.0
                                               (/ (* b b) (* x-scale (* (PI) (* (+ a_m b) (- b a_m)))))
                                               (*
                                                0.5
                                                (* (* angle angle) (* 0.011111111111111112 (/ (PI) x-scale))))))
                                             angle))
                                           (PI)))
                                         (*
                                          180.0
                                          (/ (atan (* (* -2.0 (/ y-scale (* angle (* x-scale (PI))))) 90.0)) (PI)))))
                                      \begin{array}{l}
                                      a_m = \left|a\right|
                                      
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;b \leq 6.5 \cdot 10^{-162}:\\
                                      \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale \cdot \mathsf{fma}\left(-180, \frac{b \cdot b}{x-scale \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\left(a\_m + b\right) \cdot \left(b - a\_m\right)\right)\right)}, 0.5 \cdot \left(\left(angle \cdot angle\right) \cdot \left(0.011111111111111112 \cdot \frac{\mathsf{PI}\left(\right)}{x-scale}\right)\right)\right)}{angle}\right)}{\mathsf{PI}\left(\right)}\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 2 regimes
                                      2. if b < 6.49999999999999989e-162

                                        1. Initial program 10.3%

                                          \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
                                        2. Add Preprocessing
                                        3. Taylor expanded in angle around 0

                                          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\frac{1}{2} \cdot \left({angle}^{2} \cdot \left(180 \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(\left(\frac{-1}{32400} \cdot \frac{{a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{{y-scale}^{2}} + \frac{1}{32400} \cdot \frac{{b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{{y-scale}^{2}}\right) - \left(\frac{-1}{32400} \cdot \frac{{b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{{x-scale}^{2}} + \left(\frac{1}{32400} \cdot \frac{{a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{{x-scale}^{2}} + \frac{1}{2} \cdot \frac{\frac{1}{8100} \cdot \frac{{\mathsf{PI}\left(\right)}^{2} \cdot {\left({b}^{2} - {a}^{2}\right)}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} + 2 \cdot \left(\left(\left(\frac{-1}{32400} \cdot \frac{{b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{{x-scale}^{2}} + \frac{1}{32400} \cdot \frac{{a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{{x-scale}^{2}}\right) - \left(\frac{-1}{32400} \cdot \frac{{a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{{y-scale}^{2}} + \frac{1}{32400} \cdot \frac{{b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{{y-scale}^{2}}\right)\right) \cdot \left(\frac{{b}^{2}}{{x-scale}^{2}} - \frac{{a}^{2}}{{y-scale}^{2}}\right)\right)}{\frac{{b}^{2}}{{x-scale}^{2}} - \frac{{a}^{2}}{{y-scale}^{2}}}\right)\right)\right)\right)}{\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)} - 32400 \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(\left(\frac{-1}{11664000} \cdot \left({\mathsf{PI}\left(\right)}^{3} \cdot \left({b}^{2} - {a}^{2}\right)\right) + \frac{-1}{34992000} \cdot \left({\mathsf{PI}\left(\right)}^{3} \cdot \left({b}^{2} - {a}^{2}\right)\right)\right) \cdot \left(2 \cdot \frac{{a}^{2}}{{y-scale}^{2}} - 2 \cdot \frac{{b}^{2}}{{x-scale}^{2}}\right)\right)\right)}{{\mathsf{PI}\left(\right)}^{2} \cdot {\left({b}^{2} - {a}^{2}\right)}^{2}}\right)\right) + 90 \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(2 \cdot \frac{{a}^{2}}{{y-scale}^{2}} - 2 \cdot \frac{{b}^{2}}{{x-scale}^{2}}\right)\right)}{\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)}}{angle}\right)}}{\mathsf{PI}\left(\right)} \]
                                        4. Applied rewrites1.3%

                                          \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{\mathsf{fma}\left(0.5 \cdot \left(angle \cdot angle\right), \mathsf{fma}\left(\frac{\left(x-scale \cdot y-scale\right) \cdot \left(\frac{\mathsf{fma}\left(3.08641975308642 \cdot 10^{-5}, \left(\mathsf{PI}\left(\right) \cdot b\right) \cdot \left(\mathsf{PI}\left(\right) \cdot b\right), -3.08641975308642 \cdot 10^{-5} \cdot \left(\left(\mathsf{PI}\left(\right) \cdot a\right) \cdot \left(\mathsf{PI}\left(\right) \cdot a\right)\right)\right)}{y-scale \cdot y-scale} - \left(\frac{\mathsf{fma}\left(3.08641975308642 \cdot 10^{-5}, \left(\mathsf{PI}\left(\right) \cdot a\right) \cdot \left(\mathsf{PI}\left(\right) \cdot a\right), -3.08641975308642 \cdot 10^{-5} \cdot \left(\left(\mathsf{PI}\left(\right) \cdot b\right) \cdot \left(\mathsf{PI}\left(\right) \cdot b\right)\right)\right)}{x-scale \cdot x-scale} + \frac{\mathsf{fma}\left(\left(\frac{\mathsf{fma}\left(3.08641975308642 \cdot 10^{-5}, \left(\mathsf{PI}\left(\right) \cdot a\right) \cdot \left(\mathsf{PI}\left(\right) \cdot a\right), -3.08641975308642 \cdot 10^{-5} \cdot \left(\left(\mathsf{PI}\left(\right) \cdot b\right) \cdot \left(\mathsf{PI}\left(\right) \cdot b\right)\right)\right)}{x-scale \cdot x-scale} - \frac{\mathsf{fma}\left(3.08641975308642 \cdot 10^{-5}, \left(\mathsf{PI}\left(\right) \cdot b\right) \cdot \left(\mathsf{PI}\left(\right) \cdot b\right), -3.08641975308642 \cdot 10^{-5} \cdot \left(\left(\mathsf{PI}\left(\right) \cdot a\right) \cdot \left(\mathsf{PI}\left(\right) \cdot a\right)\right)\right)}{y-scale \cdot y-scale}\right) \cdot \left(\frac{b \cdot b}{x-scale \cdot x-scale} - \frac{a \cdot a}{y-scale \cdot y-scale}\right), 2, \left(\left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right) \cdot \frac{{\left(\left(b + a\right) \cdot \left(b - a\right)\right)}^{2}}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)}\right) \cdot 0.0001234567901234568\right)}{\frac{b \cdot b}{x-scale \cdot x-scale} - \frac{a \cdot a}{y-scale \cdot y-scale}} \cdot 0.5\right)\right)}{\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \mathsf{PI}\left(\right)}, 180, -32400 \cdot \left(\frac{x-scale}{\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)} \cdot \frac{\left(y-scale \cdot \left(\left({\mathsf{PI}\left(\right)}^{3} \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot -1.1431184270690443 \cdot 10^{-7}\right)\right) \cdot \left(2 \cdot \left(\frac{a \cdot a}{y-scale \cdot y-scale} - \frac{b \cdot b}{x-scale \cdot x-scale}\right)\right)}{{\left(\left(b + a\right) \cdot \left(b - a\right)\right)}^{2}}\right)\right), \frac{\left(x-scale \cdot y-scale\right) \cdot \left(2 \cdot \left(\frac{a \cdot a}{y-scale \cdot y-scale} - \frac{b \cdot b}{x-scale \cdot x-scale}\right)\right)}{\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \mathsf{PI}\left(\right)} \cdot 90\right)}{angle}\right)}}{\mathsf{PI}\left(\right)} \]
                                        5. Taylor expanded in y-scale around inf

                                          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{y-scale \cdot \left(-180 \cdot \frac{{b}^{2}}{x-scale \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right)} + \frac{1}{2} \cdot \left({angle}^{2} \cdot \left(-180 \cdot \frac{x-scale \cdot \left(\frac{-1}{16200} \cdot \frac{{b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{{x-scale}^{2}} + \frac{1}{16200} \cdot \frac{{a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}}{{x-scale}^{2}}\right)}{\mathsf{PI}\left(\right) \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)} + \frac{-1}{135} \cdot \frac{{b}^{2} \cdot \mathsf{PI}\left(\right)}{x-scale \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)}\right)\right)\right)}{angle}\right)}{\mathsf{PI}\left(\right)} \]
                                        6. Applied rewrites16.6%

                                          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{y-scale \cdot \mathsf{fma}\left(-180, \frac{b \cdot b}{x-scale \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right)}, 0.5 \cdot \left(\left(angle \cdot angle\right) \cdot \mathsf{fma}\left(-180, \frac{x-scale}{\mathsf{PI}\left(\right)} \cdot \frac{\mathsf{fma}\left(-6.17283950617284 \cdot 10^{-5}, \frac{\left(b \cdot b\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}{x-scale \cdot x-scale}, 6.17283950617284 \cdot 10^{-5} \cdot \frac{\left(a \cdot a\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)}{x-scale \cdot x-scale}\right)}{\left(a + b\right) \cdot \left(b - a\right)}, -0.007407407407407408 \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\mathsf{PI}\left(\right)}{\left(a + b\right) \cdot \left(b - a\right)}\right)\right)\right)\right)}{angle}\right)}{\mathsf{PI}\left(\right)} \]
                                        7. Taylor expanded in a around inf

                                          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{y-scale \cdot \mathsf{fma}\left(-180, \frac{b \cdot b}{x-scale \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right)}, \frac{1}{2} \cdot \left(\left(angle \cdot angle\right) \cdot \left(\frac{1}{90} \cdot \frac{\mathsf{PI}\left(\right)}{x-scale}\right)\right)\right)}{angle}\right)}{\mathsf{PI}\left(\right)} \]
                                        8. Step-by-step derivation
                                          1. Applied rewrites29.5%

                                            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\frac{y-scale \cdot \mathsf{fma}\left(-180, \frac{b \cdot b}{x-scale \cdot \left(\mathsf{PI}\left(\right) \cdot \left(\left(a + b\right) \cdot \left(b - a\right)\right)\right)}, 0.5 \cdot \left(\left(angle \cdot angle\right) \cdot \left(0.011111111111111112 \cdot \frac{\mathsf{PI}\left(\right)}{x-scale}\right)\right)\right)}{angle}\right)}{\mathsf{PI}\left(\right)} \]

                                          if 6.49999999999999989e-162 < b

                                          1. Initial program 20.3%

                                            \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
                                          2. Add Preprocessing
                                          3. Taylor expanded in angle around 0

                                            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(90 \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(2 \cdot \frac{{a}^{2}}{{y-scale}^{2}} - 2 \cdot \frac{{b}^{2}}{{x-scale}^{2}}\right)\right)}{angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                                          4. Step-by-step derivation
                                            1. *-commutativeN/A

                                              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{x-scale \cdot \left(y-scale \cdot \left(2 \cdot \frac{{a}^{2}}{{y-scale}^{2}} - 2 \cdot \frac{{b}^{2}}{{x-scale}^{2}}\right)\right)}{angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \cdot 90\right)}}{\mathsf{PI}\left(\right)} \]
                                            2. lower-*.f64N/A

                                              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{x-scale \cdot \left(y-scale \cdot \left(2 \cdot \frac{{a}^{2}}{{y-scale}^{2}} - 2 \cdot \frac{{b}^{2}}{{x-scale}^{2}}\right)\right)}{angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \cdot 90\right)}}{\mathsf{PI}\left(\right)} \]
                                          5. Applied rewrites18.3%

                                            \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{x-scale}{angle} \cdot \frac{\left(2 \cdot \left(\frac{a \cdot a}{y-scale \cdot y-scale} - \frac{b \cdot b}{x-scale \cdot x-scale}\right)\right) \cdot y-scale}{\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \mathsf{PI}\left(\right)}\right) \cdot 90\right)}}{\mathsf{PI}\left(\right)} \]
                                          6. Taylor expanded in a around inf

                                            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{x-scale}{angle} \cdot \frac{-2}{y-scale \cdot \mathsf{PI}\left(\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                          7. Step-by-step derivation
                                            1. Applied rewrites15.1%

                                              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{x-scale}{angle} \cdot \frac{-2}{y-scale \cdot \mathsf{PI}\left(\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                            2. Taylor expanded in a around 0

                                              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites52.8%

                                                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                            4. Recombined 2 regimes into one program.
                                            5. Add Preprocessing

                                            Alternative 8: 37.1% accurate, 21.5× speedup?

                                            \[\begin{array}{l} a_m = \left|a\right| \\ 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \end{array} \]
                                            a_m = (fabs.f64 a)
                                            (FPCore (a_m b angle x-scale y-scale)
                                             :precision binary64
                                             (*
                                              180.0
                                              (/ (atan (* (* -2.0 (/ y-scale (* angle (* x-scale (PI))))) 90.0)) (PI))))
                                            \begin{array}{l}
                                            a_m = \left|a\right|
                                            
                                            \\
                                            180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}
                                            \end{array}
                                            
                                            Derivation
                                            1. Initial program 13.7%

                                              \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
                                            2. Add Preprocessing
                                            3. Taylor expanded in angle around 0

                                              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(90 \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(2 \cdot \frac{{a}^{2}}{{y-scale}^{2}} - 2 \cdot \frac{{b}^{2}}{{x-scale}^{2}}\right)\right)}{angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                                            4. Step-by-step derivation
                                              1. *-commutativeN/A

                                                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{x-scale \cdot \left(y-scale \cdot \left(2 \cdot \frac{{a}^{2}}{{y-scale}^{2}} - 2 \cdot \frac{{b}^{2}}{{x-scale}^{2}}\right)\right)}{angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \cdot 90\right)}}{\mathsf{PI}\left(\right)} \]
                                              2. lower-*.f64N/A

                                                \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{x-scale \cdot \left(y-scale \cdot \left(2 \cdot \frac{{a}^{2}}{{y-scale}^{2}} - 2 \cdot \frac{{b}^{2}}{{x-scale}^{2}}\right)\right)}{angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \cdot 90\right)}}{\mathsf{PI}\left(\right)} \]
                                            5. Applied rewrites11.0%

                                              \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{x-scale}{angle} \cdot \frac{\left(2 \cdot \left(\frac{a \cdot a}{y-scale \cdot y-scale} - \frac{b \cdot b}{x-scale \cdot x-scale}\right)\right) \cdot y-scale}{\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \mathsf{PI}\left(\right)}\right) \cdot 90\right)}}{\mathsf{PI}\left(\right)} \]
                                            6. Taylor expanded in a around inf

                                              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{x-scale}{angle} \cdot \frac{-2}{y-scale \cdot \mathsf{PI}\left(\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                            7. Step-by-step derivation
                                              1. Applied rewrites10.8%

                                                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{x-scale}{angle} \cdot \frac{-2}{y-scale \cdot \mathsf{PI}\left(\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                              2. Taylor expanded in a around 0

                                                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites40.8%

                                                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                                2. Add Preprocessing

                                                Alternative 9: 11.3% accurate, 21.5× speedup?

                                                \[\begin{array}{l} a_m = \left|a\right| \\ 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \end{array} \]
                                                a_m = (fabs.f64 a)
                                                (FPCore (a_m b angle x-scale y-scale)
                                                 :precision binary64
                                                 (*
                                                  180.0
                                                  (/ (atan (* (* -2.0 (/ x-scale (* angle (* y-scale (PI))))) 90.0)) (PI))))
                                                \begin{array}{l}
                                                a_m = \left|a\right|
                                                
                                                \\
                                                180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}
                                                \end{array}
                                                
                                                Derivation
                                                1. Initial program 13.7%

                                                  \[180 \cdot \frac{\tan^{-1} \left(\frac{\left(\frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale} - \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale}\right) - \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}\right)}^{2}}}{\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \mathsf{PI}\left(\right)\right)}{x-scale}}{y-scale}}\right)}{\mathsf{PI}\left(\right)} \]
                                                2. Add Preprocessing
                                                3. Taylor expanded in angle around 0

                                                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(90 \cdot \frac{x-scale \cdot \left(y-scale \cdot \left(2 \cdot \frac{{a}^{2}}{{y-scale}^{2}} - 2 \cdot \frac{{b}^{2}}{{x-scale}^{2}}\right)\right)}{angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)}\right)}}{\mathsf{PI}\left(\right)} \]
                                                4. Step-by-step derivation
                                                  1. *-commutativeN/A

                                                    \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{x-scale \cdot \left(y-scale \cdot \left(2 \cdot \frac{{a}^{2}}{{y-scale}^{2}} - 2 \cdot \frac{{b}^{2}}{{x-scale}^{2}}\right)\right)}{angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \cdot 90\right)}}{\mathsf{PI}\left(\right)} \]
                                                  2. lower-*.f64N/A

                                                    \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\frac{x-scale \cdot \left(y-scale \cdot \left(2 \cdot \frac{{a}^{2}}{{y-scale}^{2}} - 2 \cdot \frac{{b}^{2}}{{x-scale}^{2}}\right)\right)}{angle \cdot \left(\mathsf{PI}\left(\right) \cdot \left({b}^{2} - {a}^{2}\right)\right)} \cdot 90\right)}}{\mathsf{PI}\left(\right)} \]
                                                5. Applied rewrites11.0%

                                                  \[\leadsto 180 \cdot \frac{\tan^{-1} \color{blue}{\left(\left(\frac{x-scale}{angle} \cdot \frac{\left(2 \cdot \left(\frac{a \cdot a}{y-scale \cdot y-scale} - \frac{b \cdot b}{x-scale \cdot x-scale}\right)\right) \cdot y-scale}{\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \mathsf{PI}\left(\right)}\right) \cdot 90\right)}}{\mathsf{PI}\left(\right)} \]
                                                6. Taylor expanded in a around inf

                                                  \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{x-scale}{angle} \cdot \frac{-2}{y-scale \cdot \mathsf{PI}\left(\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                                7. Step-by-step derivation
                                                  1. Applied rewrites10.8%

                                                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(\frac{x-scale}{angle} \cdot \frac{-2}{y-scale \cdot \mathsf{PI}\left(\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                                  2. Taylor expanded in a around inf

                                                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites10.8%

                                                      \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                                    2. Add Preprocessing

                                                    Reproduce

                                                    ?
                                                    herbie shell --seed 2024332 
                                                    (FPCore (a b angle x-scale y-scale)
                                                      :name "raw-angle from scale-rotated-ellipse"
                                                      :precision binary64
                                                      (* 180.0 (/ (atan (/ (- (- (/ (/ (+ (pow (* a (cos (* (/ angle 180.0) (PI)))) 2.0) (pow (* b (sin (* (/ angle 180.0) (PI)))) 2.0)) y-scale) y-scale) (/ (/ (+ (pow (* a (sin (* (/ angle 180.0) (PI)))) 2.0) (pow (* b (cos (* (/ angle 180.0) (PI)))) 2.0)) x-scale) x-scale)) (sqrt (+ (pow (- (/ (/ (+ (pow (* a (sin (* (/ angle 180.0) (PI)))) 2.0) (pow (* b (cos (* (/ angle 180.0) (PI)))) 2.0)) x-scale) x-scale) (/ (/ (+ (pow (* a (cos (* (/ angle 180.0) (PI)))) 2.0) (pow (* b (sin (* (/ angle 180.0) (PI)))) 2.0)) y-scale) y-scale)) 2.0) (pow (/ (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) (PI)))) (cos (* (/ angle 180.0) (PI)))) x-scale) y-scale) 2.0)))) (/ (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) (PI)))) (cos (* (/ angle 180.0) (PI)))) x-scale) y-scale))) (PI))))