raw-angle from scale-rotated-ellipse

Percentage Accurate: 14.0% → 56.7%
Time: 26.6s
Alternatives: 8
Speedup: 22.2×

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 8 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: 14.0% 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.7% accurate, 4.7× speedup?

\[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} t_0 := angle \cdot \mathsf{PI}\left(\right)\\ t_1 := \sin \left(0.005555555555555556 \cdot t\_0\right)\\ t_2 := \sqrt[3]{\mathsf{PI}\left(\right)}\\ \mathbf{if}\;a\_m \leq 2.7 \cdot 10^{-89}:\\ \;\;\;\;180 \cdot \frac{\frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(\cos \left(\mathsf{fma}\left(angle \cdot 0.005555555555555556, \mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right), y-scale, 0\right)}{x-scale \cdot t\_1}\right)}{{t\_2}^{2}}}{t\_2}\\ \mathbf{elif}\;a\_m \leq 8.5 \cdot 10^{+201}:\\ \;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \left(\left(\frac{y-scale}{x-scale} \cdot -2\right) \cdot \tan \left(t\_0 \cdot 0.005555555555555556\right)\right)\right) \cdot 180}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{t\_1}{1}\right)\right) \cdot -0.5\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 (sin (* 0.005555555555555556 t_0)))
        (t_2 (cbrt (PI))))
   (if (<= a_m 2.7e-89)
     (*
      180.0
      (/
       (/
        (atan
         (/
          (fma
           (cos (fma (* angle 0.005555555555555556) (PI) (PI)))
           y-scale
           0.0)
          (* x-scale t_1)))
        (pow t_2 2.0))
       t_2))
     (if (<= a_m 8.5e+201)
       (/
        (*
         (atan
          (*
           -0.5
           (*
            (* (/ y-scale x-scale) -2.0)
            (tan (* t_0 0.005555555555555556)))))
         180.0)
        (PI))
       (*
        180.0
        (/
         (atan (* (* -2.0 (* (/ y-scale x-scale) (/ t_1 1.0))) -0.5))
         (PI)))))))
\begin{array}{l}
a_m = \left|a\right|

\\
\begin{array}{l}
t_0 := angle \cdot \mathsf{PI}\left(\right)\\
t_1 := \sin \left(0.005555555555555556 \cdot t\_0\right)\\
t_2 := \sqrt[3]{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;a\_m \leq 2.7 \cdot 10^{-89}:\\
\;\;\;\;180 \cdot \frac{\frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(\cos \left(\mathsf{fma}\left(angle \cdot 0.005555555555555556, \mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right), y-scale, 0\right)}{x-scale \cdot t\_1}\right)}{{t\_2}^{2}}}{t\_2}\\

