Simplification of discriminant from scale-rotated-ellipse

Percentage Accurate: 24.9% → 88.3%
Time: 2.3min
Alternatives: 8
Speedup: 1905.0×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{angle}{180} \cdot \pi\\ 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)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = (angle / 180.0) * ((double) M_PI);
	double t_1 = sin(t_0);
	double t_2 = cos(t_0);
	double t_3 = ((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	return (t_3 * t_3) - ((4.0 * (((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a * t_2), 2.0) + pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = (angle / 180.0) * Math.PI;
	double t_1 = Math.sin(t_0);
	double t_2 = Math.cos(t_0);
	double t_3 = ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	return (t_3 * t_3) - ((4.0 * (((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
def code(a, b, angle, x_45_scale, y_45_scale):
	t_0 = (angle / 180.0) * math.pi
	t_1 = math.sin(t_0)
	t_2 = math.cos(t_0)
	t_3 = ((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale
	return (t_3 * t_3) - ((4.0 * (((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale))
function code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = Float64(Float64(angle / 180.0) * pi)
	t_1 = sin(t_0)
	t_2 = cos(t_0)
	t_3 = Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale)
	return Float64(Float64(t_3 * t_3) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale)))
end
function tmp = code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = (angle / 180.0) * pi;
	t_1 = sin(t_0);
	t_2 = cos(t_0);
	t_3 = ((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	tmp = (t_3 * t_3) - ((4.0 * (((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale));
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a * t$95$1), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$2), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$1), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
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 8 alternatives:

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

Initial Program: 24.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{angle}{180} \cdot \pi\\ 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)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = (angle / 180.0) * ((double) M_PI);
	double t_1 = sin(t_0);
	double t_2 = cos(t_0);
	double t_3 = ((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	return (t_3 * t_3) - ((4.0 * (((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a * t_2), 2.0) + pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = (angle / 180.0) * Math.PI;
	double t_1 = Math.sin(t_0);
	double t_2 = Math.cos(t_0);
	double t_3 = ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	return (t_3 * t_3) - ((4.0 * (((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
def code(a, b, angle, x_45_scale, y_45_scale):
	t_0 = (angle / 180.0) * math.pi
	t_1 = math.sin(t_0)
	t_2 = math.cos(t_0)
	t_3 = ((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale
	return (t_3 * t_3) - ((4.0 * (((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale))
function code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = Float64(Float64(angle / 180.0) * pi)
	t_1 = sin(t_0)
	t_2 = cos(t_0)
	t_3 = Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale)
	return Float64(Float64(t_3 * t_3) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale)))
end
function tmp = code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = (angle / 180.0) * pi;
	t_1 = sin(t_0);
	t_2 = cos(t_0);
	t_3 = ((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	tmp = (t_3 * t_3) - ((4.0 * (((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale));
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a * t$95$1), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$2), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$1), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
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: 88.3% accurate, 26.8× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ \begin{array}{l} t_0 := b\_m \cdot \left(a \cdot \frac{-4}{x-scale \cdot y-scale}\right)\\ \mathbf{if}\;b\_m \leq 1.16 \cdot 10^{-201}:\\ \;\;\;\;\frac{\frac{-4 \cdot \left(b\_m \cdot \left(a \cdot \left(b\_m \cdot a\right)\right)\right)}{x-scale \cdot y-scale}}{x-scale \cdot y-scale}\\ \mathbf{elif}\;b\_m \leq 3.6 \cdot 10^{+213}:\\ \;\;\;\;\left(b\_m \cdot t\_0\right) \cdot \frac{\frac{a}{x-scale}}{y-scale}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{x-scale} \cdot \left(t\_0 \cdot \frac{b\_m}{y-scale}\right)\\ \end{array} \end{array} \]
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (* b_m (* a (/ -4.0 (* x-scale y-scale))))))
   (if (<= b_m 1.16e-201)
     (/
      (/ (* -4.0 (* b_m (* a (* b_m a)))) (* x-scale y-scale))
      (* x-scale y-scale))
     (if (<= b_m 3.6e+213)
       (* (* b_m t_0) (/ (/ a x-scale) y-scale))
       (* (/ a x-scale) (* t_0 (/ b_m y-scale)))))))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = b_m * (a * (-4.0 / (x_45_scale * y_45_scale)));
	double tmp;
	if (b_m <= 1.16e-201) {
		tmp = ((-4.0 * (b_m * (a * (b_m * a)))) / (x_45_scale * y_45_scale)) / (x_45_scale * y_45_scale);
	} else if (b_m <= 3.6e+213) {
		tmp = (b_m * t_0) * ((a / x_45_scale) / y_45_scale);
	} else {
		tmp = (a / x_45_scale) * (t_0 * (b_m / y_45_scale));
	}
	return tmp;
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: angle
    real(8), intent (in) :: x_45scale
    real(8), intent (in) :: y_45scale
    real(8) :: t_0
    real(8) :: tmp
    t_0 = b_m * (a * ((-4.0d0) / (x_45scale * y_45scale)))
    if (b_m <= 1.16d-201) then
        tmp = (((-4.0d0) * (b_m * (a * (b_m * a)))) / (x_45scale * y_45scale)) / (x_45scale * y_45scale)
    else if (b_m <= 3.6d+213) then
        tmp = (b_m * t_0) * ((a / x_45scale) / y_45scale)
    else
        tmp = (a / x_45scale) * (t_0 * (b_m / y_45scale))
    end if
    code = tmp
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = b_m * (a * (-4.0 / (x_45_scale * y_45_scale)));
	double tmp;
	if (b_m <= 1.16e-201) {
		tmp = ((-4.0 * (b_m * (a * (b_m * a)))) / (x_45_scale * y_45_scale)) / (x_45_scale * y_45_scale);
	} else if (b_m <= 3.6e+213) {
		tmp = (b_m * t_0) * ((a / x_45_scale) / y_45_scale);
	} else {
		tmp = (a / x_45_scale) * (t_0 * (b_m / y_45_scale));
	}
	return tmp;
}
b_m = math.fabs(b)
def code(a, b_m, angle, x_45_scale, y_45_scale):
	t_0 = b_m * (a * (-4.0 / (x_45_scale * y_45_scale)))
	tmp = 0
	if b_m <= 1.16e-201:
		tmp = ((-4.0 * (b_m * (a * (b_m * a)))) / (x_45_scale * y_45_scale)) / (x_45_scale * y_45_scale)
	elif b_m <= 3.6e+213:
		tmp = (b_m * t_0) * ((a / x_45_scale) / y_45_scale)
	else:
		tmp = (a / x_45_scale) * (t_0 * (b_m / y_45_scale))
	return tmp
b_m = abs(b)
function code(a, b_m, angle, x_45_scale, y_45_scale)
	t_0 = Float64(b_m * Float64(a * Float64(-4.0 / Float64(x_45_scale * y_45_scale))))
	tmp = 0.0
	if (b_m <= 1.16e-201)
		tmp = Float64(Float64(Float64(-4.0 * Float64(b_m * Float64(a * Float64(b_m * a)))) / Float64(x_45_scale * y_45_scale)) / Float64(x_45_scale * y_45_scale));
	elseif (b_m <= 3.6e+213)
		tmp = Float64(Float64(b_m * t_0) * Float64(Float64(a / x_45_scale) / y_45_scale));
	else
		tmp = Float64(Float64(a / x_45_scale) * Float64(t_0 * Float64(b_m / y_45_scale)));
	end
	return tmp
end
b_m = abs(b);
function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale)
	t_0 = b_m * (a * (-4.0 / (x_45_scale * y_45_scale)));
	tmp = 0.0;
	if (b_m <= 1.16e-201)
		tmp = ((-4.0 * (b_m * (a * (b_m * a)))) / (x_45_scale * y_45_scale)) / (x_45_scale * y_45_scale);
	elseif (b_m <= 3.6e+213)
		tmp = (b_m * t_0) * ((a / x_45_scale) / y_45_scale);
	else
		tmp = (a / x_45_scale) * (t_0 * (b_m / y_45_scale));
	end
	tmp_2 = tmp;
end
b_m = N[Abs[b], $MachinePrecision]
code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(b$95$m * N[(a * N[(-4.0 / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b$95$m, 1.16e-201], N[(N[(N[(-4.0 * N[(b$95$m * N[(a * N[(b$95$m * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$m, 3.6e+213], N[(N[(b$95$m * t$95$0), $MachinePrecision] * N[(N[(a / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision], N[(N[(a / x$45$scale), $MachinePrecision] * N[(t$95$0 * N[(b$95$m / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
b_m = \left|b\right|

\\
\begin{array}{l}
t_0 := b\_m \cdot \left(a \cdot \frac{-4}{x-scale \cdot y-scale}\right)\\
\mathbf{if}\;b\_m \leq 1.16 \cdot 10^{-201}:\\
\;\;\;\;\frac{\frac{-4 \cdot \left(b\_m \cdot \left(a \cdot \left(b\_m \cdot a\right)\right)\right)}{x-scale \cdot y-scale}}{x-scale \cdot y-scale}\\

\mathbf{elif}\;b\_m \leq 3.6 \cdot 10^{+213}:\\
\;\;\;\;\left(b\_m \cdot t\_0\right) \cdot \frac{\frac{a}{x-scale}}{y-scale}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < 1.15999999999999995e-201

    1. Initial program 30.1%

      \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 1.15999999999999995e-201 < b < 3.6000000000000001e213

          1. Initial program 25.9%

            \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if 3.6000000000000001e213 < b

                1. Initial program 0.0%

                  \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.16 \cdot 10^{-201}:\\ \;\;\;\;\frac{\frac{-4 \cdot \left(b \cdot \left(a \cdot \left(b \cdot a\right)\right)\right)}{x-scale \cdot y-scale}}{x-scale \cdot y-scale}\\ \mathbf{elif}\;b \leq 3.6 \cdot 10^{+213}:\\ \;\;\;\;\left(b \cdot \left(b \cdot \left(a \cdot \frac{-4}{x-scale \cdot y-scale}\right)\right)\right) \cdot \frac{\frac{a}{x-scale}}{y-scale}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{x-scale} \cdot \left(\left(b \cdot \left(a \cdot \frac{-4}{x-scale \cdot y-scale}\right)\right) \cdot \frac{b}{y-scale}\right)\\ \end{array} \]
                    5. Add Preprocessing

                    Alternative 2: 83.9% accurate, 29.3× speedup?

                    \[\begin{array}{l} b_m = \left|b\right| \\ \begin{array}{l} \mathbf{if}\;b\_m \leq 2.1 \cdot 10^{-158}:\\ \;\;\;\;\frac{\frac{-4 \cdot \left(b\_m \cdot \left(a \cdot \left(b\_m \cdot a\right)\right)\right)}{x-scale \cdot y-scale}}{x-scale \cdot y-scale}\\ \mathbf{elif}\;b\_m \leq 5 \cdot 10^{+146}:\\ \;\;\;\;\frac{a \cdot \frac{a \cdot \left(-4 \cdot \left(b\_m \cdot b\_m\right)\right)}{x-scale \cdot y-scale}}{x-scale \cdot y-scale}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(a \cdot \left(b\_m \cdot \left(a \cdot -4\right)\right)\right) \cdot \frac{b\_m}{y-scale \cdot \left(x-scale \cdot y-scale\right)}}{x-scale}\\ \end{array} \end{array} \]
                    b_m = (fabs.f64 b)
                    (FPCore (a b_m angle x-scale y-scale)
                     :precision binary64
                     (if (<= b_m 2.1e-158)
                       (/
                        (/ (* -4.0 (* b_m (* a (* b_m a)))) (* x-scale y-scale))
                        (* x-scale y-scale))
                       (if (<= b_m 5e+146)
                         (/
                          (* a (/ (* a (* -4.0 (* b_m b_m))) (* x-scale y-scale)))
                          (* x-scale y-scale))
                         (/
                          (* (* a (* b_m (* a -4.0))) (/ b_m (* y-scale (* x-scale y-scale))))
                          x-scale))))
                    b_m = fabs(b);
                    double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
                    	double tmp;
                    	if (b_m <= 2.1e-158) {
                    		tmp = ((-4.0 * (b_m * (a * (b_m * a)))) / (x_45_scale * y_45_scale)) / (x_45_scale * y_45_scale);
                    	} else if (b_m <= 5e+146) {
                    		tmp = (a * ((a * (-4.0 * (b_m * b_m))) / (x_45_scale * y_45_scale))) / (x_45_scale * y_45_scale);
                    	} else {
                    		tmp = ((a * (b_m * (a * -4.0))) * (b_m / (y_45_scale * (x_45_scale * y_45_scale)))) / x_45_scale;
                    	}
                    	return tmp;
                    }
                    
                    b_m = abs(b)
                    real(8) function code(a, b_m, angle, x_45scale, y_45scale)
                        real(8), intent (in) :: a
                        real(8), intent (in) :: b_m
                        real(8), intent (in) :: angle
                        real(8), intent (in) :: x_45scale
                        real(8), intent (in) :: y_45scale
                        real(8) :: tmp
                        if (b_m <= 2.1d-158) then
                            tmp = (((-4.0d0) * (b_m * (a * (b_m * a)))) / (x_45scale * y_45scale)) / (x_45scale * y_45scale)
                        else if (b_m <= 5d+146) then
                            tmp = (a * ((a * ((-4.0d0) * (b_m * b_m))) / (x_45scale * y_45scale))) / (x_45scale * y_45scale)
                        else
                            tmp = ((a * (b_m * (a * (-4.0d0)))) * (b_m / (y_45scale * (x_45scale * y_45scale)))) / x_45scale
                        end if
                        code = tmp
                    end function
                    
                    b_m = Math.abs(b);
                    public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
                    	double tmp;
                    	if (b_m <= 2.1e-158) {
                    		tmp = ((-4.0 * (b_m * (a * (b_m * a)))) / (x_45_scale * y_45_scale)) / (x_45_scale * y_45_scale);
                    	} else if (b_m <= 5e+146) {
                    		tmp = (a * ((a * (-4.0 * (b_m * b_m))) / (x_45_scale * y_45_scale))) / (x_45_scale * y_45_scale);
                    	} else {
                    		tmp = ((a * (b_m * (a * -4.0))) * (b_m / (y_45_scale * (x_45_scale * y_45_scale)))) / x_45_scale;
                    	}
                    	return tmp;
                    }
                    
                    b_m = math.fabs(b)
                    def code(a, b_m, angle, x_45_scale, y_45_scale):
                    	tmp = 0
                    	if b_m <= 2.1e-158:
                    		tmp = ((-4.0 * (b_m * (a * (b_m * a)))) / (x_45_scale * y_45_scale)) / (x_45_scale * y_45_scale)
                    	elif b_m <= 5e+146:
                    		tmp = (a * ((a * (-4.0 * (b_m * b_m))) / (x_45_scale * y_45_scale))) / (x_45_scale * y_45_scale)
                    	else:
                    		tmp = ((a * (b_m * (a * -4.0))) * (b_m / (y_45_scale * (x_45_scale * y_45_scale)))) / x_45_scale
                    	return tmp
                    
                    b_m = abs(b)
                    function code(a, b_m, angle, x_45_scale, y_45_scale)
                    	tmp = 0.0
                    	if (b_m <= 2.1e-158)
                    		tmp = Float64(Float64(Float64(-4.0 * Float64(b_m * Float64(a * Float64(b_m * a)))) / Float64(x_45_scale * y_45_scale)) / Float64(x_45_scale * y_45_scale));
                    	elseif (b_m <= 5e+146)
                    		tmp = Float64(Float64(a * Float64(Float64(a * Float64(-4.0 * Float64(b_m * b_m))) / Float64(x_45_scale * y_45_scale))) / Float64(x_45_scale * y_45_scale));
                    	else
                    		tmp = Float64(Float64(Float64(a * Float64(b_m * Float64(a * -4.0))) * Float64(b_m / Float64(y_45_scale * Float64(x_45_scale * y_45_scale)))) / x_45_scale);
                    	end
                    	return tmp
                    end
                    
                    b_m = abs(b);
                    function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale)
                    	tmp = 0.0;
                    	if (b_m <= 2.1e-158)
                    		tmp = ((-4.0 * (b_m * (a * (b_m * a)))) / (x_45_scale * y_45_scale)) / (x_45_scale * y_45_scale);
                    	elseif (b_m <= 5e+146)
                    		tmp = (a * ((a * (-4.0 * (b_m * b_m))) / (x_45_scale * y_45_scale))) / (x_45_scale * y_45_scale);
                    	else
                    		tmp = ((a * (b_m * (a * -4.0))) * (b_m / (y_45_scale * (x_45_scale * y_45_scale)))) / x_45_scale;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    b_m = N[Abs[b], $MachinePrecision]
                    code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[b$95$m, 2.1e-158], N[(N[(N[(-4.0 * N[(b$95$m * N[(a * N[(b$95$m * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$m, 5e+146], N[(N[(a * N[(N[(a * N[(-4.0 * N[(b$95$m * b$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * N[(b$95$m * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b$95$m / N[(y$45$scale * N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision]]]
                    
                    \begin{array}{l}
                    b_m = \left|b\right|
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;b\_m \leq 2.1 \cdot 10^{-158}:\\
                    \;\;\;\;\frac{\frac{-4 \cdot \left(b\_m \cdot \left(a \cdot \left(b\_m \cdot a\right)\right)\right)}{x-scale \cdot y-scale}}{x-scale \cdot y-scale}\\
                    
                    \mathbf{elif}\;b\_m \leq 5 \cdot 10^{+146}:\\
                    \;\;\;\;\frac{a \cdot \frac{a \cdot \left(-4 \cdot \left(b\_m \cdot b\_m\right)\right)}{x-scale \cdot y-scale}}{x-scale \cdot y-scale}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\frac{\left(a \cdot \left(b\_m \cdot \left(a \cdot -4\right)\right)\right) \cdot \frac{b\_m}{y-scale \cdot \left(x-scale \cdot y-scale\right)}}{x-scale}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if b < 2.09999999999999991e-158

                      1. Initial program 30.1%

                        \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            if 2.09999999999999991e-158 < b < 4.9999999999999999e146

                            1. Initial program 27.9%

                              \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  if 4.9999999999999999e146 < b

                                  1. Initial program 4.5%

                                    \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                        \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 2.1 \cdot 10^{-158}:\\ \;\;\;\;\frac{\frac{-4 \cdot \left(b \cdot \left(a \cdot \left(b \cdot a\right)\right)\right)}{x-scale \cdot y-scale}}{x-scale \cdot y-scale}\\ \mathbf{elif}\;b \leq 5 \cdot 10^{+146}:\\ \;\;\;\;\frac{a \cdot \frac{a \cdot \left(-4 \cdot \left(b \cdot b\right)\right)}{x-scale \cdot y-scale}}{x-scale \cdot y-scale}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(a \cdot \left(b \cdot \left(a \cdot -4\right)\right)\right) \cdot \frac{b}{y-scale \cdot \left(x-scale \cdot y-scale\right)}}{x-scale}\\ \end{array} \]
                                      5. Add Preprocessing

                                      Alternative 3: 82.2% accurate, 29.3× speedup?

                                      \[\begin{array}{l} b_m = \left|b\right| \\ \begin{array}{l} \mathbf{if}\;b\_m \leq 1.1 \cdot 10^{-158}:\\ \;\;\;\;\frac{4 \cdot \left(\left(a \cdot \left(b\_m \cdot a\right)\right) \cdot \left(-b\_m\right)\right)}{\left(x-scale \cdot y-scale\right) \cdot \left(x-scale \cdot y-scale\right)}\\ \mathbf{elif}\;b\_m \leq 5 \cdot 10^{+146}:\\ \;\;\;\;\frac{a \cdot \frac{a \cdot \left(-4 \cdot \left(b\_m \cdot b\_m\right)\right)}{x-scale \cdot y-scale}}{x-scale \cdot y-scale}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(a \cdot \left(b\_m \cdot \left(a \cdot -4\right)\right)\right) \cdot \frac{b\_m}{y-scale \cdot \left(x-scale \cdot y-scale\right)}}{x-scale}\\ \end{array} \end{array} \]
                                      b_m = (fabs.f64 b)
                                      (FPCore (a b_m angle x-scale y-scale)
                                       :precision binary64
                                       (if (<= b_m 1.1e-158)
                                         (/
                                          (* 4.0 (* (* a (* b_m a)) (- b_m)))
                                          (* (* x-scale y-scale) (* x-scale y-scale)))
                                         (if (<= b_m 5e+146)
                                           (/
                                            (* a (/ (* a (* -4.0 (* b_m b_m))) (* x-scale y-scale)))
                                            (* x-scale y-scale))
                                           (/
                                            (* (* a (* b_m (* a -4.0))) (/ b_m (* y-scale (* x-scale y-scale))))
                                            x-scale))))
                                      b_m = fabs(b);
                                      double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
                                      	double tmp;
                                      	if (b_m <= 1.1e-158) {
                                      		tmp = (4.0 * ((a * (b_m * a)) * -b_m)) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale));
                                      	} else if (b_m <= 5e+146) {
                                      		tmp = (a * ((a * (-4.0 * (b_m * b_m))) / (x_45_scale * y_45_scale))) / (x_45_scale * y_45_scale);
                                      	} else {
                                      		tmp = ((a * (b_m * (a * -4.0))) * (b_m / (y_45_scale * (x_45_scale * y_45_scale)))) / x_45_scale;
                                      	}
                                      	return tmp;
                                      }
                                      
                                      b_m = abs(b)
                                      real(8) function code(a, b_m, angle, x_45scale, y_45scale)
                                          real(8), intent (in) :: a
                                          real(8), intent (in) :: b_m
                                          real(8), intent (in) :: angle
                                          real(8), intent (in) :: x_45scale
                                          real(8), intent (in) :: y_45scale
                                          real(8) :: tmp
                                          if (b_m <= 1.1d-158) then
                                              tmp = (4.0d0 * ((a * (b_m * a)) * -b_m)) / ((x_45scale * y_45scale) * (x_45scale * y_45scale))
                                          else if (b_m <= 5d+146) then
                                              tmp = (a * ((a * ((-4.0d0) * (b_m * b_m))) / (x_45scale * y_45scale))) / (x_45scale * y_45scale)
                                          else
                                              tmp = ((a * (b_m * (a * (-4.0d0)))) * (b_m / (y_45scale * (x_45scale * y_45scale)))) / x_45scale
                                          end if
                                          code = tmp
                                      end function
                                      
                                      b_m = Math.abs(b);
                                      public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
                                      	double tmp;
                                      	if (b_m <= 1.1e-158) {
                                      		tmp = (4.0 * ((a * (b_m * a)) * -b_m)) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale));
                                      	} else if (b_m <= 5e+146) {
                                      		tmp = (a * ((a * (-4.0 * (b_m * b_m))) / (x_45_scale * y_45_scale))) / (x_45_scale * y_45_scale);
                                      	} else {
                                      		tmp = ((a * (b_m * (a * -4.0))) * (b_m / (y_45_scale * (x_45_scale * y_45_scale)))) / x_45_scale;
                                      	}
                                      	return tmp;
                                      }
                                      
                                      b_m = math.fabs(b)
                                      def code(a, b_m, angle, x_45_scale, y_45_scale):
                                      	tmp = 0
                                      	if b_m <= 1.1e-158:
                                      		tmp = (4.0 * ((a * (b_m * a)) * -b_m)) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale))
                                      	elif b_m <= 5e+146:
                                      		tmp = (a * ((a * (-4.0 * (b_m * b_m))) / (x_45_scale * y_45_scale))) / (x_45_scale * y_45_scale)
                                      	else:
                                      		tmp = ((a * (b_m * (a * -4.0))) * (b_m / (y_45_scale * (x_45_scale * y_45_scale)))) / x_45_scale
                                      	return tmp
                                      
                                      b_m = abs(b)
                                      function code(a, b_m, angle, x_45_scale, y_45_scale)
                                      	tmp = 0.0
                                      	if (b_m <= 1.1e-158)
                                      		tmp = Float64(Float64(4.0 * Float64(Float64(a * Float64(b_m * a)) * Float64(-b_m))) / Float64(Float64(x_45_scale * y_45_scale) * Float64(x_45_scale * y_45_scale)));
                                      	elseif (b_m <= 5e+146)
                                      		tmp = Float64(Float64(a * Float64(Float64(a * Float64(-4.0 * Float64(b_m * b_m))) / Float64(x_45_scale * y_45_scale))) / Float64(x_45_scale * y_45_scale));
                                      	else
                                      		tmp = Float64(Float64(Float64(a * Float64(b_m * Float64(a * -4.0))) * Float64(b_m / Float64(y_45_scale * Float64(x_45_scale * y_45_scale)))) / x_45_scale);
                                      	end
                                      	return tmp
                                      end
                                      
                                      b_m = abs(b);
                                      function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale)
                                      	tmp = 0.0;
                                      	if (b_m <= 1.1e-158)
                                      		tmp = (4.0 * ((a * (b_m * a)) * -b_m)) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale));
                                      	elseif (b_m <= 5e+146)
                                      		tmp = (a * ((a * (-4.0 * (b_m * b_m))) / (x_45_scale * y_45_scale))) / (x_45_scale * y_45_scale);
                                      	else
                                      		tmp = ((a * (b_m * (a * -4.0))) * (b_m / (y_45_scale * (x_45_scale * y_45_scale)))) / x_45_scale;
                                      	end
                                      	tmp_2 = tmp;
                                      end
                                      
                                      b_m = N[Abs[b], $MachinePrecision]
                                      code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[b$95$m, 1.1e-158], N[(N[(4.0 * N[(N[(a * N[(b$95$m * a), $MachinePrecision]), $MachinePrecision] * (-b$95$m)), $MachinePrecision]), $MachinePrecision] / N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$m, 5e+146], N[(N[(a * N[(N[(a * N[(-4.0 * N[(b$95$m * b$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * N[(b$95$m * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b$95$m / N[(y$45$scale * N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision]]]
                                      
                                      \begin{array}{l}
                                      b_m = \left|b\right|
                                      
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;b\_m \leq 1.1 \cdot 10^{-158}:\\
                                      \;\;\;\;\frac{4 \cdot \left(\left(a \cdot \left(b\_m \cdot a\right)\right) \cdot \left(-b\_m\right)\right)}{\left(x-scale \cdot y-scale\right) \cdot \left(x-scale \cdot y-scale\right)}\\
                                      
                                      \mathbf{elif}\;b\_m \leq 5 \cdot 10^{+146}:\\
                                      \;\;\;\;\frac{a \cdot \frac{a \cdot \left(-4 \cdot \left(b\_m \cdot b\_m\right)\right)}{x-scale \cdot y-scale}}{x-scale \cdot y-scale}\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\frac{\left(a \cdot \left(b\_m \cdot \left(a \cdot -4\right)\right)\right) \cdot \frac{b\_m}{y-scale \cdot \left(x-scale \cdot y-scale\right)}}{x-scale}\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 3 regimes
                                      2. if b < 1.1000000000000001e-158

                                        1. Initial program 30.1%

                                          \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                              if 1.1000000000000001e-158 < b < 4.9999999999999999e146

                                              1. Initial program 27.9%

                                                \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                    if 4.9999999999999999e146 < b

                                                    1. Initial program 4.5%

                                                      \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                          \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.1 \cdot 10^{-158}:\\ \;\;\;\;\frac{4 \cdot \left(\left(a \cdot \left(b \cdot a\right)\right) \cdot \left(-b\right)\right)}{\left(x-scale \cdot y-scale\right) \cdot \left(x-scale \cdot y-scale\right)}\\ \mathbf{elif}\;b \leq 5 \cdot 10^{+146}:\\ \;\;\;\;\frac{a \cdot \frac{a \cdot \left(-4 \cdot \left(b \cdot b\right)\right)}{x-scale \cdot y-scale}}{x-scale \cdot y-scale}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(a \cdot \left(b \cdot \left(a \cdot -4\right)\right)\right) \cdot \frac{b}{y-scale \cdot \left(x-scale \cdot y-scale\right)}}{x-scale}\\ \end{array} \]
                                                        5. Add Preprocessing

                                                        Alternative 4: 81.9% accurate, 29.3× speedup?

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

                                                          1. Initial program 29.8%

                                                            \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                if 1.02e-133 < b < 3.7000000000000003e141

                                                                1. Initial program 29.2%

                                                                  \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                      if 3.7000000000000003e141 < b

                                                                      1. Initial program 4.3%

                                                                        \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.02 \cdot 10^{-133}:\\ \;\;\;\;\frac{4 \cdot \left(\left(a \cdot \left(b \cdot a\right)\right) \cdot \left(-b\right)\right)}{\left(x-scale \cdot y-scale\right) \cdot \left(x-scale \cdot y-scale\right)}\\ \mathbf{elif}\;b \leq 3.7 \cdot 10^{+141}:\\ \;\;\;\;a \cdot \left(\frac{-4 \cdot \left(b \cdot b\right)}{x-scale \cdot y-scale} \cdot \frac{a}{x-scale \cdot y-scale}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(a \cdot \left(b \cdot \left(a \cdot -4\right)\right)\right) \cdot \frac{b}{y-scale \cdot \left(x-scale \cdot y-scale\right)}}{x-scale}\\ \end{array} \]
                                                                          5. Add Preprocessing

                                                                          Alternative 5: 81.4% accurate, 29.3× speedup?

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

                                                                            1. Initial program 29.8%

                                                                              \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                  if 1.02e-133 < b < 3.7000000000000003e141

                                                                                  1. Initial program 29.2%

                                                                                    \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                        if 3.7000000000000003e141 < b

                                                                                        1. Initial program 4.3%

                                                                                          \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.02 \cdot 10^{-133}:\\ \;\;\;\;\frac{4 \cdot \left(\left(a \cdot \left(b \cdot a\right)\right) \cdot \left(-b\right)\right)}{\left(x-scale \cdot y-scale\right) \cdot \left(x-scale \cdot y-scale\right)}\\ \mathbf{elif}\;b \leq 3.7 \cdot 10^{+141}:\\ \;\;\;\;a \cdot \left(\frac{-4 \cdot \left(b \cdot b\right)}{x-scale \cdot y-scale} \cdot \frac{a}{x-scale \cdot y-scale}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot \left(b \cdot \left(a \cdot -4\right)\right)\right) \cdot \frac{b}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\\ \end{array} \]
                                                                                          5. Add Preprocessing

                                                                                          Alternative 6: 87.8% accurate, 29.3× speedup?

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

                                                                                            1. Initial program 30.4%

                                                                                              \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                  if 6.0000000000000003e-221 < b

                                                                                                  1. Initial program 22.2%

                                                                                                    \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                        \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 6 \cdot 10^{-221}:\\ \;\;\;\;\frac{\frac{-4 \cdot \left(b \cdot \left(a \cdot \left(b \cdot a\right)\right)\right)}{x-scale \cdot y-scale}}{x-scale \cdot y-scale}\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot \left(b \cdot \left(a \cdot \frac{-4}{x-scale \cdot y-scale}\right)\right)\right) \cdot \frac{\frac{a}{x-scale}}{y-scale}\\ \end{array} \]
                                                                                                      5. Add Preprocessing

                                                                                                      Alternative 7: 77.3% accurate, 40.5× speedup?

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

                                                                                                        \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\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 \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                          Alternative 8: 35.6% accurate, 1905.0× speedup?

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

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

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

                                                                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(angle \cdot angle, \mathsf{fma}\left(0.0001234567901234568, \frac{\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\left(\left(b + a\right) \cdot \left(b - a\right)\right) \cdot \left(\pi \cdot \pi\right)\right)}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}, -4 \cdot \mathsf{fma}\left(b, b \cdot \frac{\left(\pi \cdot \pi\right) \cdot \mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5}, a \cdot a, 3.08641975308642 \cdot 10^{-5} \cdot \left(b \cdot b\right)\right)}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}, \frac{\left(a \cdot a\right) \cdot \left(\left(\pi \cdot \pi\right) \cdot \mathsf{fma}\left(-3.08641975308642 \cdot 10^{-5}, b \cdot b, 3.08641975308642 \cdot 10^{-5} \cdot \left(a \cdot a\right)\right)\right)}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}\right)\right), \frac{\left(-4 \cdot \left(b \cdot b\right)\right) \cdot \left(a \cdot a\right)}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}\right)} \]
                                                                                                          5. Taylor expanded in b around 0

                                                                                                            \[\leadsto {angle}^{2} \cdot \color{blue}{\left(\frac{-1}{8100} \cdot \frac{{a}^{4} \cdot {\mathsf{PI}\left(\right)}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}} + \frac{1}{8100} \cdot \frac{{a}^{4} \cdot {\mathsf{PI}\left(\right)}^{2}}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)} \]
                                                                                                          6. Step-by-step derivation
                                                                                                            1. Applied rewrites23.7%

                                                                                                              \[\leadsto \left(angle \cdot angle\right) \cdot \color{blue}{0} \]
                                                                                                            2. Taylor expanded in angle around 0

                                                                                                              \[\leadsto 0 \]
                                                                                                            3. Step-by-step derivation
                                                                                                              1. Applied rewrites34.7%

                                                                                                                \[\leadsto 0 \]
                                                                                                              2. Add Preprocessing

                                                                                                              Reproduce

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