a from scale-rotated-ellipse

Percentage Accurate: 2.6% → 55.1%
Time: 37.7s
Alternatives: 8
Speedup: 484.7×

Specification

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

\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
t_1 := \sin t\_0\\
t_2 := \cos t\_0\\
t_3 := \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale}\\
t_4 := \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\\
t_5 := \left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\\
t_6 := \frac{4 \cdot t\_5}{{\left(x-scale \cdot y-scale\right)}^{2}}\\
\frac{-\sqrt{\left(\left(2 \cdot t\_6\right) \cdot t\_5\right) \cdot \left(\left(t\_4 + t\_3\right) + \sqrt{{\left(t\_4 - t\_3\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\right)}^{2}}\right)}}{t\_6}
\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: 2.6% accurate, 1.0× speedup?

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

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

Alternative 1: 55.1% accurate, 4.4× speedup?

\[\begin{array}{l} y-scale_m = \left|y-scale\right| \\ x-scale_m = \left|x-scale\right| \\ b_m = \left|b\right| \\ \begin{array}{l} t_0 := \sqrt[3]{\mathsf{PI}\left(\right)}\\ \mathbf{if}\;y-scale\_m \leq 1.95 \cdot 10^{+98}:\\ \;\;\;\;\left(\left(0.25 \cdot x-scale\_m\right) \cdot 4\right) \cdot \mathsf{hypot}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot b\_m, \cos \left(\left({t\_0}^{2} \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot t\_0\right) \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;b\_m \cdot y-scale\_m\\ \end{array} \end{array} \]
y-scale_m = (fabs.f64 y-scale)
x-scale_m = (fabs.f64 x-scale)
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale_m y-scale_m)
 :precision binary64
 (let* ((t_0 (cbrt (PI))))
   (if (<= y-scale_m 1.95e+98)
     (*
      (* (* 0.25 x-scale_m) 4.0)
      (hypot
       (* (sin (* (PI) (* 0.005555555555555556 angle))) b_m)
       (* (cos (* (* (pow t_0 2.0) (* 0.005555555555555556 angle)) t_0)) a)))
     (* b_m y-scale_m))))
\begin{array}{l}
y-scale_m = \left|y-scale\right|
\\
x-scale_m = \left|x-scale\right|
\\
b_m = \left|b\right|

\\
\begin{array}{l}
t_0 := \sqrt[3]{\mathsf{PI}\left(\right)}\\
\mathbf{if}\;y-scale\_m \leq 1.95 \cdot 10^{+98}:\\
\;\;\;\;\left(\left(0.25 \cdot x-scale\_m\right) \cdot 4\right) \cdot \mathsf{hypot}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot b\_m, \cos \left(\left({t\_0}^{2} \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot t\_0\right) \cdot a\right)\\

