Simplification of discriminant from scale-rotated-ellipse

Percentage Accurate: 24.5% → 89.6%
Time: 20.4s
Alternatives: 9
Speedup: 40.5×

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(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\\ t\_3 \cdot t\_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale} \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
         (/
          (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
          y-scale)))
   (-
    (* t_3 t_3)
    (*
     (*
      4.0
      (/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
     (/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale)))))
\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(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\\
t\_3 \cdot t\_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale}
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 24.5% 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(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\\ t\_3 \cdot t\_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale} \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
         (/
          (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
          y-scale)))
   (-
    (* t_3 t_3)
    (*
     (*
      4.0
      (/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
     (/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale)))))
\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(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\\
t\_3 \cdot t\_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale}
\end{array}
\end{array}

Alternative 1: 89.6% accurate, 12.2× speedup?

\[\begin{array}{l} x-scale_m = \left|x-scale\right| \\ \begin{array}{l} \mathbf{if}\;x-scale\_m \leq 1.95 \cdot 10^{+201}:\\ \;\;\;\;\frac{b \cdot a}{y-scale} \cdot \frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}}{x-scale\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(a \cdot b\right)}^{2} \cdot \frac{\frac{-4}{y-scale}}{x-scale\_m}}{y-scale \cdot x-scale\_m}\\ \end{array} \end{array} \]
x-scale_m = (fabs.f64 x-scale)
(FPCore (a b angle x-scale_m y-scale)
 :precision binary64
 (if (<= x-scale_m 1.95e+201)
   (*
    (/ (* b a) y-scale)
    (/ (* (/ -4.0 y-scale) (/ (* b a) x-scale_m)) x-scale_m))
   (/
    (* (pow (* a b) 2.0) (/ (/ -4.0 y-scale) x-scale_m))
    (* y-scale x-scale_m))))
x-scale_m = fabs(x_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
	double tmp;
	if (x_45_scale_m <= 1.95e+201) {
		tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
	} else {
		tmp = (pow((a * b), 2.0) * ((-4.0 / y_45_scale) / x_45_scale_m)) / (y_45_scale * x_45_scale_m);
	}
	return tmp;
}
x-scale_m =     private
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(a, b, angle, x_45scale_m, y_45scale)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle
    real(8), intent (in) :: x_45scale_m
    real(8), intent (in) :: y_45scale
    real(8) :: tmp
    if (x_45scale_m <= 1.95d+201) then
        tmp = ((b * a) / y_45scale) * ((((-4.0d0) / y_45scale) * ((b * a) / x_45scale_m)) / x_45scale_m)
    else
        tmp = (((a * b) ** 2.0d0) * (((-4.0d0) / y_45scale) / x_45scale_m)) / (y_45scale * x_45scale_m)
    end if
    code = tmp
end function
x-scale_m = Math.abs(x_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
	double tmp;
	if (x_45_scale_m <= 1.95e+201) {
		tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
	} else {
		tmp = (Math.pow((a * b), 2.0) * ((-4.0 / y_45_scale) / x_45_scale_m)) / (y_45_scale * x_45_scale_m);
	}
	return tmp;
}
x-scale_m = math.fabs(x_45_scale)
def code(a, b, angle, x_45_scale_m, y_45_scale):
	tmp = 0
	if x_45_scale_m <= 1.95e+201:
		tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m)
	else:
		tmp = (math.pow((a * b), 2.0) * ((-4.0 / y_45_scale) / x_45_scale_m)) / (y_45_scale * x_45_scale_m)
	return tmp
x-scale_m = abs(x_45_scale)
function code(a, b, angle, x_45_scale_m, y_45_scale)
	tmp = 0.0
	if (x_45_scale_m <= 1.95e+201)
		tmp = Float64(Float64(Float64(b * a) / y_45_scale) * Float64(Float64(Float64(-4.0 / y_45_scale) * Float64(Float64(b * a) / x_45_scale_m)) / x_45_scale_m));
	else
		tmp = Float64(Float64((Float64(a * b) ^ 2.0) * Float64(Float64(-4.0 / y_45_scale) / x_45_scale_m)) / Float64(y_45_scale * x_45_scale_m));
	end
	return tmp
end
x-scale_m = abs(x_45_scale);
function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale)
	tmp = 0.0;
	if (x_45_scale_m <= 1.95e+201)
		tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
	else
		tmp = (((a * b) ^ 2.0) * ((-4.0 / y_45_scale) / x_45_scale_m)) / (y_45_scale * x_45_scale_m);
	end
	tmp_2 = tmp;