\mathbf{elif}\;a\_m \leq 8.5 \cdot 10^{+201}:\\
\;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \left(\left(\frac{y-scale}{x-scale} \cdot -2\right) \cdot \tan \left(t\_0 \cdot 0.005555555555555556\right)\right)\right) \cdot 180}{\mathsf{PI}\left(\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < 2.69999999999999988e-89

    1. Initial program 13.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 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)} \]
    4. Applied rewrites27.3%

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

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

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

        \[\leadsto 180 \cdot \frac{\frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, y-scale \cdot \cos \left(-0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right), \frac{y-scale \cdot \left(\cos \left(-0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(0 \cdot a\right)\right)}{b}\right)}{\color{blue}{x-scale \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)}{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}}{\sqrt[3]{\mathsf{PI}\left(\right)}} \]
      2. Applied rewrites45.0%

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

      if 2.69999999999999988e-89 < a < 8.5e201

      1. Initial program 9.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 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)} \]
      4. Applied rewrites23.7%

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

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

          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \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) \cdot -0.5\right)}{\mathsf{PI}\left(\right)} \]
        2. Step-by-step derivation
          1. Applied rewrites56.1%

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

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

          if 8.5e201 < a

          1. Initial program 0.0%

            \[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 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)} \]
          4. Applied rewrites0.0%

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

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

              \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \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) \cdot -0.5\right)}{\mathsf{PI}\left(\right)} \]
            2. Taylor expanded in angle around 0

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

                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{1}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)} \]
            4. Recombined 3 regimes into one program.
            5. Final simplification50.3%

              \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 2.7 \cdot 10^{-89}:\\ \;\;\;\;180 \cdot \frac{\frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(\cos \left(\mathsf{fma}\left(angle \cdot 0.005555555555555556, \mathsf{PI}\left(\right), \mathsf{PI}\left(\right)\right)\right), y-scale, 0\right)}{x-scale \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}\right)}{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}}{\sqrt[3]{\mathsf{PI}\left(\right)}}\\ \mathbf{elif}\;a \leq 8.5 \cdot 10^{+201}:\\ \;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \left(\left(\frac{y-scale}{x-scale} \cdot -2\right) \cdot \tan \left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot 0.005555555555555556\right)\right)\right) \cdot 180}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{1}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
            6. Add Preprocessing

            Alternative 2: 56.7% accurate, 8.7× speedup?

            \[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} t_0 := angle \cdot \mathsf{PI}\left(\right)\\ t_1 := t\_0 \cdot 0.005555555555555556\\ \mathbf{if}\;a\_m \leq 2.7 \cdot 10^{-89}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-y-scale, \cos t\_1, 0\right)}{\sin t\_1 \cdot x-scale}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;a\_m \leq 8.5 \cdot 10^{+201}:\\ \;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \left(\left(\frac{y-scale}{x-scale} \cdot -2\right) \cdot \tan t\_1\right)\right) \cdot 180}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\sin \left(0.005555555555555556 \cdot t\_0\right)}{1}\right)\right) \cdot -0.5\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 (* t_0 0.005555555555555556)))
               (if (<= a_m 2.7e-89)
                 (*
                  180.0
                  (/
                   (atan (/ (fma (- y-scale) (cos t_1) 0.0) (* (sin t_1) x-scale)))
                   (PI)))
                 (if (<= a_m 8.5e+201)
                   (/
                    (* (atan (* -0.5 (* (* (/ y-scale x-scale) -2.0) (tan t_1)))) 180.0)
                    (PI))
                   (*
                    180.0
                    (/
                     (atan
                      (*
                       (*
                        -2.0
                        (* (/ y-scale x-scale) (/ (sin (* 0.005555555555555556 t_0)) 1.0)))
                       -0.5))
                     (PI)))))))
            \begin{array}{l}
            a_m = \left|a\right|
            
            \\
            \begin{array}{l}
            t_0 := angle \cdot \mathsf{PI}\left(\right)\\
            t_1 := t\_0 \cdot 0.005555555555555556\\
            \mathbf{if}\;a\_m \leq 2.7 \cdot 10^{-89}:\\
            \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-y-scale, \cos t\_1, 0\right)}{\sin t\_1 \cdot x-scale}\right)}{\mathsf{PI}\left(\right)}\\
            
            \mathbf{elif}\;a\_m \leq 8.5 \cdot 10^{+201}:\\
            \;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \left(\left(\frac{y-scale}{x-scale} \cdot -2\right) \cdot \tan t\_1\right)\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
            
            \mathbf{else}:\\
            \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\sin \left(0.005555555555555556 \cdot t\_0\right)}{1}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if a < 2.69999999999999988e-89

              1. Initial program 13.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 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)} \]
              4. Applied rewrites27.3%

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

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

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

                  \[\leadsto 180 \cdot \frac{\frac{\tan^{-1} \left(\frac{\mathsf{fma}\left(-1, y-scale \cdot \cos \left(-0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right), \frac{y-scale \cdot \left(\cos \left(-0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(0 \cdot a\right)\right)}{b}\right)}{\color{blue}{x-scale \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}}\right)}{{\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}}}{\sqrt[3]{\mathsf{PI}\left(\right)}} \]
                2. Applied rewrites45.8%

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

                if 2.69999999999999988e-89 < a < 8.5e201

                1. Initial program 9.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 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)} \]
                4. Applied rewrites23.7%

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

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

                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \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) \cdot -0.5\right)}{\mathsf{PI}\left(\right)} \]
                  2. Step-by-step derivation
                    1. Applied rewrites56.1%

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

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

                    if 8.5e201 < a

                    1. Initial program 0.0%

                      \[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 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)} \]
                    4. Applied rewrites0.0%

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

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

                        \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \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) \cdot -0.5\right)}{\mathsf{PI}\left(\right)} \]
                      2. Taylor expanded in angle around 0

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

                          \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{1}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)} \]
                      4. Recombined 3 regimes into one program.
                      5. Final simplification50.9%

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

                      Alternative 3: 54.8% accurate, 11.3× speedup?

                      \[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} t_0 := angle \cdot \mathsf{PI}\left(\right)\\ \mathbf{if}\;a\_m \leq 1.6 \cdot 10^{-113}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;a\_m \leq 3.8 \cdot 10^{-45} \lor \neg \left(a\_m \leq 8.5 \cdot 10^{+201}\right):\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\sin \left(0.005555555555555556 \cdot t\_0\right)}{1}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \left(\left(\frac{y-scale}{x-scale} \cdot -2\right) \cdot \tan \left(t\_0 \cdot 0.005555555555555556\right)\right)\right) \cdot 180}{\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))))
                         (if (<= a_m 1.6e-113)
                           (*
                            180.0
                            (/ (atan (* -180.0 (/ y-scale (* angle (* x-scale (PI)))))) (PI)))
                           (if (or (<= a_m 3.8e-45) (not (<= a_m 8.5e+201)))
                             (*
                              180.0
                              (/
                               (atan
                                (*
                                 (*
                                  -2.0
                                  (* (/ y-scale x-scale) (/ (sin (* 0.005555555555555556 t_0)) 1.0)))
                                 -0.5))
                               (PI)))
                             (/
                              (*
                               (atan
                                (*
                                 -0.5
                                 (*
                                  (* (/ y-scale x-scale) -2.0)
                                  (tan (* t_0 0.005555555555555556)))))
                               180.0)
                              (PI))))))
                      \begin{array}{l}
                      a_m = \left|a\right|
                      
                      \\
                      \begin{array}{l}
                      t_0 := angle \cdot \mathsf{PI}\left(\right)\\
                      \mathbf{if}\;a\_m \leq 1.6 \cdot 10^{-113}:\\
                      \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}\\
                      
                      \mathbf{elif}\;a\_m \leq 3.8 \cdot 10^{-45} \lor \neg \left(a\_m \leq 8.5 \cdot 10^{+201}\right):\\
                      \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\sin \left(0.005555555555555556 \cdot t\_0\right)}{1}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \left(\left(\frac{y-scale}{x-scale} \cdot -2\right) \cdot \tan \left(t\_0 \cdot 0.005555555555555556\right)\right)\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if a < 1.6000000000000001e-113

                        1. Initial program 13.0%

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

                          \[\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(-2 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                        7. Step-by-step derivation
                          1. Applied rewrites13.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. Taylor expanded in a around 0

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

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

                            if 1.6000000000000001e-113 < a < 3.79999999999999997e-45 or 8.5e201 < a

                            1. Initial program 8.1%

                              \[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 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)} \]
                            4. Applied rewrites16.1%

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

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

                                \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \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) \cdot -0.5\right)}{\mathsf{PI}\left(\right)} \]
                              2. Taylor expanded in angle around 0

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

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

                                if 3.79999999999999997e-45 < a < 8.5e201

                                1. Initial program 8.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 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)} \]
                                4. Applied rewrites25.9%

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

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

                                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \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) \cdot -0.5\right)}{\mathsf{PI}\left(\right)} \]
                                  2. Step-by-step derivation
                                    1. Applied rewrites53.3%

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

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

                                    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 1.6 \cdot 10^{-113}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{elif}\;a \leq 3.8 \cdot 10^{-45} \lor \neg \left(a \leq 8.5 \cdot 10^{+201}\right):\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \cdot \frac{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}{1}\right)\right) \cdot -0.5\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \left(\left(\frac{y-scale}{x-scale} \cdot -2\right) \cdot \tan \left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot 0.005555555555555556\right)\right)\right) \cdot 180}{\mathsf{PI}\left(\right)}\\ \end{array} \]
                                  5. Add Preprocessing

                                  Alternative 4: 54.7% accurate, 12.3× speedup?

                                  \[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} \mathbf{if}\;a\_m \leq 5 \cdot 10^{-91}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \left(\left(\frac{y-scale}{x-scale} \cdot -2\right) \cdot \tan \left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot 0.005555555555555556\right)\right)\right) \cdot 180}{\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 (<= a_m 5e-91)
                                     (* 180.0 (/ (atan (* -180.0 (/ y-scale (* angle (* x-scale (PI)))))) (PI)))
                                     (/
                                      (*
                                       (atan
                                        (*
                                         -0.5
                                         (*
                                          (* (/ y-scale x-scale) -2.0)
                                          (tan (* (* angle (PI)) 0.005555555555555556)))))
                                       180.0)
                                      (PI))))
                                  \begin{array}{l}
                                  a_m = \left|a\right|
                                  
                                  \\
                                  \begin{array}{l}
                                  \mathbf{if}\;a\_m \leq 5 \cdot 10^{-91}:\\
                                  \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\frac{\tan^{-1} \left(-0.5 \cdot \left(\left(\frac{y-scale}{x-scale} \cdot -2\right) \cdot \tan \left(\left(angle \cdot \mathsf{PI}\left(\right)\right) \cdot 0.005555555555555556\right)\right)\right) \cdot 180}{\mathsf{PI}\left(\right)}\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if a < 4.99999999999999997e-91

                                    1. Initial program 13.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 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 rewrites14.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(-2 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                    7. Step-by-step derivation
                                      1. Applied rewrites13.7%

                                        \[\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. Taylor expanded in a around 0

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

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

                                        if 4.99999999999999997e-91 < a

                                        1. Initial program 6.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 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)} \]
                                        4. Applied rewrites17.0%

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

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

                                            \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \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) \cdot -0.5\right)}{\mathsf{PI}\left(\right)} \]
                                          2. Step-by-step derivation
                                            1. Applied rewrites60.7%

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

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

                                          Alternative 5: 54.7% accurate, 12.3× speedup?

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

                                            1. Initial program 13.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 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 rewrites14.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(-2 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                            7. Step-by-step derivation
                                              1. Applied rewrites13.7%

                                                \[\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. Taylor expanded in a around 0

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

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

                                                if 4.99999999999999997e-91 < a

                                                1. Initial program 6.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 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)} \]
                                                4. Applied rewrites17.0%

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

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

                                                    \[\leadsto 180 \cdot \frac{\tan^{-1} \left(\left(-2 \cdot \left(\frac{y-scale}{x-scale} \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) \cdot -0.5\right)}{\mathsf{PI}\left(\right)} \]
                                                  2. Step-by-step derivation
                                                    1. Applied rewrites60.7%

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

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

                                                  Alternative 6: 39.5% accurate, 19.1× speedup?

                                                  \[\begin{array}{l} a_m = \left|a\right| \\ \begin{array}{l} \mathbf{if}\;y-scale \leq -2.85 \cdot 10^{+76}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(\left(-x-scale\right) \cdot \left(2 \cdot \frac{y-scale}{angle \cdot \left(\left(x-scale \cdot x-scale\right) \cdot \mathsf{PI}\left(\right)\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 (<= y-scale -2.85e+76)
                                                     (* 180.0 (/ (atan (* -180.0 (/ y-scale (* angle (* x-scale (PI)))))) (PI)))
                                                     (*
                                                      180.0
                                                      (/
                                                       (atan
                                                        (*
                                                         (*
                                                          (- x-scale)
                                                          (* 2.0 (/ y-scale (* angle (* (* x-scale x-scale) (PI))))))
                                                         90.0))
                                                       (PI)))))
                                                  \begin{array}{l}
                                                  a_m = \left|a\right|
                                                  
                                                  \\
                                                  \begin{array}{l}
                                                  \mathbf{if}\;y-scale \leq -2.85 \cdot 10^{+76}:\\
                                                  \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}\\
                                                  
                                                  \mathbf{else}:\\
                                                  \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(\left(-x-scale\right) \cdot \left(2 \cdot \frac{y-scale}{angle \cdot \left(\left(x-scale \cdot x-scale\right) \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}\\
                                                  
                                                  
                                                  \end{array}
                                                  \end{array}
                                                  
                                                  Derivation
                                                  1. Split input into 2 regimes
                                                  2. if y-scale < -2.85000000000000002e76

                                                    1. Initial program 17.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 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 rewrites9.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(-2 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                                    7. Step-by-step derivation
                                                      1. Applied rewrites9.5%

                                                        \[\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. Taylor expanded in a around 0

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

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

                                                        if -2.85000000000000002e76 < y-scale

                                                        1. Initial program 10.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 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.5%

                                                          \[\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 x-scale around -inf

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

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

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

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

                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;y-scale \leq -2.85 \cdot 10^{+76}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}\\ \mathbf{else}:\\ \;\;\;\;180 \cdot \frac{\tan^{-1} \left(\left(\left(-x-scale\right) \cdot \left(2 \cdot \frac{y-scale}{angle \cdot \left(\left(x-scale \cdot x-scale\right) \cdot \mathsf{PI}\left(\right)\right)}\right)\right) \cdot 90\right)}{\mathsf{PI}\left(\right)}\\ \end{array} \]
                                                          6. Add Preprocessing

                                                          Alternative 7: 37.9% accurate, 22.2× speedup?

                                                          \[\begin{array}{l} a_m = \left|a\right| \\ 180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\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 (* -180.0 (/ y-scale (* angle (* x-scale (PI)))))) (PI))))
                                                          \begin{array}{l}
                                                          a_m = \left|a\right|
                                                          
                                                          \\
                                                          180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}
                                                          \end{array}
                                                          
                                                          Derivation
                                                          1. Initial program 11.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 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.1%

                                                            \[\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(-2 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                                          7. Step-by-step derivation
                                                            1. Applied rewrites11.3%

                                                              \[\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. Taylor expanded in a around 0

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

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

                                                              Alternative 8: 12.1% accurate, 22.2× speedup?

                                                              \[\begin{array}{l} a_m = \left|a\right| \\ 180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}\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 (* -180.0 (/ x-scale (* angle (* y-scale (PI)))))) (PI))))
                                                              \begin{array}{l}
                                                              a_m = \left|a\right|
                                                              
                                                              \\
                                                              180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}\right)}{\mathsf{PI}\left(\right)}
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Initial program 11.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 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.1%

                                                                \[\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(-2 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \mathsf{PI}\left(\right)\right)}\right) \cdot 90\right)}{\mathsf{PI}\left(\right)} \]
                                                              7. Step-by-step derivation
                                                                1. Applied rewrites11.3%

                                                                  \[\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. Taylor expanded in a around inf

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

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

                                                                  Reproduce

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