\mathbf{else}:\\
\;\;\;\;b\_m \cdot y-scale\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y-scale < 1.95e98

    1. Initial program 3.8%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Add Preprocessing
    3. Taylor expanded in y-scale around 0

      \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot \left(x-scale \cdot \sqrt{8}\right)\right)} \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)} \]
      4. *-commutativeN/A

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

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

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

        \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \color{blue}{\sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}} \]
      8. distribute-lft-outN/A

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

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

      \[\leadsto \color{blue}{\left(0.25 \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(b \cdot b, {\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}, \left(a \cdot a\right) \cdot {\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}\right)}} \]
    6. Applied rewrites27.7%

      \[\leadsto \sqrt{2} \cdot \color{blue}{\left(\mathsf{hypot}\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b, \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot a\right) \cdot \left(\left(\sqrt{8} \cdot x-scale\right) \cdot 0.25\right)\right)} \]
    7. Step-by-step derivation
      1. Applied rewrites27.8%

        \[\leadsto \mathsf{hypot}\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b, \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot a\right) \cdot \color{blue}{\left(4 \cdot \left(0.25 \cdot x-scale\right)\right)} \]
      2. Step-by-step derivation
        1. Applied rewrites27.9%

          \[\leadsto \mathsf{hypot}\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b, \cos \left(\left(\left(0.005555555555555556 \cdot angle\right) \cdot {\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2}\right) \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot a\right) \cdot \left(4 \cdot \left(0.25 \cdot x-scale\right)\right) \]

        if 1.95e98 < y-scale

        1. Initial program 4.8%

          \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
        2. Add Preprocessing
        3. Taylor expanded in angle around 0

          \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
        4. Step-by-step derivation
          1. associate-*r*N/A

            \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right) \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
          2. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right) \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
          3. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right)} \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right) \]
          4. associate-*r*N/A

            \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \color{blue}{\left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
          5. lower-*.f64N/A

            \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \color{blue}{\left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
          6. lower-*.f64N/A

            \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \left(\color{blue}{\left(y-scale \cdot \sqrt{2}\right)} \cdot \sqrt{8}\right) \]
          7. lower-sqrt.f64N/A

            \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \left(\left(y-scale \cdot \color{blue}{\sqrt{2}}\right) \cdot \sqrt{8}\right) \]
          8. lower-sqrt.f6424.6

            \[\leadsto \left(0.25 \cdot b\right) \cdot \left(\left(y-scale \cdot \sqrt{2}\right) \cdot \color{blue}{\sqrt{8}}\right) \]
        5. Applied rewrites24.6%

          \[\leadsto \color{blue}{\left(0.25 \cdot b\right) \cdot \left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
        6. Step-by-step derivation
          1. Applied rewrites24.7%

            \[\leadsto \left(\left(0.25 \cdot b\right) \cdot y-scale\right) \cdot \color{blue}{4} \]
          2. Taylor expanded in b around 0

            \[\leadsto b \cdot \color{blue}{y-scale} \]
          3. Step-by-step derivation
            1. Applied rewrites24.7%

              \[\leadsto b \cdot \color{blue}{y-scale} \]
          4. Recombined 2 regimes into one program.
          5. Final simplification27.3%

            \[\leadsto \begin{array}{l} \mathbf{if}\;y-scale \leq 1.95 \cdot 10^{+98}:\\ \;\;\;\;\left(\left(0.25 \cdot x-scale\right) \cdot 4\right) \cdot \mathsf{hypot}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot b, \cos \left(\left({\left(\sqrt[3]{\mathsf{PI}\left(\right)}\right)}^{2} \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot \sqrt[3]{\mathsf{PI}\left(\right)}\right) \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot y-scale\\ \end{array} \]
          6. Add Preprocessing

          Alternative 2: 55.2% accurate, 8.2× speedup?

          \[\begin{array}{l} y-scale_m = \left|y-scale\right| \\ x-scale_m = \left|x-scale\right| \\ b_m = \left|b\right| \\ \begin{array}{l} \mathbf{if}\;y-scale\_m \leq 1.95 \cdot 10^{+98}:\\ \;\;\;\;\mathsf{hypot}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot b\_m, \cos \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\right) \cdot a\right) \cdot \left(\left(0.25 \cdot x-scale\_m\right) \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;b\_m \cdot y-scale\_m\\ \end{array} \end{array} \]
          y-scale_m = (fabs.f64 y-scale)
          x-scale_m = (fabs.f64 x-scale)
          b_m = (fabs.f64 b)
          (FPCore (a b_m angle x-scale_m y-scale_m)
           :precision binary64
           (if (<= y-scale_m 1.95e+98)
             (*
              (hypot
               (* (sin (* (PI) (* 0.005555555555555556 angle))) b_m)
               (* (cos (* (* (PI) 0.005555555555555556) angle)) a))
              (* (* 0.25 x-scale_m) 4.0))
             (* b_m y-scale_m)))
          \begin{array}{l}
          y-scale_m = \left|y-scale\right|
          \\
          x-scale_m = \left|x-scale\right|
          \\
          b_m = \left|b\right|
          
          \\
          \begin{array}{l}
          \mathbf{if}\;y-scale\_m \leq 1.95 \cdot 10^{+98}:\\
          \;\;\;\;\mathsf{hypot}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot b\_m, \cos \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\right) \cdot a\right) \cdot \left(\left(0.25 \cdot x-scale\_m\right) \cdot 4\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;b\_m \cdot y-scale\_m\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y-scale < 1.95e98

            1. Initial program 3.8%

              \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
            2. Add Preprocessing
            3. Taylor expanded in y-scale around 0

              \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}\right)} \]
            4. Step-by-step derivation
              1. associate-*r*N/A

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

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

                \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot \left(x-scale \cdot \sqrt{8}\right)\right)} \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)} \]
              4. *-commutativeN/A

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

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

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

                \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \color{blue}{\sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}} \]
              8. distribute-lft-outN/A

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

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

              \[\leadsto \color{blue}{\left(0.25 \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(b \cdot b, {\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}, \left(a \cdot a\right) \cdot {\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}\right)}} \]
            6. Applied rewrites27.7%

              \[\leadsto \sqrt{2} \cdot \color{blue}{\left(\mathsf{hypot}\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b, \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot a\right) \cdot \left(\left(\sqrt{8} \cdot x-scale\right) \cdot 0.25\right)\right)} \]
            7. Step-by-step derivation
              1. Applied rewrites27.8%

                \[\leadsto \mathsf{hypot}\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b, \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot a\right) \cdot \color{blue}{\left(4 \cdot \left(0.25 \cdot x-scale\right)\right)} \]
              2. Step-by-step derivation
                1. Applied rewrites27.9%

                  \[\leadsto \mathsf{hypot}\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b, \cos \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\right) \cdot a\right) \cdot \left(4 \cdot \left(0.25 \cdot x-scale\right)\right) \]

                if 1.95e98 < y-scale

                1. Initial program 4.8%

                  \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
                2. Add Preprocessing
                3. Taylor expanded in angle around 0

                  \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
                4. Step-by-step derivation
                  1. associate-*r*N/A

                    \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right) \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                  2. lower-*.f64N/A

                    \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right) \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                  3. lower-*.f64N/A

                    \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right)} \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right) \]
                  4. associate-*r*N/A

                    \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \color{blue}{\left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                  5. lower-*.f64N/A

                    \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \color{blue}{\left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                  6. lower-*.f64N/A

                    \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \left(\color{blue}{\left(y-scale \cdot \sqrt{2}\right)} \cdot \sqrt{8}\right) \]
                  7. lower-sqrt.f64N/A

                    \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \left(\left(y-scale \cdot \color{blue}{\sqrt{2}}\right) \cdot \sqrt{8}\right) \]
                  8. lower-sqrt.f6424.6

                    \[\leadsto \left(0.25 \cdot b\right) \cdot \left(\left(y-scale \cdot \sqrt{2}\right) \cdot \color{blue}{\sqrt{8}}\right) \]
                5. Applied rewrites24.6%

                  \[\leadsto \color{blue}{\left(0.25 \cdot b\right) \cdot \left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                6. Step-by-step derivation
                  1. Applied rewrites24.7%

                    \[\leadsto \left(\left(0.25 \cdot b\right) \cdot y-scale\right) \cdot \color{blue}{4} \]
                  2. Taylor expanded in b around 0

                    \[\leadsto b \cdot \color{blue}{y-scale} \]
                  3. Step-by-step derivation
                    1. Applied rewrites24.7%

                      \[\leadsto b \cdot \color{blue}{y-scale} \]
                  4. Recombined 2 regimes into one program.
                  5. Final simplification27.3%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;y-scale \leq 1.95 \cdot 10^{+98}:\\ \;\;\;\;\mathsf{hypot}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot b, \cos \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\right) \cdot a\right) \cdot \left(\left(0.25 \cdot x-scale\right) \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot y-scale\\ \end{array} \]
                  6. Add Preprocessing

                  Alternative 3: 55.1% accurate, 8.5× speedup?

                  \[\begin{array}{l} y-scale_m = \left|y-scale\right| \\ x-scale_m = \left|x-scale\right| \\ b_m = \left|b\right| \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\\ \mathbf{if}\;y-scale\_m \leq 1.95 \cdot 10^{+98}:\\ \;\;\;\;\mathsf{hypot}\left(\sin t\_0 \cdot b\_m, \cos t\_0 \cdot a\right) \cdot x-scale\_m\\ \mathbf{else}:\\ \;\;\;\;b\_m \cdot y-scale\_m\\ \end{array} \end{array} \]
                  y-scale_m = (fabs.f64 y-scale)
                  x-scale_m = (fabs.f64 x-scale)
                  b_m = (fabs.f64 b)
                  (FPCore (a b_m angle x-scale_m y-scale_m)
                   :precision binary64
                   (let* ((t_0 (* (PI) (* 0.005555555555555556 angle))))
                     (if (<= y-scale_m 1.95e+98)
                       (* (hypot (* (sin t_0) b_m) (* (cos t_0) a)) x-scale_m)
                       (* b_m y-scale_m))))
                  \begin{array}{l}
                  y-scale_m = \left|y-scale\right|
                  \\
                  x-scale_m = \left|x-scale\right|
                  \\
                  b_m = \left|b\right|
                  
                  \\
                  \begin{array}{l}
                  t_0 := \mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\\
                  \mathbf{if}\;y-scale\_m \leq 1.95 \cdot 10^{+98}:\\
                  \;\;\;\;\mathsf{hypot}\left(\sin t\_0 \cdot b\_m, \cos t\_0 \cdot a\right) \cdot x-scale\_m\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;b\_m \cdot y-scale\_m\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if y-scale < 1.95e98

                    1. Initial program 3.8%

                      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
                    2. Add Preprocessing
                    3. Taylor expanded in y-scale around 0

                      \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}\right)} \]
                    4. Step-by-step derivation
                      1. associate-*r*N/A

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

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

                        \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot \left(x-scale \cdot \sqrt{8}\right)\right)} \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)} \]
                      4. *-commutativeN/A

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

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

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

                        \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \color{blue}{\sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}} \]
                      8. distribute-lft-outN/A

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

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

                      \[\leadsto \color{blue}{\left(0.25 \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(b \cdot b, {\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}, \left(a \cdot a\right) \cdot {\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}\right)}} \]
                    6. Applied rewrites27.7%

                      \[\leadsto \sqrt{2} \cdot \color{blue}{\left(\mathsf{hypot}\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b, \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot a\right) \cdot \left(\left(\sqrt{8} \cdot x-scale\right) \cdot 0.25\right)\right)} \]
                    7. Step-by-step derivation
                      1. Applied rewrites27.8%

                        \[\leadsto \mathsf{hypot}\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b, \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot a\right) \cdot \color{blue}{\left(4 \cdot \left(0.25 \cdot x-scale\right)\right)} \]
                      2. Step-by-step derivation
                        1. Applied rewrites27.8%

                          \[\leadsto \mathsf{hypot}\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b, \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot a\right) \cdot x-scale \]

                        if 1.95e98 < y-scale

                        1. Initial program 4.8%

                          \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
                        2. Add Preprocessing
                        3. Taylor expanded in angle around 0

                          \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
                        4. Step-by-step derivation
                          1. associate-*r*N/A

                            \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right) \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                          2. lower-*.f64N/A

                            \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right) \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                          3. lower-*.f64N/A

                            \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right)} \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right) \]
                          4. associate-*r*N/A

                            \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \color{blue}{\left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                          5. lower-*.f64N/A

                            \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \color{blue}{\left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                          6. lower-*.f64N/A

                            \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \left(\color{blue}{\left(y-scale \cdot \sqrt{2}\right)} \cdot \sqrt{8}\right) \]
                          7. lower-sqrt.f64N/A

                            \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \left(\left(y-scale \cdot \color{blue}{\sqrt{2}}\right) \cdot \sqrt{8}\right) \]
                          8. lower-sqrt.f6424.6

                            \[\leadsto \left(0.25 \cdot b\right) \cdot \left(\left(y-scale \cdot \sqrt{2}\right) \cdot \color{blue}{\sqrt{8}}\right) \]
                        5. Applied rewrites24.6%

                          \[\leadsto \color{blue}{\left(0.25 \cdot b\right) \cdot \left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                        6. Step-by-step derivation
                          1. Applied rewrites24.7%

                            \[\leadsto \left(\left(0.25 \cdot b\right) \cdot y-scale\right) \cdot \color{blue}{4} \]
                          2. Taylor expanded in b around 0

                            \[\leadsto b \cdot \color{blue}{y-scale} \]
                          3. Step-by-step derivation
                            1. Applied rewrites24.7%

                              \[\leadsto b \cdot \color{blue}{y-scale} \]
                          4. Recombined 2 regimes into one program.
                          5. Final simplification27.3%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;y-scale \leq 1.95 \cdot 10^{+98}:\\ \;\;\;\;\mathsf{hypot}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot b, \cos \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot a\right) \cdot x-scale\\ \mathbf{else}:\\ \;\;\;\;b \cdot y-scale\\ \end{array} \]
                          6. Add Preprocessing

                          Alternative 4: 55.0% accurate, 12.0× speedup?

                          \[\begin{array}{l} y-scale_m = \left|y-scale\right| \\ x-scale_m = \left|x-scale\right| \\ b_m = \left|b\right| \\ \begin{array}{l} \mathbf{if}\;y-scale\_m \leq 1.95 \cdot 10^{+98}:\\ \;\;\;\;\mathsf{hypot}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot b\_m, 1 \cdot a\right) \cdot \left(\left(0.25 \cdot x-scale\_m\right) \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;b\_m \cdot y-scale\_m\\ \end{array} \end{array} \]
                          y-scale_m = (fabs.f64 y-scale)
                          x-scale_m = (fabs.f64 x-scale)
                          b_m = (fabs.f64 b)
                          (FPCore (a b_m angle x-scale_m y-scale_m)
                           :precision binary64
                           (if (<= y-scale_m 1.95e+98)
                             (*
                              (hypot (* (sin (* (PI) (* 0.005555555555555556 angle))) b_m) (* 1.0 a))
                              (* (* 0.25 x-scale_m) 4.0))
                             (* b_m y-scale_m)))
                          \begin{array}{l}
                          y-scale_m = \left|y-scale\right|
                          \\
                          x-scale_m = \left|x-scale\right|
                          \\
                          b_m = \left|b\right|
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;y-scale\_m \leq 1.95 \cdot 10^{+98}:\\
                          \;\;\;\;\mathsf{hypot}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot b\_m, 1 \cdot a\right) \cdot \left(\left(0.25 \cdot x-scale\_m\right) \cdot 4\right)\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;b\_m \cdot y-scale\_m\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if y-scale < 1.95e98

                            1. Initial program 3.8%

                              \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
                            2. Add Preprocessing
                            3. Taylor expanded in y-scale around 0

                              \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}\right)} \]
                            4. Step-by-step derivation
                              1. associate-*r*N/A

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

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

                                \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot \left(x-scale \cdot \sqrt{8}\right)\right)} \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)} \]
                              4. *-commutativeN/A

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

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

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

                                \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \color{blue}{\sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}} \]
                              8. distribute-lft-outN/A

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

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

                              \[\leadsto \color{blue}{\left(0.25 \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(b \cdot b, {\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}, \left(a \cdot a\right) \cdot {\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}\right)}} \]
                            6. Applied rewrites27.7%

                              \[\leadsto \sqrt{2} \cdot \color{blue}{\left(\mathsf{hypot}\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b, \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot a\right) \cdot \left(\left(\sqrt{8} \cdot x-scale\right) \cdot 0.25\right)\right)} \]
                            7. Step-by-step derivation
                              1. Applied rewrites27.8%

                                \[\leadsto \mathsf{hypot}\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b, \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot a\right) \cdot \color{blue}{\left(4 \cdot \left(0.25 \cdot x-scale\right)\right)} \]
                              2. Taylor expanded in angle around 0

                                \[\leadsto \mathsf{hypot}\left(\sin \left(\left(\frac{1}{180} \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b, 1 \cdot a\right) \cdot \left(4 \cdot \left(\frac{1}{4} \cdot x-scale\right)\right) \]
                              3. Step-by-step derivation
                                1. Applied rewrites27.5%

                                  \[\leadsto \mathsf{hypot}\left(\sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right) \cdot b, 1 \cdot a\right) \cdot \left(4 \cdot \left(0.25 \cdot x-scale\right)\right) \]

                                if 1.95e98 < y-scale

                                1. Initial program 4.8%

                                  \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
                                2. Add Preprocessing
                                3. Taylor expanded in angle around 0

                                  \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
                                4. Step-by-step derivation
                                  1. associate-*r*N/A

                                    \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right) \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                                  2. lower-*.f64N/A

                                    \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right) \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                                  3. lower-*.f64N/A

                                    \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right)} \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right) \]
                                  4. associate-*r*N/A

                                    \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \color{blue}{\left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                                  5. lower-*.f64N/A

                                    \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \color{blue}{\left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                                  6. lower-*.f64N/A

                                    \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \left(\color{blue}{\left(y-scale \cdot \sqrt{2}\right)} \cdot \sqrt{8}\right) \]
                                  7. lower-sqrt.f64N/A

                                    \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \left(\left(y-scale \cdot \color{blue}{\sqrt{2}}\right) \cdot \sqrt{8}\right) \]
                                  8. lower-sqrt.f6424.6

                                    \[\leadsto \left(0.25 \cdot b\right) \cdot \left(\left(y-scale \cdot \sqrt{2}\right) \cdot \color{blue}{\sqrt{8}}\right) \]
                                5. Applied rewrites24.6%

                                  \[\leadsto \color{blue}{\left(0.25 \cdot b\right) \cdot \left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                                6. Step-by-step derivation
                                  1. Applied rewrites24.7%

                                    \[\leadsto \left(\left(0.25 \cdot b\right) \cdot y-scale\right) \cdot \color{blue}{4} \]
                                  2. Taylor expanded in b around 0

                                    \[\leadsto b \cdot \color{blue}{y-scale} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites24.7%

                                      \[\leadsto b \cdot \color{blue}{y-scale} \]
                                  4. Recombined 2 regimes into one program.
                                  5. Final simplification27.0%

                                    \[\leadsto \begin{array}{l} \mathbf{if}\;y-scale \leq 1.95 \cdot 10^{+98}:\\ \;\;\;\;\mathsf{hypot}\left(\sin \left(\mathsf{PI}\left(\right) \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot b, 1 \cdot a\right) \cdot \left(\left(0.25 \cdot x-scale\right) \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot y-scale\\ \end{array} \]
                                  6. Add Preprocessing

                                  Alternative 5: 42.6% accurate, 17.0× speedup?

                                  \[\begin{array}{l} y-scale_m = \left|y-scale\right| \\ x-scale_m = \left|x-scale\right| \\ b_m = \left|b\right| \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\ \mathbf{if}\;a \leq 3.15 \cdot 10^{-96}:\\ \;\;\;\;b\_m \cdot y-scale\_m\\ \mathbf{elif}\;a \leq 8.5 \cdot 10^{+74}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(angle \cdot angle, \mathsf{fma}\left(\left(a \cdot a\right) \cdot -3.08641975308642 \cdot 10^{-5}, t\_0, \left(\left(b\_m \cdot b\_m\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot t\_0\right), a \cdot a\right) \cdot 2} \cdot \left(\left(\sqrt{8} \cdot x-scale\_m\right) \cdot 0.25\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(3.969161205100849 \cdot 10^{-11} \cdot \left(angle \cdot angle\right), {\mathsf{PI}\left(\right)}^{4}, -1.54320987654321 \cdot 10^{-5} \cdot t\_0\right), angle \cdot angle, 1\right) \cdot \left(\left(0.25 \cdot a\right) \cdot x-scale\_m\right)\right) \cdot 4\\ \end{array} \end{array} \]
                                  y-scale_m = (fabs.f64 y-scale)
                                  x-scale_m = (fabs.f64 x-scale)
                                  b_m = (fabs.f64 b)
                                  (FPCore (a b_m angle x-scale_m y-scale_m)
                                   :precision binary64
                                   (let* ((t_0 (* (PI) (PI))))
                                     (if (<= a 3.15e-96)
                                       (* b_m y-scale_m)
                                       (if (<= a 8.5e+74)
                                         (*
                                          (sqrt
                                           (*
                                            (fma
                                             (* angle angle)
                                             (fma
                                              (* (* a a) -3.08641975308642e-5)
                                              t_0
                                              (* (* (* b_m b_m) 3.08641975308642e-5) t_0))
                                             (* a a))
                                            2.0))
                                          (* (* (sqrt 8.0) x-scale_m) 0.25))
                                         (*
                                          (*
                                           (fma
                                            (fma
                                             (* 3.969161205100849e-11 (* angle angle))
                                             (pow (PI) 4.0)
                                             (* -1.54320987654321e-5 t_0))
                                            (* angle angle)
                                            1.0)
                                           (* (* 0.25 a) x-scale_m))
                                          4.0)))))
                                  \begin{array}{l}
                                  y-scale_m = \left|y-scale\right|
                                  \\
                                  x-scale_m = \left|x-scale\right|
                                  \\
                                  b_m = \left|b\right|
                                  
                                  \\
                                  \begin{array}{l}
                                  t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
                                  \mathbf{if}\;a \leq 3.15 \cdot 10^{-96}:\\
                                  \;\;\;\;b\_m \cdot y-scale\_m\\
                                  
                                  \mathbf{elif}\;a \leq 8.5 \cdot 10^{+74}:\\
                                  \;\;\;\;\sqrt{\mathsf{fma}\left(angle \cdot angle, \mathsf{fma}\left(\left(a \cdot a\right) \cdot -3.08641975308642 \cdot 10^{-5}, t\_0, \left(\left(b\_m \cdot b\_m\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot t\_0\right), a \cdot a\right) \cdot 2} \cdot \left(\left(\sqrt{8} \cdot x-scale\_m\right) \cdot 0.25\right)\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(3.969161205100849 \cdot 10^{-11} \cdot \left(angle \cdot angle\right), {\mathsf{PI}\left(\right)}^{4}, -1.54320987654321 \cdot 10^{-5} \cdot t\_0\right), angle \cdot angle, 1\right) \cdot \left(\left(0.25 \cdot a\right) \cdot x-scale\_m\right)\right) \cdot 4\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 3 regimes
                                  2. if a < 3.1499999999999998e-96

                                    1. Initial program 3.8%

                                      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in angle around 0

                                      \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
                                    4. Step-by-step derivation
                                      1. associate-*r*N/A

                                        \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right) \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                                      2. lower-*.f64N/A

                                        \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right) \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                                      3. lower-*.f64N/A

                                        \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right)} \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right) \]
                                      4. associate-*r*N/A

                                        \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \color{blue}{\left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                                      5. lower-*.f64N/A

                                        \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \color{blue}{\left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                                      6. lower-*.f64N/A

                                        \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \left(\color{blue}{\left(y-scale \cdot \sqrt{2}\right)} \cdot \sqrt{8}\right) \]
                                      7. lower-sqrt.f64N/A

                                        \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \left(\left(y-scale \cdot \color{blue}{\sqrt{2}}\right) \cdot \sqrt{8}\right) \]
                                      8. lower-sqrt.f6417.8

                                        \[\leadsto \left(0.25 \cdot b\right) \cdot \left(\left(y-scale \cdot \sqrt{2}\right) \cdot \color{blue}{\sqrt{8}}\right) \]
                                    5. Applied rewrites17.8%

                                      \[\leadsto \color{blue}{\left(0.25 \cdot b\right) \cdot \left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                                    6. Step-by-step derivation
                                      1. Applied rewrites17.9%

                                        \[\leadsto \left(\left(0.25 \cdot b\right) \cdot y-scale\right) \cdot \color{blue}{4} \]
                                      2. Taylor expanded in b around 0

                                        \[\leadsto b \cdot \color{blue}{y-scale} \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites17.9%

                                          \[\leadsto b \cdot \color{blue}{y-scale} \]

                                        if 3.1499999999999998e-96 < a < 8.50000000000000028e74

                                        1. Initial program 0.9%

                                          \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
                                        2. Add Preprocessing
                                        3. Taylor expanded in y-scale around 0

                                          \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}\right)} \]
                                        4. Step-by-step derivation
                                          1. associate-*r*N/A

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

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

                                            \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot \left(x-scale \cdot \sqrt{8}\right)\right)} \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)} \]
                                          4. *-commutativeN/A

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

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

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

                                            \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \color{blue}{\sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}} \]
                                          8. distribute-lft-outN/A

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

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

                                          \[\leadsto \color{blue}{\left(0.25 \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(b \cdot b, {\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}, \left(a \cdot a\right) \cdot {\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}\right)}} \]
                                        6. Taylor expanded in angle around 0

                                          \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{2 \cdot \left({angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}\right)} \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites26.8%

                                            \[\leadsto \left(0.25 \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(angle \cdot angle, \mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), a \cdot a\right)} \]

                                          if 8.50000000000000028e74 < a

                                          1. Initial program 6.8%

                                            \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
                                          2. Add Preprocessing
                                          3. Taylor expanded in y-scale around 0

                                            \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}\right)} \]
                                          4. Step-by-step derivation
                                            1. associate-*r*N/A

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

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

                                              \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot \left(x-scale \cdot \sqrt{8}\right)\right)} \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)} \]
                                            4. *-commutativeN/A

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

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

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

                                              \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \color{blue}{\sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}} \]
                                            8. distribute-lft-outN/A

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

                                              \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{\color{blue}{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}} \]
                                          5. Applied rewrites28.9%

                                            \[\leadsto \color{blue}{\left(0.25 \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(b \cdot b, {\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}, \left(a \cdot a\right) \cdot {\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}\right)}} \]
                                          6. Taylor expanded in b around 0

                                            \[\leadsto \frac{1}{4} \cdot \color{blue}{\left(a \cdot \left(x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)} \]
                                          7. Step-by-step derivation
                                            1. Applied rewrites35.2%

                                              \[\leadsto \left(0.25 \cdot a\right) \cdot \color{blue}{\left(\left(x-scale \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                                            2. Step-by-step derivation
                                              1. Applied rewrites35.3%

                                                \[\leadsto \left(\left(\left(0.25 \cdot a\right) \cdot x-scale\right) \cdot \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot 4 \]
                                              2. Taylor expanded in angle around 0

                                                \[\leadsto \left(\left(\left(\frac{1}{4} \cdot a\right) \cdot x-scale\right) \cdot \left(1 + {angle}^{2} \cdot \left(\frac{-1}{64800} \cdot {\mathsf{PI}\left(\right)}^{2} + \frac{1}{25194240000} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{4}\right)\right)\right)\right) \cdot 4 \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites39.3%

                                                  \[\leadsto \left(\left(\left(0.25 \cdot a\right) \cdot x-scale\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(3.969161205100849 \cdot 10^{-11} \cdot \left(angle \cdot angle\right), {\mathsf{PI}\left(\right)}^{4}, -1.54320987654321 \cdot 10^{-5} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), angle \cdot angle, 1\right)\right) \cdot 4 \]
                                              4. Recombined 3 regimes into one program.
                                              5. Final simplification22.8%

                                                \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 3.15 \cdot 10^{-96}:\\ \;\;\;\;b \cdot y-scale\\ \mathbf{elif}\;a \leq 8.5 \cdot 10^{+74}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(angle \cdot angle, \mathsf{fma}\left(\left(a \cdot a\right) \cdot -3.08641975308642 \cdot 10^{-5}, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), \left(\left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), a \cdot a\right) \cdot 2} \cdot \left(\left(\sqrt{8} \cdot x-scale\right) \cdot 0.25\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(3.969161205100849 \cdot 10^{-11} \cdot \left(angle \cdot angle\right), {\mathsf{PI}\left(\right)}^{4}, -1.54320987654321 \cdot 10^{-5} \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), angle \cdot angle, 1\right) \cdot \left(\left(0.25 \cdot a\right) \cdot x-scale\right)\right) \cdot 4\\ \end{array} \]
                                              6. Add Preprocessing

                                              Alternative 6: 42.0% accurate, 26.4× speedup?

                                              \[\begin{array}{l} y-scale_m = \left|y-scale\right| \\ x-scale_m = \left|x-scale\right| \\ b_m = \left|b\right| \\ \begin{array}{l} t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\ \mathbf{if}\;a \leq 3.15 \cdot 10^{-96}:\\ \;\;\;\;b\_m \cdot y-scale\_m\\ \mathbf{elif}\;a \leq 7 \cdot 10^{-16}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(angle \cdot angle, \mathsf{fma}\left(\left(a \cdot a\right) \cdot -3.08641975308642 \cdot 10^{-5}, t\_0, \left(\left(b\_m \cdot b\_m\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot t\_0\right), a \cdot a\right) \cdot 2} \cdot \left(\left(\sqrt{8} \cdot x-scale\_m\right) \cdot 0.25\right)\\ \mathbf{else}:\\ \;\;\;\;x-scale\_m \cdot a\\ \end{array} \end{array} \]
                                              y-scale_m = (fabs.f64 y-scale)
                                              x-scale_m = (fabs.f64 x-scale)
                                              b_m = (fabs.f64 b)
                                              (FPCore (a b_m angle x-scale_m y-scale_m)
                                               :precision binary64
                                               (let* ((t_0 (* (PI) (PI))))
                                                 (if (<= a 3.15e-96)
                                                   (* b_m y-scale_m)
                                                   (if (<= a 7e-16)
                                                     (*
                                                      (sqrt
                                                       (*
                                                        (fma
                                                         (* angle angle)
                                                         (fma
                                                          (* (* a a) -3.08641975308642e-5)
                                                          t_0
                                                          (* (* (* b_m b_m) 3.08641975308642e-5) t_0))
                                                         (* a a))
                                                        2.0))
                                                      (* (* (sqrt 8.0) x-scale_m) 0.25))
                                                     (* x-scale_m a)))))
                                              \begin{array}{l}
                                              y-scale_m = \left|y-scale\right|
                                              \\
                                              x-scale_m = \left|x-scale\right|
                                              \\
                                              b_m = \left|b\right|
                                              
                                              \\
                                              \begin{array}{l}
                                              t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
                                              \mathbf{if}\;a \leq 3.15 \cdot 10^{-96}:\\
                                              \;\;\;\;b\_m \cdot y-scale\_m\\
                                              
                                              \mathbf{elif}\;a \leq 7 \cdot 10^{-16}:\\
                                              \;\;\;\;\sqrt{\mathsf{fma}\left(angle \cdot angle, \mathsf{fma}\left(\left(a \cdot a\right) \cdot -3.08641975308642 \cdot 10^{-5}, t\_0, \left(\left(b\_m \cdot b\_m\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot t\_0\right), a \cdot a\right) \cdot 2} \cdot \left(\left(\sqrt{8} \cdot x-scale\_m\right) \cdot 0.25\right)\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;x-scale\_m \cdot a\\
                                              
                                              
                                              \end{array}
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 3 regimes
                                              2. if a < 3.1499999999999998e-96

                                                1. Initial program 3.8%

                                                  \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
                                                2. Add Preprocessing
                                                3. Taylor expanded in angle around 0

                                                  \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
                                                4. Step-by-step derivation
                                                  1. associate-*r*N/A

                                                    \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right) \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                                                  2. lower-*.f64N/A

                                                    \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right) \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                                                  3. lower-*.f64N/A

                                                    \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right)} \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right) \]
                                                  4. associate-*r*N/A

                                                    \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \color{blue}{\left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                                                  5. lower-*.f64N/A

                                                    \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \color{blue}{\left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                                                  6. lower-*.f64N/A

                                                    \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \left(\color{blue}{\left(y-scale \cdot \sqrt{2}\right)} \cdot \sqrt{8}\right) \]
                                                  7. lower-sqrt.f64N/A

                                                    \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \left(\left(y-scale \cdot \color{blue}{\sqrt{2}}\right) \cdot \sqrt{8}\right) \]
                                                  8. lower-sqrt.f6417.8

                                                    \[\leadsto \left(0.25 \cdot b\right) \cdot \left(\left(y-scale \cdot \sqrt{2}\right) \cdot \color{blue}{\sqrt{8}}\right) \]
                                                5. Applied rewrites17.8%

                                                  \[\leadsto \color{blue}{\left(0.25 \cdot b\right) \cdot \left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                                                6. Step-by-step derivation
                                                  1. Applied rewrites17.9%

                                                    \[\leadsto \left(\left(0.25 \cdot b\right) \cdot y-scale\right) \cdot \color{blue}{4} \]
                                                  2. Taylor expanded in b around 0

                                                    \[\leadsto b \cdot \color{blue}{y-scale} \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites17.9%

                                                      \[\leadsto b \cdot \color{blue}{y-scale} \]

                                                    if 3.1499999999999998e-96 < a < 7.00000000000000035e-16

                                                    1. Initial program 1.0%

                                                      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
                                                    2. Add Preprocessing
                                                    3. Taylor expanded in y-scale around 0

                                                      \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}\right)} \]
                                                    4. Step-by-step derivation
                                                      1. associate-*r*N/A

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

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

                                                        \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot \left(x-scale \cdot \sqrt{8}\right)\right)} \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)} \]
                                                      4. *-commutativeN/A

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

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

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

                                                        \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \color{blue}{\sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}} \]
                                                      8. distribute-lft-outN/A

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

                                                        \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{\color{blue}{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}} \]
                                                    5. Applied rewrites37.3%

                                                      \[\leadsto \color{blue}{\left(0.25 \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(b \cdot b, {\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}, \left(a \cdot a\right) \cdot {\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}\right)}} \]
                                                    6. Taylor expanded in angle around 0

                                                      \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{2 \cdot \left({angle}^{2} \cdot \left(\frac{-1}{32400} \cdot \left({a}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) + \frac{1}{32400} \cdot \left({b}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right) + {a}^{2}\right)} \]
                                                    7. Step-by-step derivation
                                                      1. Applied rewrites34.7%

                                                        \[\leadsto \left(0.25 \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(angle \cdot angle, \mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right), \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), \left(3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), a \cdot a\right)} \]

                                                      if 7.00000000000000035e-16 < a

                                                      1. Initial program 5.4%

                                                        \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
                                                      2. Add Preprocessing
                                                      3. Taylor expanded in y-scale around 0

                                                        \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}\right)} \]
                                                      4. Step-by-step derivation
                                                        1. associate-*r*N/A

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

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

                                                          \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot \left(x-scale \cdot \sqrt{8}\right)\right)} \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)} \]
                                                        4. *-commutativeN/A

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

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

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

                                                          \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \color{blue}{\sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}} \]
                                                        8. distribute-lft-outN/A

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

                                                          \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{\color{blue}{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}} \]
                                                      5. Applied rewrites26.4%

                                                        \[\leadsto \color{blue}{\left(0.25 \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(b \cdot b, {\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}, \left(a \cdot a\right) \cdot {\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}\right)}} \]
                                                      6. Taylor expanded in b around 0

                                                        \[\leadsto \frac{1}{4} \cdot \color{blue}{\left(a \cdot \left(x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)} \]
                                                      7. Step-by-step derivation
                                                        1. Applied rewrites31.3%

                                                          \[\leadsto \left(0.25 \cdot a\right) \cdot \color{blue}{\left(\left(x-scale \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                                                        2. Step-by-step derivation
                                                          1. Applied rewrites31.4%

                                                            \[\leadsto \left(\left(\left(0.25 \cdot a\right) \cdot x-scale\right) \cdot \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot 4 \]
                                                          2. Taylor expanded in angle around 0

                                                            \[\leadsto a \cdot x-scale \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites36.3%

                                                              \[\leadsto a \cdot x-scale \]
                                                          4. Recombined 3 regimes into one program.
                                                          5. Final simplification23.3%

                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 3.15 \cdot 10^{-96}:\\ \;\;\;\;b \cdot y-scale\\ \mathbf{elif}\;a \leq 7 \cdot 10^{-16}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(angle \cdot angle, \mathsf{fma}\left(\left(a \cdot a\right) \cdot -3.08641975308642 \cdot 10^{-5}, \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right), \left(\left(b \cdot b\right) \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\right), a \cdot a\right) \cdot 2} \cdot \left(\left(\sqrt{8} \cdot x-scale\right) \cdot 0.25\right)\\ \mathbf{else}:\\ \;\;\;\;x-scale \cdot a\\ \end{array} \]
                                                          6. Add Preprocessing

                                                          Alternative 7: 35.5% accurate, 242.0× speedup?

                                                          \[\begin{array}{l} y-scale_m = \left|y-scale\right| \\ x-scale_m = \left|x-scale\right| \\ b_m = \left|b\right| \\ \begin{array}{l} \mathbf{if}\;b\_m \leq 2.6 \cdot 10^{+72}:\\ \;\;\;\;x-scale\_m \cdot a\\ \mathbf{else}:\\ \;\;\;\;b\_m \cdot y-scale\_m\\ \end{array} \end{array} \]
                                                          y-scale_m = (fabs.f64 y-scale)
                                                          x-scale_m = (fabs.f64 x-scale)
                                                          b_m = (fabs.f64 b)
                                                          (FPCore (a b_m angle x-scale_m y-scale_m)
                                                           :precision binary64
                                                           (if (<= b_m 2.6e+72) (* x-scale_m a) (* b_m y-scale_m)))
                                                          y-scale_m = fabs(y_45_scale);
                                                          x-scale_m = fabs(x_45_scale);
                                                          b_m = fabs(b);
                                                          double code(double a, double b_m, double angle, double x_45_scale_m, double y_45_scale_m) {
                                                          	double tmp;
                                                          	if (b_m <= 2.6e+72) {
                                                          		tmp = x_45_scale_m * a;
                                                          	} else {
                                                          		tmp = b_m * y_45_scale_m;
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          y-scale_m = abs(y_45scale)
                                                          x-scale_m = abs(x_45scale)
                                                          b_m = abs(b)
                                                          real(8) function code(a, b_m, angle, x_45scale_m, y_45scale_m)
                                                              real(8), intent (in) :: a
                                                              real(8), intent (in) :: b_m
                                                              real(8), intent (in) :: angle
                                                              real(8), intent (in) :: x_45scale_m
                                                              real(8), intent (in) :: y_45scale_m
                                                              real(8) :: tmp
                                                              if (b_m <= 2.6d+72) then
                                                                  tmp = x_45scale_m * a
                                                              else
                                                                  tmp = b_m * y_45scale_m
                                                              end if
                                                              code = tmp
                                                          end function
                                                          
                                                          y-scale_m = Math.abs(y_45_scale);
                                                          x-scale_m = Math.abs(x_45_scale);
                                                          b_m = Math.abs(b);
                                                          public static double code(double a, double b_m, double angle, double x_45_scale_m, double y_45_scale_m) {
                                                          	double tmp;
                                                          	if (b_m <= 2.6e+72) {
                                                          		tmp = x_45_scale_m * a;
                                                          	} else {
                                                          		tmp = b_m * y_45_scale_m;
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          y-scale_m = math.fabs(y_45_scale)
                                                          x-scale_m = math.fabs(x_45_scale)
                                                          b_m = math.fabs(b)
                                                          def code(a, b_m, angle, x_45_scale_m, y_45_scale_m):
                                                          	tmp = 0
                                                          	if b_m <= 2.6e+72:
                                                          		tmp = x_45_scale_m * a
                                                          	else:
                                                          		tmp = b_m * y_45_scale_m
                                                          	return tmp
                                                          
                                                          y-scale_m = abs(y_45_scale)
                                                          x-scale_m = abs(x_45_scale)
                                                          b_m = abs(b)
                                                          function code(a, b_m, angle, x_45_scale_m, y_45_scale_m)
                                                          	tmp = 0.0
                                                          	if (b_m <= 2.6e+72)
                                                          		tmp = Float64(x_45_scale_m * a);
                                                          	else
                                                          		tmp = Float64(b_m * y_45_scale_m);
                                                          	end
                                                          	return tmp
                                                          end
                                                          
                                                          y-scale_m = abs(y_45_scale);
                                                          x-scale_m = abs(x_45_scale);
                                                          b_m = abs(b);
                                                          function tmp_2 = code(a, b_m, angle, x_45_scale_m, y_45_scale_m)
                                                          	tmp = 0.0;
                                                          	if (b_m <= 2.6e+72)
                                                          		tmp = x_45_scale_m * a;
                                                          	else
                                                          		tmp = b_m * y_45_scale_m;
                                                          	end
                                                          	tmp_2 = tmp;
                                                          end
                                                          
                                                          y-scale_m = N[Abs[y$45$scale], $MachinePrecision]
                                                          x-scale_m = N[Abs[x$45$scale], $MachinePrecision]
                                                          b_m = N[Abs[b], $MachinePrecision]
                                                          code[a_, b$95$m_, angle_, x$45$scale$95$m_, y$45$scale$95$m_] := If[LessEqual[b$95$m, 2.6e+72], N[(x$45$scale$95$m * a), $MachinePrecision], N[(b$95$m * y$45$scale$95$m), $MachinePrecision]]
                                                          
                                                          \begin{array}{l}
                                                          y-scale_m = \left|y-scale\right|
                                                          \\
                                                          x-scale_m = \left|x-scale\right|
                                                          \\
                                                          b_m = \left|b\right|
                                                          
                                                          \\
                                                          \begin{array}{l}
                                                          \mathbf{if}\;b\_m \leq 2.6 \cdot 10^{+72}:\\
                                                          \;\;\;\;x-scale\_m \cdot a\\
                                                          
                                                          \mathbf{else}:\\
                                                          \;\;\;\;b\_m \cdot y-scale\_m\\
                                                          
                                                          
                                                          \end{array}
                                                          \end{array}
                                                          
                                                          Derivation
                                                          1. Split input into 2 regimes
                                                          2. if b < 2.59999999999999981e72

                                                            1. Initial program 3.8%

                                                              \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
                                                            2. Add Preprocessing
                                                            3. Taylor expanded in y-scale around 0

                                                              \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}\right)} \]
                                                            4. Step-by-step derivation
                                                              1. associate-*r*N/A

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

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

                                                                \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot \left(x-scale \cdot \sqrt{8}\right)\right)} \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)} \]
                                                              4. *-commutativeN/A

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

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

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

                                                                \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \color{blue}{\sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}} \]
                                                              8. distribute-lft-outN/A

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

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

                                                              \[\leadsto \color{blue}{\left(0.25 \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(b \cdot b, {\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}, \left(a \cdot a\right) \cdot {\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}\right)}} \]
                                                            6. Taylor expanded in b around 0

                                                              \[\leadsto \frac{1}{4} \cdot \color{blue}{\left(a \cdot \left(x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)} \]
                                                            7. Step-by-step derivation
                                                              1. Applied rewrites24.7%

                                                                \[\leadsto \left(0.25 \cdot a\right) \cdot \color{blue}{\left(\left(x-scale \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                                                              2. Step-by-step derivation
                                                                1. Applied rewrites24.9%

                                                                  \[\leadsto \left(\left(\left(0.25 \cdot a\right) \cdot x-scale\right) \cdot \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot 4 \]
                                                                2. Taylor expanded in angle around 0

                                                                  \[\leadsto a \cdot x-scale \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites26.3%

                                                                    \[\leadsto a \cdot x-scale \]

                                                                  if 2.59999999999999981e72 < b

                                                                  1. Initial program 4.7%

                                                                    \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
                                                                  2. Add Preprocessing
                                                                  3. Taylor expanded in angle around 0

                                                                    \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
                                                                  4. Step-by-step derivation
                                                                    1. associate-*r*N/A

                                                                      \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right) \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                                                                    2. lower-*.f64N/A

                                                                      \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right) \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                                                                    3. lower-*.f64N/A

                                                                      \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot b\right)} \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right) \]
                                                                    4. associate-*r*N/A

                                                                      \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \color{blue}{\left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                                                                    5. lower-*.f64N/A

                                                                      \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \color{blue}{\left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                                                                    6. lower-*.f64N/A

                                                                      \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \left(\color{blue}{\left(y-scale \cdot \sqrt{2}\right)} \cdot \sqrt{8}\right) \]
                                                                    7. lower-sqrt.f64N/A

                                                                      \[\leadsto \left(\frac{1}{4} \cdot b\right) \cdot \left(\left(y-scale \cdot \color{blue}{\sqrt{2}}\right) \cdot \sqrt{8}\right) \]
                                                                    8. lower-sqrt.f6427.3

                                                                      \[\leadsto \left(0.25 \cdot b\right) \cdot \left(\left(y-scale \cdot \sqrt{2}\right) \cdot \color{blue}{\sqrt{8}}\right) \]
                                                                  5. Applied rewrites27.3%

                                                                    \[\leadsto \color{blue}{\left(0.25 \cdot b\right) \cdot \left(\left(y-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)} \]
                                                                  6. Step-by-step derivation
                                                                    1. Applied rewrites27.5%

                                                                      \[\leadsto \left(\left(0.25 \cdot b\right) \cdot y-scale\right) \cdot \color{blue}{4} \]
                                                                    2. Taylor expanded in b around 0

                                                                      \[\leadsto b \cdot \color{blue}{y-scale} \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites27.5%

                                                                        \[\leadsto b \cdot \color{blue}{y-scale} \]
                                                                    4. Recombined 2 regimes into one program.
                                                                    5. Final simplification26.5%

                                                                      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 2.6 \cdot 10^{+72}:\\ \;\;\;\;x-scale \cdot a\\ \mathbf{else}:\\ \;\;\;\;b \cdot y-scale\\ \end{array} \]
                                                                    6. Add Preprocessing

                                                                    Alternative 8: 20.3% accurate, 484.7× speedup?

                                                                    \[\begin{array}{l} y-scale_m = \left|y-scale\right| \\ x-scale_m = \left|x-scale\right| \\ b_m = \left|b\right| \\ x-scale\_m \cdot a \end{array} \]
                                                                    y-scale_m = (fabs.f64 y-scale)
                                                                    x-scale_m = (fabs.f64 x-scale)
                                                                    b_m = (fabs.f64 b)
                                                                    (FPCore (a b_m angle x-scale_m y-scale_m) :precision binary64 (* x-scale_m a))
                                                                    y-scale_m = fabs(y_45_scale);
                                                                    x-scale_m = fabs(x_45_scale);
                                                                    b_m = fabs(b);
                                                                    double code(double a, double b_m, double angle, double x_45_scale_m, double y_45_scale_m) {
                                                                    	return x_45_scale_m * a;
                                                                    }
                                                                    
                                                                    y-scale_m = abs(y_45scale)
                                                                    x-scale_m = abs(x_45scale)
                                                                    b_m = abs(b)
                                                                    real(8) function code(a, b_m, angle, x_45scale_m, y_45scale_m)
                                                                        real(8), intent (in) :: a
                                                                        real(8), intent (in) :: b_m
                                                                        real(8), intent (in) :: angle
                                                                        real(8), intent (in) :: x_45scale_m
                                                                        real(8), intent (in) :: y_45scale_m
                                                                        code = x_45scale_m * a
                                                                    end function
                                                                    
                                                                    y-scale_m = Math.abs(y_45_scale);
                                                                    x-scale_m = Math.abs(x_45_scale);
                                                                    b_m = Math.abs(b);
                                                                    public static double code(double a, double b_m, double angle, double x_45_scale_m, double y_45_scale_m) {
                                                                    	return x_45_scale_m * a;
                                                                    }
                                                                    
                                                                    y-scale_m = math.fabs(y_45_scale)
                                                                    x-scale_m = math.fabs(x_45_scale)
                                                                    b_m = math.fabs(b)
                                                                    def code(a, b_m, angle, x_45_scale_m, y_45_scale_m):
                                                                    	return x_45_scale_m * a
                                                                    
                                                                    y-scale_m = abs(y_45_scale)
                                                                    x-scale_m = abs(x_45_scale)
                                                                    b_m = abs(b)
                                                                    function code(a, b_m, angle, x_45_scale_m, y_45_scale_m)
                                                                    	return Float64(x_45_scale_m * a)
                                                                    end
                                                                    
                                                                    y-scale_m = abs(y_45_scale);
                                                                    x-scale_m = abs(x_45_scale);
                                                                    b_m = abs(b);
                                                                    function tmp = code(a, b_m, angle, x_45_scale_m, y_45_scale_m)
                                                                    	tmp = x_45_scale_m * a;
                                                                    end
                                                                    
                                                                    y-scale_m = N[Abs[y$45$scale], $MachinePrecision]
                                                                    x-scale_m = N[Abs[x$45$scale], $MachinePrecision]
                                                                    b_m = N[Abs[b], $MachinePrecision]
                                                                    code[a_, b$95$m_, angle_, x$45$scale$95$m_, y$45$scale$95$m_] := N[(x$45$scale$95$m * a), $MachinePrecision]
                                                                    
                                                                    \begin{array}{l}
                                                                    y-scale_m = \left|y-scale\right|
                                                                    \\
                                                                    x-scale_m = \left|x-scale\right|
                                                                    \\
                                                                    b_m = \left|b\right|
                                                                    
                                                                    \\
                                                                    x-scale\_m \cdot a
                                                                    \end{array}
                                                                    
                                                                    Derivation
                                                                    1. Initial program 3.9%

                                                                      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\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) + \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}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
                                                                    2. Add Preprocessing
                                                                    3. Taylor expanded in y-scale around 0

                                                                      \[\leadsto \color{blue}{\frac{1}{4} \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}\right)} \]
                                                                    4. Step-by-step derivation
                                                                      1. associate-*r*N/A

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

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

                                                                        \[\leadsto \color{blue}{\left(\frac{1}{4} \cdot \left(x-scale \cdot \sqrt{8}\right)\right)} \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)} \]
                                                                      4. *-commutativeN/A

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

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

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

                                                                        \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \color{blue}{\sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}} \]
                                                                      8. distribute-lft-outN/A

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

                                                                        \[\leadsto \left(\frac{1}{4} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{\color{blue}{2 \cdot \left({a}^{2} \cdot {\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{2}\right)}} \]
                                                                    5. Applied rewrites21.3%

                                                                      \[\leadsto \color{blue}{\left(0.25 \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(b \cdot b, {\sin \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}, \left(a \cdot a\right) \cdot {\cos \left(\left(\mathsf{PI}\left(\right) \cdot angle\right) \cdot 0.005555555555555556\right)}^{2}\right)}} \]
                                                                    6. Taylor expanded in b around 0

                                                                      \[\leadsto \frac{1}{4} \cdot \color{blue}{\left(a \cdot \left(x-scale \cdot \left(\cos \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)} \]
                                                                    7. Step-by-step derivation
                                                                      1. Applied rewrites21.6%

                                                                        \[\leadsto \left(0.25 \cdot a\right) \cdot \color{blue}{\left(\left(x-scale \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)} \]
                                                                      2. Step-by-step derivation
                                                                        1. Applied rewrites21.8%

                                                                          \[\leadsto \left(\left(\left(0.25 \cdot a\right) \cdot x-scale\right) \cdot \cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \mathsf{PI}\left(\right)\right)\right) \cdot 4 \]
                                                                        2. Taylor expanded in angle around 0

                                                                          \[\leadsto a \cdot x-scale \]
                                                                        3. Step-by-step derivation
                                                                          1. Applied rewrites22.9%

                                                                            \[\leadsto a \cdot x-scale \]
                                                                          2. Final simplification22.9%

                                                                            \[\leadsto x-scale \cdot a \]
                                                                          3. Add Preprocessing

                                                                          Reproduce

                                                                          ?
                                                                          herbie shell --seed 2024253 
                                                                          (FPCore (a b angle x-scale y-scale)
                                                                            :name "a from scale-rotated-ellipse"
                                                                            :precision binary64
                                                                            (/ (- (sqrt (* (* (* 2.0 (/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0))) (* (* b a) (* b (- a)))) (+ (+ (/ (/ (+ (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)) (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))))))) (/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0))))