end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision]
code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := If[LessEqual[x$45$scale$95$m, 1.95e+201], N[(N[(N[(b * a), $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(N[(N[(-4.0 / y$45$scale), $MachinePrecision] * N[(N[(b * a), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(a * b), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(-4.0 / y$45$scale), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x-scale_m = \left|x-scale\right|

\\
\begin{array}{l}
\mathbf{if}\;x-scale\_m \leq 1.95 \cdot 10^{+201}:\\
\;\;\;\;\frac{b \cdot a}{y-scale} \cdot \frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}}{x-scale\_m}\\

\mathbf{else}:\\
\;\;\;\;\frac{{\left(a \cdot b\right)}^{2} \cdot \frac{\frac{-4}{y-scale}}{x-scale\_m}}{y-scale \cdot x-scale\_m}\\


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

    1. Initial program 25.2%

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

      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
      2. *-commutativeN/A

        \[\leadsto \frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{\color{blue}{{y-scale}^{2} \cdot {x-scale}^{2}}} \]
      3. times-fracN/A

        \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
      5. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
      6. unpow2N/A

        \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
      8. *-commutativeN/A

        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{\color{blue}{{b}^{2} \cdot {a}^{2}}}{{x-scale}^{2}} \]
      9. unpow2N/A

        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{{b}^{2} \cdot {a}^{2}}{\color{blue}{x-scale \cdot x-scale}} \]
      10. times-fracN/A

        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
      12. lower-/.f64N/A

        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\color{blue}{\frac{{b}^{2}}{x-scale}} \cdot \frac{{a}^{2}}{x-scale}\right) \]
      13. unpow2N/A

        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
      15. lower-/.f64N/A

        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \color{blue}{\frac{{a}^{2}}{x-scale}}\right) \]
      16. unpow2N/A

        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
      17. lower-*.f6455.4

        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
    5. Applied rewrites55.4%

      \[\leadsto \color{blue}{\frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{a \cdot a}{x-scale}\right)} \]
    6. Step-by-step derivation
      1. Applied rewrites86.4%

        \[\leadsto \frac{\frac{{\left(a \cdot b\right)}^{2}}{x-scale} \cdot \frac{-4}{y-scale}}{\color{blue}{y-scale \cdot x-scale}} \]
      2. Step-by-step derivation
        1. Applied rewrites89.3%

          \[\leadsto \frac{\left(\left(a \cdot b\right) \cdot \frac{a \cdot b}{x-scale}\right) \cdot \frac{-4}{y-scale}}{y-scale \cdot x-scale} \]
        2. Step-by-step derivation
          1. Applied rewrites94.0%

            \[\leadsto \frac{b \cdot a}{y-scale} \cdot \color{blue}{\frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale}}{x-scale}} \]

          if 1.95e201 < x-scale

          1. Initial program 14.1%

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

            \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
          4. Step-by-step derivation
            1. associate-*r/N/A

              \[\leadsto \color{blue}{\frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
            2. *-commutativeN/A

              \[\leadsto \frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{\color{blue}{{y-scale}^{2} \cdot {x-scale}^{2}}} \]
            3. times-fracN/A

              \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
            4. lower-*.f64N/A

              \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
            5. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
            6. unpow2N/A

              \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
            7. lower-*.f64N/A

              \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
            8. *-commutativeN/A

              \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{\color{blue}{{b}^{2} \cdot {a}^{2}}}{{x-scale}^{2}} \]
            9. unpow2N/A

              \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{{b}^{2} \cdot {a}^{2}}{\color{blue}{x-scale \cdot x-scale}} \]
            10. times-fracN/A

              \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
            11. lower-*.f64N/A

              \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
            12. lower-/.f64N/A

              \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\color{blue}{\frac{{b}^{2}}{x-scale}} \cdot \frac{{a}^{2}}{x-scale}\right) \]
            13. unpow2N/A

              \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
            14. lower-*.f64N/A

              \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
            15. lower-/.f64N/A

              \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \color{blue}{\frac{{a}^{2}}{x-scale}}\right) \]
            16. unpow2N/A

              \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
            17. lower-*.f6437.2

              \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
          5. Applied rewrites37.2%

            \[\leadsto \color{blue}{\frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{a \cdot a}{x-scale}\right)} \]
          6. Step-by-step derivation
            1. Applied rewrites65.2%

              \[\leadsto \frac{\frac{{\left(a \cdot b\right)}^{2}}{x-scale} \cdot \frac{-4}{y-scale}}{\color{blue}{y-scale \cdot x-scale}} \]
            2. Step-by-step derivation
              1. Applied rewrites77.5%

                \[\leadsto \frac{{\left(a \cdot b\right)}^{2} \cdot \frac{\frac{-4}{y-scale}}{x-scale}}{\color{blue}{y-scale} \cdot x-scale} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 2: 89.7% accurate, 12.7× speedup?

            \[\begin{array}{l} x-scale_m = \left|x-scale\right| \\ \begin{array}{l} \mathbf{if}\;x-scale\_m \leq 1.95 \cdot 10^{+201}:\\ \;\;\;\;\frac{b \cdot a}{y-scale} \cdot \frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}}{x-scale\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{{\left(a \cdot b\right)}^{2} \cdot -4}{y-scale \cdot x-scale\_m}}{y-scale \cdot x-scale\_m}\\ \end{array} \end{array} \]
            x-scale_m = (fabs.f64 x-scale)
            (FPCore (a b angle x-scale_m y-scale)
             :precision binary64
             (if (<= x-scale_m 1.95e+201)
               (*
                (/ (* b a) y-scale)
                (/ (* (/ -4.0 y-scale) (/ (* b a) x-scale_m)) x-scale_m))
               (/
                (/ (* (pow (* a b) 2.0) -4.0) (* y-scale x-scale_m))
                (* y-scale x-scale_m))))
            x-scale_m = fabs(x_45_scale);
            double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
            	double tmp;
            	if (x_45_scale_m <= 1.95e+201) {
            		tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
            	} else {
            		tmp = ((pow((a * b), 2.0) * -4.0) / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m);
            	}
            	return tmp;
            }
            
            x-scale_m =     private
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(a, b, angle, x_45scale_m, y_45scale)
            use fmin_fmax_functions
                real(8), intent (in) :: a
                real(8), intent (in) :: b
                real(8), intent (in) :: angle
                real(8), intent (in) :: x_45scale_m
                real(8), intent (in) :: y_45scale
                real(8) :: tmp
                if (x_45scale_m <= 1.95d+201) then
                    tmp = ((b * a) / y_45scale) * ((((-4.0d0) / y_45scale) * ((b * a) / x_45scale_m)) / x_45scale_m)
                else
                    tmp = ((((a * b) ** 2.0d0) * (-4.0d0)) / (y_45scale * x_45scale_m)) / (y_45scale * x_45scale_m)
                end if
                code = tmp
            end function
            
            x-scale_m = Math.abs(x_45_scale);
            public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
            	double tmp;
            	if (x_45_scale_m <= 1.95e+201) {
            		tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
            	} else {
            		tmp = ((Math.pow((a * b), 2.0) * -4.0) / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m);
            	}
            	return tmp;
            }
            
            x-scale_m = math.fabs(x_45_scale)
            def code(a, b, angle, x_45_scale_m, y_45_scale):
            	tmp = 0
            	if x_45_scale_m <= 1.95e+201:
            		tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m)
            	else:
            		tmp = ((math.pow((a * b), 2.0) * -4.0) / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m)
            	return tmp
            
            x-scale_m = abs(x_45_scale)
            function code(a, b, angle, x_45_scale_m, y_45_scale)
            	tmp = 0.0
            	if (x_45_scale_m <= 1.95e+201)
            		tmp = Float64(Float64(Float64(b * a) / y_45_scale) * Float64(Float64(Float64(-4.0 / y_45_scale) * Float64(Float64(b * a) / x_45_scale_m)) / x_45_scale_m));
            	else
            		tmp = Float64(Float64(Float64((Float64(a * b) ^ 2.0) * -4.0) / Float64(y_45_scale * x_45_scale_m)) / Float64(y_45_scale * x_45_scale_m));
            	end
            	return tmp
            end
            
            x-scale_m = abs(x_45_scale);
            function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale)
            	tmp = 0.0;
            	if (x_45_scale_m <= 1.95e+201)
            		tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
            	else
            		tmp = ((((a * b) ^ 2.0) * -4.0) / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m);
            	end
            	tmp_2 = tmp;
            end
            
            x-scale_m = N[Abs[x$45$scale], $MachinePrecision]
            code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := If[LessEqual[x$45$scale$95$m, 1.95e+201], N[(N[(N[(b * a), $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(N[(N[(-4.0 / y$45$scale), $MachinePrecision] * N[(N[(b * a), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Power[N[(a * b), $MachinePrecision], 2.0], $MachinePrecision] * -4.0), $MachinePrecision] / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            x-scale_m = \left|x-scale\right|
            
            \\
            \begin{array}{l}
            \mathbf{if}\;x-scale\_m \leq 1.95 \cdot 10^{+201}:\\
            \;\;\;\;\frac{b \cdot a}{y-scale} \cdot \frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}}{x-scale\_m}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{\frac{{\left(a \cdot b\right)}^{2} \cdot -4}{y-scale \cdot x-scale\_m}}{y-scale \cdot x-scale\_m}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if x-scale < 1.95e201

              1. Initial program 25.2%

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

                \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
              4. Step-by-step derivation
                1. associate-*r/N/A

                  \[\leadsto \color{blue}{\frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
                2. *-commutativeN/A

                  \[\leadsto \frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{\color{blue}{{y-scale}^{2} \cdot {x-scale}^{2}}} \]
                3. times-fracN/A

                  \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
                4. lower-*.f64N/A

                  \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
                5. lower-/.f64N/A

                  \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                6. unpow2N/A

                  \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                7. lower-*.f64N/A

                  \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                8. *-commutativeN/A

                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{\color{blue}{{b}^{2} \cdot {a}^{2}}}{{x-scale}^{2}} \]
                9. unpow2N/A

                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{{b}^{2} \cdot {a}^{2}}{\color{blue}{x-scale \cdot x-scale}} \]
                10. times-fracN/A

                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
                11. lower-*.f64N/A

                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
                12. lower-/.f64N/A

                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\color{blue}{\frac{{b}^{2}}{x-scale}} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                13. unpow2N/A

                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                14. lower-*.f64N/A

                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                15. lower-/.f64N/A

                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \color{blue}{\frac{{a}^{2}}{x-scale}}\right) \]
                16. unpow2N/A

                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
                17. lower-*.f6455.4

                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
              5. Applied rewrites55.4%

                \[\leadsto \color{blue}{\frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{a \cdot a}{x-scale}\right)} \]
              6. Step-by-step derivation
                1. Applied rewrites86.4%

                  \[\leadsto \frac{\frac{{\left(a \cdot b\right)}^{2}}{x-scale} \cdot \frac{-4}{y-scale}}{\color{blue}{y-scale \cdot x-scale}} \]
                2. Step-by-step derivation
                  1. Applied rewrites89.3%

                    \[\leadsto \frac{\left(\left(a \cdot b\right) \cdot \frac{a \cdot b}{x-scale}\right) \cdot \frac{-4}{y-scale}}{y-scale \cdot x-scale} \]
                  2. Step-by-step derivation
                    1. Applied rewrites94.0%

                      \[\leadsto \frac{b \cdot a}{y-scale} \cdot \color{blue}{\frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale}}{x-scale}} \]

                    if 1.95e201 < x-scale

                    1. Initial program 14.1%

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

                      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
                    4. Step-by-step derivation
                      1. associate-*r/N/A

                        \[\leadsto \color{blue}{\frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
                      2. *-commutativeN/A

                        \[\leadsto \frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{\color{blue}{{y-scale}^{2} \cdot {x-scale}^{2}}} \]
                      3. times-fracN/A

                        \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
                      4. lower-*.f64N/A

                        \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
                      5. lower-/.f64N/A

                        \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                      6. unpow2N/A

                        \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                      7. lower-*.f64N/A

                        \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                      8. *-commutativeN/A

                        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{\color{blue}{{b}^{2} \cdot {a}^{2}}}{{x-scale}^{2}} \]
                      9. unpow2N/A

                        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{{b}^{2} \cdot {a}^{2}}{\color{blue}{x-scale \cdot x-scale}} \]
                      10. times-fracN/A

                        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
                      11. lower-*.f64N/A

                        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
                      12. lower-/.f64N/A

                        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\color{blue}{\frac{{b}^{2}}{x-scale}} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                      13. unpow2N/A

                        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                      14. lower-*.f64N/A

                        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                      15. lower-/.f64N/A

                        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \color{blue}{\frac{{a}^{2}}{x-scale}}\right) \]
                      16. unpow2N/A

                        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
                      17. lower-*.f6437.2

                        \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
                    5. Applied rewrites37.2%

                      \[\leadsto \color{blue}{\frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{a \cdot a}{x-scale}\right)} \]
                    6. Step-by-step derivation
                      1. Applied rewrites65.2%

                        \[\leadsto \frac{\frac{{\left(a \cdot b\right)}^{2}}{x-scale} \cdot \frac{-4}{y-scale}}{\color{blue}{y-scale \cdot x-scale}} \]
                      2. Step-by-step derivation
                        1. Applied rewrites77.4%

                          \[\leadsto \frac{\frac{{\left(a \cdot b\right)}^{2} \cdot -4}{y-scale \cdot x-scale}}{\color{blue}{y-scale} \cdot x-scale} \]
                      3. Recombined 2 regimes into one program.
                      4. Add Preprocessing

                      Alternative 3: 90.4% accurate, 26.8× speedup?

                      \[\begin{array}{l} x-scale_m = \left|x-scale\right| \\ \begin{array}{l} \mathbf{if}\;x-scale\_m \leq 7.5 \cdot 10^{+241}:\\ \;\;\;\;\frac{b \cdot a}{y-scale} \cdot \frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}}{x-scale\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left(a \cdot b\right) \cdot \frac{a \cdot b}{x-scale\_m}\right) \cdot -4}{\left(y-scale \cdot x-scale\_m\right) \cdot y-scale}\\ \end{array} \end{array} \]
                      x-scale_m = (fabs.f64 x-scale)
                      (FPCore (a b angle x-scale_m y-scale)
                       :precision binary64
                       (if (<= x-scale_m 7.5e+241)
                         (*
                          (/ (* b a) y-scale)
                          (/ (* (/ -4.0 y-scale) (/ (* b a) x-scale_m)) x-scale_m))
                         (/
                          (* (* (* a b) (/ (* a b) x-scale_m)) -4.0)
                          (* (* y-scale x-scale_m) y-scale))))
                      x-scale_m = fabs(x_45_scale);
                      double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
                      	double tmp;
                      	if (x_45_scale_m <= 7.5e+241) {
                      		tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
                      	} else {
                      		tmp = (((a * b) * ((a * b) / x_45_scale_m)) * -4.0) / ((y_45_scale * x_45_scale_m) * y_45_scale);
                      	}
                      	return tmp;
                      }
                      
                      x-scale_m =     private
                      module fmin_fmax_functions
                          implicit none
                          private
                          public fmax
                          public fmin
                      
                          interface fmax
                              module procedure fmax88
                              module procedure fmax44
                              module procedure fmax84
                              module procedure fmax48
                          end interface
                          interface fmin
                              module procedure fmin88
                              module procedure fmin44
                              module procedure fmin84
                              module procedure fmin48
                          end interface
                      contains
                          real(8) function fmax88(x, y) result (res)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                          end function
                          real(4) function fmax44(x, y) result (res)
                              real(4), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                          end function
                          real(8) function fmax84(x, y) result(res)
                              real(8), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                          end function
                          real(8) function fmax48(x, y) result(res)
                              real(4), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                          end function
                          real(8) function fmin88(x, y) result (res)
                              real(8), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                          end function
                          real(4) function fmin44(x, y) result (res)
                              real(4), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                          end function
                          real(8) function fmin84(x, y) result(res)
                              real(8), intent (in) :: x
                              real(4), intent (in) :: y
                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                          end function
                          real(8) function fmin48(x, y) result(res)
                              real(4), intent (in) :: x
                              real(8), intent (in) :: y
                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                          end function
                      end module
                      
                      real(8) function code(a, b, angle, x_45scale_m, y_45scale)
                      use fmin_fmax_functions
                          real(8), intent (in) :: a
                          real(8), intent (in) :: b
                          real(8), intent (in) :: angle
                          real(8), intent (in) :: x_45scale_m
                          real(8), intent (in) :: y_45scale
                          real(8) :: tmp
                          if (x_45scale_m <= 7.5d+241) then
                              tmp = ((b * a) / y_45scale) * ((((-4.0d0) / y_45scale) * ((b * a) / x_45scale_m)) / x_45scale_m)
                          else
                              tmp = (((a * b) * ((a * b) / x_45scale_m)) * (-4.0d0)) / ((y_45scale * x_45scale_m) * y_45scale)
                          end if
                          code = tmp
                      end function
                      
                      x-scale_m = Math.abs(x_45_scale);
                      public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
                      	double tmp;
                      	if (x_45_scale_m <= 7.5e+241) {
                      		tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
                      	} else {
                      		tmp = (((a * b) * ((a * b) / x_45_scale_m)) * -4.0) / ((y_45_scale * x_45_scale_m) * y_45_scale);
                      	}
                      	return tmp;
                      }
                      
                      x-scale_m = math.fabs(x_45_scale)
                      def code(a, b, angle, x_45_scale_m, y_45_scale):
                      	tmp = 0
                      	if x_45_scale_m <= 7.5e+241:
                      		tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m)
                      	else:
                      		tmp = (((a * b) * ((a * b) / x_45_scale_m)) * -4.0) / ((y_45_scale * x_45_scale_m) * y_45_scale)
                      	return tmp
                      
                      x-scale_m = abs(x_45_scale)
                      function code(a, b, angle, x_45_scale_m, y_45_scale)
                      	tmp = 0.0
                      	if (x_45_scale_m <= 7.5e+241)
                      		tmp = Float64(Float64(Float64(b * a) / y_45_scale) * Float64(Float64(Float64(-4.0 / y_45_scale) * Float64(Float64(b * a) / x_45_scale_m)) / x_45_scale_m));
                      	else
                      		tmp = Float64(Float64(Float64(Float64(a * b) * Float64(Float64(a * b) / x_45_scale_m)) * -4.0) / Float64(Float64(y_45_scale * x_45_scale_m) * y_45_scale));
                      	end
                      	return tmp
                      end
                      
                      x-scale_m = abs(x_45_scale);
                      function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale)
                      	tmp = 0.0;
                      	if (x_45_scale_m <= 7.5e+241)
                      		tmp = ((b * a) / y_45_scale) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / x_45_scale_m);
                      	else
                      		tmp = (((a * b) * ((a * b) / x_45_scale_m)) * -4.0) / ((y_45_scale * x_45_scale_m) * y_45_scale);
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      x-scale_m = N[Abs[x$45$scale], $MachinePrecision]
                      code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := If[LessEqual[x$45$scale$95$m, 7.5e+241], N[(N[(N[(b * a), $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(N[(N[(-4.0 / y$45$scale), $MachinePrecision] * N[(N[(b * a), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(a * b), $MachinePrecision] * N[(N[(a * b), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale$95$m), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision]]
                      
                      \begin{array}{l}
                      x-scale_m = \left|x-scale\right|
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;x-scale\_m \leq 7.5 \cdot 10^{+241}:\\
                      \;\;\;\;\frac{b \cdot a}{y-scale} \cdot \frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}}{x-scale\_m}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{\left(\left(a \cdot b\right) \cdot \frac{a \cdot b}{x-scale\_m}\right) \cdot -4}{\left(y-scale \cdot x-scale\_m\right) \cdot y-scale}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if x-scale < 7.5000000000000001e241

                        1. Initial program 24.9%

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

                          \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
                        4. Step-by-step derivation
                          1. associate-*r/N/A

                            \[\leadsto \color{blue}{\frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
                          2. *-commutativeN/A

                            \[\leadsto \frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{\color{blue}{{y-scale}^{2} \cdot {x-scale}^{2}}} \]
                          3. times-fracN/A

                            \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
                          4. lower-*.f64N/A

                            \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
                          5. lower-/.f64N/A

                            \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                          6. unpow2N/A

                            \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                          7. lower-*.f64N/A

                            \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                          8. *-commutativeN/A

                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{\color{blue}{{b}^{2} \cdot {a}^{2}}}{{x-scale}^{2}} \]
                          9. unpow2N/A

                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{{b}^{2} \cdot {a}^{2}}{\color{blue}{x-scale \cdot x-scale}} \]
                          10. times-fracN/A

                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
                          11. lower-*.f64N/A

                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
                          12. lower-/.f64N/A

                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\color{blue}{\frac{{b}^{2}}{x-scale}} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                          13. unpow2N/A

                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                          14. lower-*.f64N/A

                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                          15. lower-/.f64N/A

                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \color{blue}{\frac{{a}^{2}}{x-scale}}\right) \]
                          16. unpow2N/A

                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
                          17. lower-*.f6454.7

                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
                        5. Applied rewrites54.7%

                          \[\leadsto \color{blue}{\frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{a \cdot a}{x-scale}\right)} \]
                        6. Step-by-step derivation
                          1. Applied rewrites85.7%

                            \[\leadsto \frac{\frac{{\left(a \cdot b\right)}^{2}}{x-scale} \cdot \frac{-4}{y-scale}}{\color{blue}{y-scale \cdot x-scale}} \]
                          2. Step-by-step derivation
                            1. Applied rewrites88.4%

                              \[\leadsto \frac{\left(\left(a \cdot b\right) \cdot \frac{a \cdot b}{x-scale}\right) \cdot \frac{-4}{y-scale}}{y-scale \cdot x-scale} \]
                            2. Step-by-step derivation
                              1. Applied rewrites93.1%

                                \[\leadsto \frac{b \cdot a}{y-scale} \cdot \color{blue}{\frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale}}{x-scale}} \]

                              if 7.5000000000000001e241 < x-scale

                              1. Initial program 14.1%

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

                                \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
                              4. Step-by-step derivation
                                1. associate-*r/N/A

                                  \[\leadsto \color{blue}{\frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
                                2. *-commutativeN/A

                                  \[\leadsto \frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{\color{blue}{{y-scale}^{2} \cdot {x-scale}^{2}}} \]
                                3. times-fracN/A

                                  \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
                                4. lower-*.f64N/A

                                  \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
                                5. lower-/.f64N/A

                                  \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                                6. unpow2N/A

                                  \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                                7. lower-*.f64N/A

                                  \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                                8. *-commutativeN/A

                                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{\color{blue}{{b}^{2} \cdot {a}^{2}}}{{x-scale}^{2}} \]
                                9. unpow2N/A

                                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{{b}^{2} \cdot {a}^{2}}{\color{blue}{x-scale \cdot x-scale}} \]
                                10. times-fracN/A

                                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
                                11. lower-*.f64N/A

                                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
                                12. lower-/.f64N/A

                                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\color{blue}{\frac{{b}^{2}}{x-scale}} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                                13. unpow2N/A

                                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                                14. lower-*.f64N/A

                                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                                15. lower-/.f64N/A

                                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \color{blue}{\frac{{a}^{2}}{x-scale}}\right) \]
                                16. unpow2N/A

                                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
                                17. lower-*.f6441.2

                                  \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
                              5. Applied rewrites41.2%

                                \[\leadsto \color{blue}{\frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{a \cdot a}{x-scale}\right)} \]
                              6. Step-by-step derivation
                                1. Applied rewrites67.0%

                                  \[\leadsto \frac{\frac{{\left(a \cdot b\right)}^{2}}{x-scale} \cdot -4}{\color{blue}{\left(y-scale \cdot x-scale\right) \cdot y-scale}} \]
                                2. Step-by-step derivation
                                  1. Applied rewrites81.5%

                                    \[\leadsto \frac{\left(\left(a \cdot b\right) \cdot \frac{a \cdot b}{x-scale}\right) \cdot -4}{\left(\color{blue}{y-scale} \cdot x-scale\right) \cdot y-scale} \]
                                3. Recombined 2 regimes into one program.
                                4. Add Preprocessing

                                Alternative 4: 67.3% accurate, 32.3× speedup?

                                \[\begin{array}{l} x-scale_m = \left|x-scale\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 4.6 \cdot 10^{-126} \lor \neg \left(b \leq 2.2 \cdot 10^{+126}\right):\\ \;\;\;\;\frac{\left(\left(b \cdot a\right) \cdot a\right) \cdot -4}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\_m\right) \cdot x-scale\_m} \cdot b\\ \mathbf{else}:\\ \;\;\;\;\frac{-4 \cdot \left(a \cdot a\right)}{\left(y-scale \cdot x-scale\_m\right) \cdot \left(y-scale \cdot x-scale\_m\right)} \cdot \left(b \cdot b\right)\\ \end{array} \end{array} \]
                                x-scale_m = (fabs.f64 x-scale)
                                (FPCore (a b angle x-scale_m y-scale)
                                 :precision binary64
                                 (if (or (<= b 4.6e-126) (not (<= b 2.2e+126)))
                                   (*
                                    (/ (* (* (* b a) a) -4.0) (* (* (* y-scale y-scale) x-scale_m) x-scale_m))
                                    b)
                                   (*
                                    (/ (* -4.0 (* a a)) (* (* y-scale x-scale_m) (* y-scale x-scale_m)))
                                    (* b b))))
                                x-scale_m = fabs(x_45_scale);
                                double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
                                	double tmp;
                                	if ((b <= 4.6e-126) || !(b <= 2.2e+126)) {
                                		tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
                                	} else {
                                		tmp = ((-4.0 * (a * a)) / ((y_45_scale * x_45_scale_m) * (y_45_scale * x_45_scale_m))) * (b * b);
                                	}
                                	return tmp;
                                }
                                
                                x-scale_m =     private
                                module fmin_fmax_functions
                                    implicit none
                                    private
                                    public fmax
                                    public fmin
                                
                                    interface fmax
                                        module procedure fmax88
                                        module procedure fmax44
                                        module procedure fmax84
                                        module procedure fmax48
                                    end interface
                                    interface fmin
                                        module procedure fmin88
                                        module procedure fmin44
                                        module procedure fmin84
                                        module procedure fmin48
                                    end interface
                                contains
                                    real(8) function fmax88(x, y) result (res)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                    end function
                                    real(4) function fmax44(x, y) result (res)
                                        real(4), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                    end function
                                    real(8) function fmax84(x, y) result(res)
                                        real(8), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                    end function
                                    real(8) function fmax48(x, y) result(res)
                                        real(4), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                    end function
                                    real(8) function fmin88(x, y) result (res)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                    end function
                                    real(4) function fmin44(x, y) result (res)
                                        real(4), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                    end function
                                    real(8) function fmin84(x, y) result(res)
                                        real(8), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                    end function
                                    real(8) function fmin48(x, y) result(res)
                                        real(4), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                    end function
                                end module
                                
                                real(8) function code(a, b, angle, x_45scale_m, y_45scale)
                                use fmin_fmax_functions
                                    real(8), intent (in) :: a
                                    real(8), intent (in) :: b
                                    real(8), intent (in) :: angle
                                    real(8), intent (in) :: x_45scale_m
                                    real(8), intent (in) :: y_45scale
                                    real(8) :: tmp
                                    if ((b <= 4.6d-126) .or. (.not. (b <= 2.2d+126))) then
                                        tmp = ((((b * a) * a) * (-4.0d0)) / (((y_45scale * y_45scale) * x_45scale_m) * x_45scale_m)) * b
                                    else
                                        tmp = (((-4.0d0) * (a * a)) / ((y_45scale * x_45scale_m) * (y_45scale * x_45scale_m))) * (b * b)
                                    end if
                                    code = tmp
                                end function
                                
                                x-scale_m = Math.abs(x_45_scale);
                                public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
                                	double tmp;
                                	if ((b <= 4.6e-126) || !(b <= 2.2e+126)) {
                                		tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
                                	} else {
                                		tmp = ((-4.0 * (a * a)) / ((y_45_scale * x_45_scale_m) * (y_45_scale * x_45_scale_m))) * (b * b);
                                	}
                                	return tmp;
                                }
                                
                                x-scale_m = math.fabs(x_45_scale)
                                def code(a, b, angle, x_45_scale_m, y_45_scale):
                                	tmp = 0
                                	if (b <= 4.6e-126) or not (b <= 2.2e+126):
                                		tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b
                                	else:
                                		tmp = ((-4.0 * (a * a)) / ((y_45_scale * x_45_scale_m) * (y_45_scale * x_45_scale_m))) * (b * b)
                                	return tmp
                                
                                x-scale_m = abs(x_45_scale)
                                function code(a, b, angle, x_45_scale_m, y_45_scale)
                                	tmp = 0.0
                                	if ((b <= 4.6e-126) || !(b <= 2.2e+126))
                                		tmp = Float64(Float64(Float64(Float64(Float64(b * a) * a) * -4.0) / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b);
                                	else
                                		tmp = Float64(Float64(Float64(-4.0 * Float64(a * a)) / Float64(Float64(y_45_scale * x_45_scale_m) * Float64(y_45_scale * x_45_scale_m))) * Float64(b * b));
                                	end
                                	return tmp
                                end
                                
                                x-scale_m = abs(x_45_scale);
                                function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale)
                                	tmp = 0.0;
                                	if ((b <= 4.6e-126) || ~((b <= 2.2e+126)))
                                		tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
                                	else
                                		tmp = ((-4.0 * (a * a)) / ((y_45_scale * x_45_scale_m) * (y_45_scale * x_45_scale_m))) * (b * b);
                                	end
                                	tmp_2 = tmp;
                                end
                                
                                x-scale_m = N[Abs[x$45$scale], $MachinePrecision]
                                code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := If[Or[LessEqual[b, 4.6e-126], N[Not[LessEqual[b, 2.2e+126]], $MachinePrecision]], N[(N[(N[(N[(N[(b * a), $MachinePrecision] * a), $MachinePrecision] * -4.0), $MachinePrecision] / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale$95$m), $MachinePrecision] * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], N[(N[(N[(-4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale$95$m), $MachinePrecision] * N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]]
                                
                                \begin{array}{l}
                                x-scale_m = \left|x-scale\right|
                                
                                \\
                                \begin{array}{l}
                                \mathbf{if}\;b \leq 4.6 \cdot 10^{-126} \lor \neg \left(b \leq 2.2 \cdot 10^{+126}\right):\\
                                \;\;\;\;\frac{\left(\left(b \cdot a\right) \cdot a\right) \cdot -4}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\_m\right) \cdot x-scale\_m} \cdot b\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\frac{-4 \cdot \left(a \cdot a\right)}{\left(y-scale \cdot x-scale\_m\right) \cdot \left(y-scale \cdot x-scale\_m\right)} \cdot \left(b \cdot b\right)\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if b < 4.60000000000000021e-126 or 2.19999999999999999e126 < b

                                  1. Initial program 20.8%

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

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

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

                                    \[\leadsto \left(-4 \cdot \frac{{a}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right) \cdot \left(\color{blue}{b} \cdot b\right) \]
                                  6. Step-by-step derivation
                                    1. Applied rewrites59.6%

                                      \[\leadsto \frac{-4 \cdot \left(a \cdot a\right)}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(\color{blue}{b} \cdot b\right) \]
                                    2. Step-by-step derivation
                                      1. Applied rewrites75.7%

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

                                        \[\leadsto \left(-4 \cdot \frac{{a}^{2} \cdot b}{{x-scale}^{2} \cdot {y-scale}^{2}}\right) \cdot b \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites66.4%

                                          \[\leadsto \frac{\left(\left(b \cdot a\right) \cdot a\right) \cdot -4}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\right) \cdot x-scale} \cdot b \]

                                        if 4.60000000000000021e-126 < b < 2.19999999999999999e126

                                        1. Initial program 35.4%

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

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

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

                                          \[\leadsto \left(-4 \cdot \frac{{a}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right) \cdot \left(\color{blue}{b} \cdot b\right) \]
                                        6. Step-by-step derivation
                                          1. Applied rewrites82.4%

                                            \[\leadsto \frac{-4 \cdot \left(a \cdot a\right)}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(\color{blue}{b} \cdot b\right) \]
                                        7. Recombined 2 regimes into one program.
                                        8. Final simplification70.2%

                                          \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 4.6 \cdot 10^{-126} \lor \neg \left(b \leq 2.2 \cdot 10^{+126}\right):\\ \;\;\;\;\frac{\left(\left(b \cdot a\right) \cdot a\right) \cdot -4}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\right) \cdot x-scale} \cdot b\\ \mathbf{else}:\\ \;\;\;\;\frac{-4 \cdot \left(a \cdot a\right)}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(b \cdot b\right)\\ \end{array} \]
                                        9. Add Preprocessing

                                        Alternative 5: 71.2% accurate, 32.3× speedup?

                                        \[\begin{array}{l} x-scale_m = \left|x-scale\right| \\ \begin{array}{l} \mathbf{if}\;b \leq 4.6 \cdot 10^{-173}:\\ \;\;\;\;\frac{\left(\left(b \cdot a\right) \cdot a\right) \cdot -4}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\_m\right) \cdot x-scale\_m} \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{-4 \cdot a}{y-scale \cdot x-scale\_m} \cdot \frac{a}{y-scale \cdot x-scale\_m}\right) \cdot \left(b \cdot b\right)\\ \end{array} \end{array} \]
                                        x-scale_m = (fabs.f64 x-scale)
                                        (FPCore (a b angle x-scale_m y-scale)
                                         :precision binary64
                                         (if (<= b 4.6e-173)
                                           (*
                                            (/ (* (* (* b a) a) -4.0) (* (* (* y-scale y-scale) x-scale_m) x-scale_m))
                                            b)
                                           (*
                                            (* (/ (* -4.0 a) (* y-scale x-scale_m)) (/ a (* y-scale x-scale_m)))
                                            (* b b))))
                                        x-scale_m = fabs(x_45_scale);
                                        double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
                                        	double tmp;
                                        	if (b <= 4.6e-173) {
                                        		tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
                                        	} else {
                                        		tmp = (((-4.0 * a) / (y_45_scale * x_45_scale_m)) * (a / (y_45_scale * x_45_scale_m))) * (b * b);
                                        	}
                                        	return tmp;
                                        }
                                        
                                        x-scale_m =     private
                                        module fmin_fmax_functions
                                            implicit none
                                            private
                                            public fmax
                                            public fmin
                                        
                                            interface fmax
                                                module procedure fmax88
                                                module procedure fmax44
                                                module procedure fmax84
                                                module procedure fmax48
                                            end interface
                                            interface fmin
                                                module procedure fmin88
                                                module procedure fmin44
                                                module procedure fmin84
                                                module procedure fmin48
                                            end interface
                                        contains
                                            real(8) function fmax88(x, y) result (res)
                                                real(8), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                            end function
                                            real(4) function fmax44(x, y) result (res)
                                                real(4), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                            end function
                                            real(8) function fmax84(x, y) result(res)
                                                real(8), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                            end function
                                            real(8) function fmax48(x, y) result(res)
                                                real(4), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                            end function
                                            real(8) function fmin88(x, y) result (res)
                                                real(8), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                            end function
                                            real(4) function fmin44(x, y) result (res)
                                                real(4), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                            end function
                                            real(8) function fmin84(x, y) result(res)
                                                real(8), intent (in) :: x
                                                real(4), intent (in) :: y
                                                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                            end function
                                            real(8) function fmin48(x, y) result(res)
                                                real(4), intent (in) :: x
                                                real(8), intent (in) :: y
                                                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                            end function
                                        end module
                                        
                                        real(8) function code(a, b, angle, x_45scale_m, y_45scale)
                                        use fmin_fmax_functions
                                            real(8), intent (in) :: a
                                            real(8), intent (in) :: b
                                            real(8), intent (in) :: angle
                                            real(8), intent (in) :: x_45scale_m
                                            real(8), intent (in) :: y_45scale
                                            real(8) :: tmp
                                            if (b <= 4.6d-173) then
                                                tmp = ((((b * a) * a) * (-4.0d0)) / (((y_45scale * y_45scale) * x_45scale_m) * x_45scale_m)) * b
                                            else
                                                tmp = ((((-4.0d0) * a) / (y_45scale * x_45scale_m)) * (a / (y_45scale * x_45scale_m))) * (b * b)
                                            end if
                                            code = tmp
                                        end function
                                        
                                        x-scale_m = Math.abs(x_45_scale);
                                        public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
                                        	double tmp;
                                        	if (b <= 4.6e-173) {
                                        		tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
                                        	} else {
                                        		tmp = (((-4.0 * a) / (y_45_scale * x_45_scale_m)) * (a / (y_45_scale * x_45_scale_m))) * (b * b);
                                        	}
                                        	return tmp;
                                        }
                                        
                                        x-scale_m = math.fabs(x_45_scale)
                                        def code(a, b, angle, x_45_scale_m, y_45_scale):
                                        	tmp = 0
                                        	if b <= 4.6e-173:
                                        		tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b
                                        	else:
                                        		tmp = (((-4.0 * a) / (y_45_scale * x_45_scale_m)) * (a / (y_45_scale * x_45_scale_m))) * (b * b)
                                        	return tmp
                                        
                                        x-scale_m = abs(x_45_scale)
                                        function code(a, b, angle, x_45_scale_m, y_45_scale)
                                        	tmp = 0.0
                                        	if (b <= 4.6e-173)
                                        		tmp = Float64(Float64(Float64(Float64(Float64(b * a) * a) * -4.0) / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b);
                                        	else
                                        		tmp = Float64(Float64(Float64(Float64(-4.0 * a) / Float64(y_45_scale * x_45_scale_m)) * Float64(a / Float64(y_45_scale * x_45_scale_m))) * Float64(b * b));
                                        	end
                                        	return tmp
                                        end
                                        
                                        x-scale_m = abs(x_45_scale);
                                        function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale)
                                        	tmp = 0.0;
                                        	if (b <= 4.6e-173)
                                        		tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
                                        	else
                                        		tmp = (((-4.0 * a) / (y_45_scale * x_45_scale_m)) * (a / (y_45_scale * x_45_scale_m))) * (b * b);
                                        	end
                                        	tmp_2 = tmp;
                                        end
                                        
                                        x-scale_m = N[Abs[x$45$scale], $MachinePrecision]
                                        code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := If[LessEqual[b, 4.6e-173], N[(N[(N[(N[(N[(b * a), $MachinePrecision] * a), $MachinePrecision] * -4.0), $MachinePrecision] / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale$95$m), $MachinePrecision] * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], N[(N[(N[(N[(-4.0 * a), $MachinePrecision] / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] * N[(a / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]]
                                        
                                        \begin{array}{l}
                                        x-scale_m = \left|x-scale\right|
                                        
                                        \\
                                        \begin{array}{l}
                                        \mathbf{if}\;b \leq 4.6 \cdot 10^{-173}:\\
                                        \;\;\;\;\frac{\left(\left(b \cdot a\right) \cdot a\right) \cdot -4}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\_m\right) \cdot x-scale\_m} \cdot b\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;\left(\frac{-4 \cdot a}{y-scale \cdot x-scale\_m} \cdot \frac{a}{y-scale \cdot x-scale\_m}\right) \cdot \left(b \cdot b\right)\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if b < 4.59999999999999976e-173

                                          1. Initial program 24.0%

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

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

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

                                            \[\leadsto \left(-4 \cdot \frac{{a}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right) \cdot \left(\color{blue}{b} \cdot b\right) \]
                                          6. Step-by-step derivation
                                            1. Applied rewrites61.1%

                                              \[\leadsto \frac{-4 \cdot \left(a \cdot a\right)}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(\color{blue}{b} \cdot b\right) \]
                                            2. Step-by-step derivation
                                              1. Applied rewrites75.9%

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

                                                \[\leadsto \left(-4 \cdot \frac{{a}^{2} \cdot b}{{x-scale}^{2} \cdot {y-scale}^{2}}\right) \cdot b \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites66.3%

                                                  \[\leadsto \frac{\left(\left(b \cdot a\right) \cdot a\right) \cdot -4}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\right) \cdot x-scale} \cdot b \]

                                                if 4.59999999999999976e-173 < b

                                                1. Initial program 24.6%

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

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

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

                                                  \[\leadsto \left(-4 \cdot \frac{{a}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right) \cdot \left(\color{blue}{b} \cdot b\right) \]
                                                6. Step-by-step derivation
                                                  1. Applied rewrites71.2%

                                                    \[\leadsto \frac{-4 \cdot \left(a \cdot a\right)}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(\color{blue}{b} \cdot b\right) \]
                                                  2. Step-by-step derivation
                                                    1. Applied rewrites84.1%

                                                      \[\leadsto \left(\frac{-4 \cdot a}{y-scale \cdot x-scale} \cdot \frac{a}{y-scale \cdot x-scale}\right) \cdot \left(b \cdot b\right) \]
                                                  3. Recombined 2 regimes into one program.
                                                  4. Add Preprocessing

                                                  Alternative 6: 90.3% accurate, 32.3× speedup?

                                                  \[\begin{array}{l} x-scale_m = \left|x-scale\right| \\ \frac{\left(\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}\right) \cdot \left(b \cdot a\right)}{y-scale \cdot x-scale\_m} \end{array} \]
                                                  x-scale_m = (fabs.f64 x-scale)
                                                  (FPCore (a b angle x-scale_m y-scale)
                                                   :precision binary64
                                                   (/
                                                    (* (* (/ -4.0 y-scale) (/ (* b a) x-scale_m)) (* b a))
                                                    (* y-scale x-scale_m)))
                                                  x-scale_m = fabs(x_45_scale);
                                                  double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
                                                  	return (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) * (b * a)) / (y_45_scale * x_45_scale_m);
                                                  }
                                                  
                                                  x-scale_m =     private
                                                  module fmin_fmax_functions
                                                      implicit none
                                                      private
                                                      public fmax
                                                      public fmin
                                                  
                                                      interface fmax
                                                          module procedure fmax88
                                                          module procedure fmax44
                                                          module procedure fmax84
                                                          module procedure fmax48
                                                      end interface
                                                      interface fmin
                                                          module procedure fmin88
                                                          module procedure fmin44
                                                          module procedure fmin84
                                                          module procedure fmin48
                                                      end interface
                                                  contains
                                                      real(8) function fmax88(x, y) result (res)
                                                          real(8), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                      end function
                                                      real(4) function fmax44(x, y) result (res)
                                                          real(4), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmax84(x, y) result(res)
                                                          real(8), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmax48(x, y) result(res)
                                                          real(4), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmin88(x, y) result (res)
                                                          real(8), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                      end function
                                                      real(4) function fmin44(x, y) result (res)
                                                          real(4), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmin84(x, y) result(res)
                                                          real(8), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmin48(x, y) result(res)
                                                          real(4), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                      end function
                                                  end module
                                                  
                                                  real(8) function code(a, b, angle, x_45scale_m, y_45scale)
                                                  use fmin_fmax_functions
                                                      real(8), intent (in) :: a
                                                      real(8), intent (in) :: b
                                                      real(8), intent (in) :: angle
                                                      real(8), intent (in) :: x_45scale_m
                                                      real(8), intent (in) :: y_45scale
                                                      code = ((((-4.0d0) / y_45scale) * ((b * a) / x_45scale_m)) * (b * a)) / (y_45scale * x_45scale_m)
                                                  end function
                                                  
                                                  x-scale_m = Math.abs(x_45_scale);
                                                  public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
                                                  	return (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) * (b * a)) / (y_45_scale * x_45_scale_m);
                                                  }
                                                  
                                                  x-scale_m = math.fabs(x_45_scale)
                                                  def code(a, b, angle, x_45_scale_m, y_45_scale):
                                                  	return (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) * (b * a)) / (y_45_scale * x_45_scale_m)
                                                  
                                                  x-scale_m = abs(x_45_scale)
                                                  function code(a, b, angle, x_45_scale_m, y_45_scale)
                                                  	return Float64(Float64(Float64(Float64(-4.0 / y_45_scale) * Float64(Float64(b * a) / x_45_scale_m)) * Float64(b * a)) / Float64(y_45_scale * x_45_scale_m))
                                                  end
                                                  
                                                  x-scale_m = abs(x_45_scale);
                                                  function tmp = code(a, b, angle, x_45_scale_m, y_45_scale)
                                                  	tmp = (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) * (b * a)) / (y_45_scale * x_45_scale_m);
                                                  end
                                                  
                                                  x-scale_m = N[Abs[x$45$scale], $MachinePrecision]
                                                  code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := N[(N[(N[(N[(-4.0 / y$45$scale), $MachinePrecision] * N[(N[(b * a), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] * N[(b * a), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision]
                                                  
                                                  \begin{array}{l}
                                                  x-scale_m = \left|x-scale\right|
                                                  
                                                  \\
                                                  \frac{\left(\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}\right) \cdot \left(b \cdot a\right)}{y-scale \cdot x-scale\_m}
                                                  \end{array}
                                                  
                                                  Derivation
                                                  1. Initial program 24.2%

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

                                                    \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
                                                  4. Step-by-step derivation
                                                    1. associate-*r/N/A

                                                      \[\leadsto \color{blue}{\frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
                                                    2. *-commutativeN/A

                                                      \[\leadsto \frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{\color{blue}{{y-scale}^{2} \cdot {x-scale}^{2}}} \]
                                                    3. times-fracN/A

                                                      \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
                                                    4. lower-*.f64N/A

                                                      \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
                                                    5. lower-/.f64N/A

                                                      \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                                                    6. unpow2N/A

                                                      \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                                                    7. lower-*.f64N/A

                                                      \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                                                    8. *-commutativeN/A

                                                      \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{\color{blue}{{b}^{2} \cdot {a}^{2}}}{{x-scale}^{2}} \]
                                                    9. unpow2N/A

                                                      \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{{b}^{2} \cdot {a}^{2}}{\color{blue}{x-scale \cdot x-scale}} \]
                                                    10. times-fracN/A

                                                      \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
                                                    11. lower-*.f64N/A

                                                      \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
                                                    12. lower-/.f64N/A

                                                      \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\color{blue}{\frac{{b}^{2}}{x-scale}} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                                                    13. unpow2N/A

                                                      \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                                                    14. lower-*.f64N/A

                                                      \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                                                    15. lower-/.f64N/A

                                                      \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \color{blue}{\frac{{a}^{2}}{x-scale}}\right) \]
                                                    16. unpow2N/A

                                                      \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
                                                    17. lower-*.f6453.9

                                                      \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
                                                  5. Applied rewrites53.9%

                                                    \[\leadsto \color{blue}{\frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{a \cdot a}{x-scale}\right)} \]
                                                  6. Step-by-step derivation
                                                    1. Applied rewrites84.6%

                                                      \[\leadsto \frac{\frac{{\left(a \cdot b\right)}^{2}}{x-scale} \cdot \frac{-4}{y-scale}}{\color{blue}{y-scale \cdot x-scale}} \]
                                                    2. Step-by-step derivation
                                                      1. Applied rewrites87.7%

                                                        \[\leadsto \frac{\left(\left(a \cdot b\right) \cdot \frac{a \cdot b}{x-scale}\right) \cdot \frac{-4}{y-scale}}{y-scale \cdot x-scale} \]
                                                      2. Step-by-step derivation
                                                        1. Applied rewrites91.2%

                                                          \[\leadsto \frac{\left(\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale}\right) \cdot \left(b \cdot a\right)}{\color{blue}{y-scale} \cdot x-scale} \]
                                                        2. Add Preprocessing

                                                        Alternative 7: 89.6% accurate, 32.3× speedup?

                                                        \[\begin{array}{l} x-scale_m = \left|x-scale\right| \\ \left(b \cdot a\right) \cdot \frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}}{y-scale \cdot x-scale\_m} \end{array} \]
                                                        x-scale_m = (fabs.f64 x-scale)
                                                        (FPCore (a b angle x-scale_m y-scale)
                                                         :precision binary64
                                                         (*
                                                          (* b a)
                                                          (/ (* (/ -4.0 y-scale) (/ (* b a) x-scale_m)) (* y-scale x-scale_m))))
                                                        x-scale_m = fabs(x_45_scale);
                                                        double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
                                                        	return (b * a) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / (y_45_scale * x_45_scale_m));
                                                        }
                                                        
                                                        x-scale_m =     private
                                                        module fmin_fmax_functions
                                                            implicit none
                                                            private
                                                            public fmax
                                                            public fmin
                                                        
                                                            interface fmax
                                                                module procedure fmax88
                                                                module procedure fmax44
                                                                module procedure fmax84
                                                                module procedure fmax48
                                                            end interface
                                                            interface fmin
                                                                module procedure fmin88
                                                                module procedure fmin44
                                                                module procedure fmin84
                                                                module procedure fmin48
                                                            end interface
                                                        contains
                                                            real(8) function fmax88(x, y) result (res)
                                                                real(8), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                            end function
                                                            real(4) function fmax44(x, y) result (res)
                                                                real(4), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmax84(x, y) result(res)
                                                                real(8), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmax48(x, y) result(res)
                                                                real(4), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin88(x, y) result (res)
                                                                real(8), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                            end function
                                                            real(4) function fmin44(x, y) result (res)
                                                                real(4), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin84(x, y) result(res)
                                                                real(8), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin48(x, y) result(res)
                                                                real(4), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                            end function
                                                        end module
                                                        
                                                        real(8) function code(a, b, angle, x_45scale_m, y_45scale)
                                                        use fmin_fmax_functions
                                                            real(8), intent (in) :: a
                                                            real(8), intent (in) :: b
                                                            real(8), intent (in) :: angle
                                                            real(8), intent (in) :: x_45scale_m
                                                            real(8), intent (in) :: y_45scale
                                                            code = (b * a) * ((((-4.0d0) / y_45scale) * ((b * a) / x_45scale_m)) / (y_45scale * x_45scale_m))
                                                        end function
                                                        
                                                        x-scale_m = Math.abs(x_45_scale);
                                                        public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
                                                        	return (b * a) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / (y_45_scale * x_45_scale_m));
                                                        }
                                                        
                                                        x-scale_m = math.fabs(x_45_scale)
                                                        def code(a, b, angle, x_45_scale_m, y_45_scale):
                                                        	return (b * a) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / (y_45_scale * x_45_scale_m))
                                                        
                                                        x-scale_m = abs(x_45_scale)
                                                        function code(a, b, angle, x_45_scale_m, y_45_scale)
                                                        	return Float64(Float64(b * a) * Float64(Float64(Float64(-4.0 / y_45_scale) * Float64(Float64(b * a) / x_45_scale_m)) / Float64(y_45_scale * x_45_scale_m)))
                                                        end
                                                        
                                                        x-scale_m = abs(x_45_scale);
                                                        function tmp = code(a, b, angle, x_45_scale_m, y_45_scale)
                                                        	tmp = (b * a) * (((-4.0 / y_45_scale) * ((b * a) / x_45_scale_m)) / (y_45_scale * x_45_scale_m));
                                                        end
                                                        
                                                        x-scale_m = N[Abs[x$45$scale], $MachinePrecision]
                                                        code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := N[(N[(b * a), $MachinePrecision] * N[(N[(N[(-4.0 / y$45$scale), $MachinePrecision] * N[(N[(b * a), $MachinePrecision] / x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                                        
                                                        \begin{array}{l}
                                                        x-scale_m = \left|x-scale\right|
                                                        
                                                        \\
                                                        \left(b \cdot a\right) \cdot \frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale\_m}}{y-scale \cdot x-scale\_m}
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Initial program 24.2%

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

                                                          \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
                                                        4. Step-by-step derivation
                                                          1. associate-*r/N/A

                                                            \[\leadsto \color{blue}{\frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{{x-scale}^{2} \cdot {y-scale}^{2}}} \]
                                                          2. *-commutativeN/A

                                                            \[\leadsto \frac{-4 \cdot \left({a}^{2} \cdot {b}^{2}\right)}{\color{blue}{{y-scale}^{2} \cdot {x-scale}^{2}}} \]
                                                          3. times-fracN/A

                                                            \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
                                                          4. lower-*.f64N/A

                                                            \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}}} \]
                                                          5. lower-/.f64N/A

                                                            \[\leadsto \color{blue}{\frac{-4}{{y-scale}^{2}}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                                                          6. unpow2N/A

                                                            \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                                                          7. lower-*.f64N/A

                                                            \[\leadsto \frac{-4}{\color{blue}{y-scale \cdot y-scale}} \cdot \frac{{a}^{2} \cdot {b}^{2}}{{x-scale}^{2}} \]
                                                          8. *-commutativeN/A

                                                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{\color{blue}{{b}^{2} \cdot {a}^{2}}}{{x-scale}^{2}} \]
                                                          9. unpow2N/A

                                                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \frac{{b}^{2} \cdot {a}^{2}}{\color{blue}{x-scale \cdot x-scale}} \]
                                                          10. times-fracN/A

                                                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
                                                          11. lower-*.f64N/A

                                                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \color{blue}{\left(\frac{{b}^{2}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right)} \]
                                                          12. lower-/.f64N/A

                                                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\color{blue}{\frac{{b}^{2}}{x-scale}} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                                                          13. unpow2N/A

                                                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                                                          14. lower-*.f64N/A

                                                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{\color{blue}{b \cdot b}}{x-scale} \cdot \frac{{a}^{2}}{x-scale}\right) \]
                                                          15. lower-/.f64N/A

                                                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \color{blue}{\frac{{a}^{2}}{x-scale}}\right) \]
                                                          16. unpow2N/A

                                                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
                                                          17. lower-*.f6453.9

                                                            \[\leadsto \frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{\color{blue}{a \cdot a}}{x-scale}\right) \]
                                                        5. Applied rewrites53.9%

                                                          \[\leadsto \color{blue}{\frac{-4}{y-scale \cdot y-scale} \cdot \left(\frac{b \cdot b}{x-scale} \cdot \frac{a \cdot a}{x-scale}\right)} \]
                                                        6. Step-by-step derivation
                                                          1. Applied rewrites84.6%

                                                            \[\leadsto \frac{\frac{{\left(a \cdot b\right)}^{2}}{x-scale} \cdot \frac{-4}{y-scale}}{\color{blue}{y-scale \cdot x-scale}} \]
                                                          2. Step-by-step derivation
                                                            1. Applied rewrites87.7%

                                                              \[\leadsto \frac{\left(\left(a \cdot b\right) \cdot \frac{a \cdot b}{x-scale}\right) \cdot \frac{-4}{y-scale}}{y-scale \cdot x-scale} \]
                                                            2. Step-by-step derivation
                                                              1. Applied rewrites91.0%

                                                                \[\leadsto \left(b \cdot a\right) \cdot \color{blue}{\frac{\frac{-4}{y-scale} \cdot \frac{b \cdot a}{x-scale}}{y-scale \cdot x-scale}} \]
                                                              2. Add Preprocessing

                                                              Alternative 8: 82.6% accurate, 35.9× speedup?

                                                              \[\begin{array}{l} x-scale_m = \left|x-scale\right| \\ \left(\left(\left(-4 \cdot a\right) \cdot \frac{\frac{a}{y-scale \cdot x-scale\_m}}{y-scale \cdot x-scale\_m}\right) \cdot b\right) \cdot b \end{array} \]
                                                              x-scale_m = (fabs.f64 x-scale)
                                                              (FPCore (a b angle x-scale_m y-scale)
                                                               :precision binary64
                                                               (*
                                                                (* (* (* -4.0 a) (/ (/ a (* y-scale x-scale_m)) (* y-scale x-scale_m))) b)
                                                                b))
                                                              x-scale_m = fabs(x_45_scale);
                                                              double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
                                                              	return (((-4.0 * a) * ((a / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m))) * b) * b;
                                                              }
                                                              
                                                              x-scale_m =     private
                                                              module fmin_fmax_functions
                                                                  implicit none
                                                                  private
                                                                  public fmax
                                                                  public fmin
                                                              
                                                                  interface fmax
                                                                      module procedure fmax88
                                                                      module procedure fmax44
                                                                      module procedure fmax84
                                                                      module procedure fmax48
                                                                  end interface
                                                                  interface fmin
                                                                      module procedure fmin88
                                                                      module procedure fmin44
                                                                      module procedure fmin84
                                                                      module procedure fmin48
                                                                  end interface
                                                              contains
                                                                  real(8) function fmax88(x, y) result (res)
                                                                      real(8), intent (in) :: x
                                                                      real(8), intent (in) :: y
                                                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                  end function
                                                                  real(4) function fmax44(x, y) result (res)
                                                                      real(4), intent (in) :: x
                                                                      real(4), intent (in) :: y
                                                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmax84(x, y) result(res)
                                                                      real(8), intent (in) :: x
                                                                      real(4), intent (in) :: y
                                                                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmax48(x, y) result(res)
                                                                      real(4), intent (in) :: x
                                                                      real(8), intent (in) :: y
                                                                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmin88(x, y) result (res)
                                                                      real(8), intent (in) :: x
                                                                      real(8), intent (in) :: y
                                                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                  end function
                                                                  real(4) function fmin44(x, y) result (res)
                                                                      real(4), intent (in) :: x
                                                                      real(4), intent (in) :: y
                                                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmin84(x, y) result(res)
                                                                      real(8), intent (in) :: x
                                                                      real(4), intent (in) :: y
                                                                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmin48(x, y) result(res)
                                                                      real(4), intent (in) :: x
                                                                      real(8), intent (in) :: y
                                                                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                  end function
                                                              end module
                                                              
                                                              real(8) function code(a, b, angle, x_45scale_m, y_45scale)
                                                              use fmin_fmax_functions
                                                                  real(8), intent (in) :: a
                                                                  real(8), intent (in) :: b
                                                                  real(8), intent (in) :: angle
                                                                  real(8), intent (in) :: x_45scale_m
                                                                  real(8), intent (in) :: y_45scale
                                                                  code = ((((-4.0d0) * a) * ((a / (y_45scale * x_45scale_m)) / (y_45scale * x_45scale_m))) * b) * b
                                                              end function
                                                              
                                                              x-scale_m = Math.abs(x_45_scale);
                                                              public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
                                                              	return (((-4.0 * a) * ((a / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m))) * b) * b;
                                                              }
                                                              
                                                              x-scale_m = math.fabs(x_45_scale)
                                                              def code(a, b, angle, x_45_scale_m, y_45_scale):
                                                              	return (((-4.0 * a) * ((a / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m))) * b) * b
                                                              
                                                              x-scale_m = abs(x_45_scale)
                                                              function code(a, b, angle, x_45_scale_m, y_45_scale)
                                                              	return Float64(Float64(Float64(Float64(-4.0 * a) * Float64(Float64(a / Float64(y_45_scale * x_45_scale_m)) / Float64(y_45_scale * x_45_scale_m))) * b) * b)
                                                              end
                                                              
                                                              x-scale_m = abs(x_45_scale);
                                                              function tmp = code(a, b, angle, x_45_scale_m, y_45_scale)
                                                              	tmp = (((-4.0 * a) * ((a / (y_45_scale * x_45_scale_m)) / (y_45_scale * x_45_scale_m))) * b) * b;
                                                              end
                                                              
                                                              x-scale_m = N[Abs[x$45$scale], $MachinePrecision]
                                                              code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := N[(N[(N[(N[(-4.0 * a), $MachinePrecision] * N[(N[(a / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] * b), $MachinePrecision]
                                                              
                                                              \begin{array}{l}
                                                              x-scale_m = \left|x-scale\right|
                                                              
                                                              \\
                                                              \left(\left(\left(-4 \cdot a\right) \cdot \frac{\frac{a}{y-scale \cdot x-scale\_m}}{y-scale \cdot x-scale\_m}\right) \cdot b\right) \cdot b
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Initial program 24.2%

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

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

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

                                                                \[\leadsto \left(-4 \cdot \frac{{a}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right) \cdot \left(\color{blue}{b} \cdot b\right) \]
                                                              6. Step-by-step derivation
                                                                1. Applied rewrites65.0%

                                                                  \[\leadsto \frac{-4 \cdot \left(a \cdot a\right)}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(\color{blue}{b} \cdot b\right) \]
                                                                2. Step-by-step derivation
                                                                  1. Applied rewrites79.2%

                                                                    \[\leadsto \left(\left(\left(-4 \cdot a\right) \cdot \frac{a}{{\left(y-scale \cdot x-scale\right)}^{2}}\right) \cdot b\right) \cdot \color{blue}{b} \]
                                                                  2. Step-by-step derivation
                                                                    1. Applied rewrites84.6%

                                                                      \[\leadsto \left(\left(\left(-4 \cdot a\right) \cdot \frac{\frac{a}{y-scale \cdot x-scale}}{y-scale \cdot x-scale}\right) \cdot b\right) \cdot b \]
                                                                    2. Add Preprocessing

                                                                    Alternative 9: 65.6% accurate, 40.5× speedup?

                                                                    \[\begin{array}{l} x-scale_m = \left|x-scale\right| \\ \frac{\left(\left(b \cdot a\right) \cdot a\right) \cdot -4}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\_m\right) \cdot x-scale\_m} \cdot b \end{array} \]
                                                                    x-scale_m = (fabs.f64 x-scale)
                                                                    (FPCore (a b angle x-scale_m y-scale)
                                                                     :precision binary64
                                                                     (*
                                                                      (/ (* (* (* b a) a) -4.0) (* (* (* y-scale y-scale) x-scale_m) x-scale_m))
                                                                      b))
                                                                    x-scale_m = fabs(x_45_scale);
                                                                    double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
                                                                    	return ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
                                                                    }
                                                                    
                                                                    x-scale_m =     private
                                                                    module fmin_fmax_functions
                                                                        implicit none
                                                                        private
                                                                        public fmax
                                                                        public fmin
                                                                    
                                                                        interface fmax
                                                                            module procedure fmax88
                                                                            module procedure fmax44
                                                                            module procedure fmax84
                                                                            module procedure fmax48
                                                                        end interface
                                                                        interface fmin
                                                                            module procedure fmin88
                                                                            module procedure fmin44
                                                                            module procedure fmin84
                                                                            module procedure fmin48
                                                                        end interface
                                                                    contains
                                                                        real(8) function fmax88(x, y) result (res)
                                                                            real(8), intent (in) :: x
                                                                            real(8), intent (in) :: y
                                                                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                        end function
                                                                        real(4) function fmax44(x, y) result (res)
                                                                            real(4), intent (in) :: x
                                                                            real(4), intent (in) :: y
                                                                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                        end function
                                                                        real(8) function fmax84(x, y) result(res)
                                                                            real(8), intent (in) :: x
                                                                            real(4), intent (in) :: y
                                                                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                        end function
                                                                        real(8) function fmax48(x, y) result(res)
                                                                            real(4), intent (in) :: x
                                                                            real(8), intent (in) :: y
                                                                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                        end function
                                                                        real(8) function fmin88(x, y) result (res)
                                                                            real(8), intent (in) :: x
                                                                            real(8), intent (in) :: y
                                                                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                        end function
                                                                        real(4) function fmin44(x, y) result (res)
                                                                            real(4), intent (in) :: x
                                                                            real(4), intent (in) :: y
                                                                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                        end function
                                                                        real(8) function fmin84(x, y) result(res)
                                                                            real(8), intent (in) :: x
                                                                            real(4), intent (in) :: y
                                                                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                        end function
                                                                        real(8) function fmin48(x, y) result(res)
                                                                            real(4), intent (in) :: x
                                                                            real(8), intent (in) :: y
                                                                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                        end function
                                                                    end module
                                                                    
                                                                    real(8) function code(a, b, angle, x_45scale_m, y_45scale)
                                                                    use fmin_fmax_functions
                                                                        real(8), intent (in) :: a
                                                                        real(8), intent (in) :: b
                                                                        real(8), intent (in) :: angle
                                                                        real(8), intent (in) :: x_45scale_m
                                                                        real(8), intent (in) :: y_45scale
                                                                        code = ((((b * a) * a) * (-4.0d0)) / (((y_45scale * y_45scale) * x_45scale_m) * x_45scale_m)) * b
                                                                    end function
                                                                    
                                                                    x-scale_m = Math.abs(x_45_scale);
                                                                    public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale) {
                                                                    	return ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
                                                                    }
                                                                    
                                                                    x-scale_m = math.fabs(x_45_scale)
                                                                    def code(a, b, angle, x_45_scale_m, y_45_scale):
                                                                    	return ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b
                                                                    
                                                                    x-scale_m = abs(x_45_scale)
                                                                    function code(a, b, angle, x_45_scale_m, y_45_scale)
                                                                    	return Float64(Float64(Float64(Float64(Float64(b * a) * a) * -4.0) / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b)
                                                                    end
                                                                    
                                                                    x-scale_m = abs(x_45_scale);
                                                                    function tmp = code(a, b, angle, x_45_scale_m, y_45_scale)
                                                                    	tmp = ((((b * a) * a) * -4.0) / (((y_45_scale * y_45_scale) * x_45_scale_m) * x_45_scale_m)) * b;
                                                                    end
                                                                    
                                                                    x-scale_m = N[Abs[x$45$scale], $MachinePrecision]
                                                                    code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale_] := N[(N[(N[(N[(N[(b * a), $MachinePrecision] * a), $MachinePrecision] * -4.0), $MachinePrecision] / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale$95$m), $MachinePrecision] * x$45$scale$95$m), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]
                                                                    
                                                                    \begin{array}{l}
                                                                    x-scale_m = \left|x-scale\right|
                                                                    
                                                                    \\
                                                                    \frac{\left(\left(b \cdot a\right) \cdot a\right) \cdot -4}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\_m\right) \cdot x-scale\_m} \cdot b
                                                                    \end{array}
                                                                    
                                                                    Derivation
                                                                    1. Initial program 24.2%

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

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

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

                                                                      \[\leadsto \left(-4 \cdot \frac{{a}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right) \cdot \left(\color{blue}{b} \cdot b\right) \]
                                                                    6. Step-by-step derivation
                                                                      1. Applied rewrites65.0%

                                                                        \[\leadsto \frac{-4 \cdot \left(a \cdot a\right)}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(\color{blue}{b} \cdot b\right) \]
                                                                      2. Step-by-step derivation
                                                                        1. Applied rewrites79.2%

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

                                                                          \[\leadsto \left(-4 \cdot \frac{{a}^{2} \cdot b}{{x-scale}^{2} \cdot {y-scale}^{2}}\right) \cdot b \]
                                                                        3. Step-by-step derivation
                                                                          1. Applied rewrites66.7%

                                                                            \[\leadsto \frac{\left(\left(b \cdot a\right) \cdot a\right) \cdot -4}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\right) \cdot x-scale} \cdot b \]
                                                                          2. Add Preprocessing

                                                                          Reproduce

                                                                          ?
                                                                          herbie shell --seed 2025010 
                                                                          (FPCore (a b angle x-scale y-scale)
                                                                            :name "Simplification of discriminant from scale-rotated-ellipse"
                                                                            :precision binary64
                                                                            (- (* (/ (/ (* (* (* 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 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) (PI)))) (cos (* (/ angle 180.0) (PI)))) x-scale) y-scale)) (* (* 4.0 (/ (/ (+ (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))))