a from scale-rotated-ellipse

Percentage Accurate: 2.5% → 51.5%
Time: 2.1min
Alternatives: 13
Speedup: 1249.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(a \cdot t_2\right)}^{2} + {\left(b \cdot t_1\right)}^{2}}{y-scale}}{y-scale}\\ t_4 := \frac{\frac{{\left(a \cdot t_1\right)}^{2} + {\left(b \cdot t_2\right)}^{2}}{x-scale}}{x-scale}\\ t_5 := \left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\\ t_6 := \frac{4 \cdot t_5}{{\left(x-scale \cdot y-scale\right)}^{2}}\\ \frac{-\sqrt{\left(\left(2 \cdot t_6\right) \cdot t_5\right) \cdot \left(\left(t_4 + t_3\right) + \sqrt{{\left(t_4 - t_3\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_1\right) \cdot t_2}{x-scale}}{y-scale}\right)}^{2}}\right)}}{t_6} \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (* (/ angle 180.0) PI))
        (t_1 (sin t_0))
        (t_2 (cos t_0))
        (t_3
         (/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale))
        (t_4
         (/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
        (t_5 (* (* b a) (* b (- a))))
        (t_6 (/ (* 4.0 t_5) (pow (* x-scale y-scale) 2.0))))
   (/
    (-
     (sqrt
      (*
       (* (* 2.0 t_6) t_5)
       (+
        (+ t_4 t_3)
        (sqrt
         (+
          (pow (- t_4 t_3) 2.0)
          (pow
           (/
            (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
            y-scale)
           2.0)))))))
    t_6)))
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 = ((pow((a * t_2), 2.0) + pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale;
	double t_4 = ((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale;
	double t_5 = (b * a) * (b * -a);
	double t_6 = (4.0 * t_5) / pow((x_45_scale * y_45_scale), 2.0);
	return -sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + sqrt((pow((t_4 - t_3), 2.0) + pow((((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale), 2.0)))))) / t_6;
}
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 = ((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale;
	double t_4 = ((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale;
	double t_5 = (b * a) * (b * -a);
	double t_6 = (4.0 * t_5) / Math.pow((x_45_scale * y_45_scale), 2.0);
	return -Math.sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + Math.sqrt((Math.pow((t_4 - t_3), 2.0) + Math.pow((((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale), 2.0)))))) / t_6;
}
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 = ((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale
	t_4 = ((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale
	t_5 = (b * a) * (b * -a)
	t_6 = (4.0 * t_5) / math.pow((x_45_scale * y_45_scale), 2.0)
	return -math.sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + math.sqrt((math.pow((t_4 - t_3), 2.0) + math.pow((((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale), 2.0)))))) / t_6
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(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale)
	t_4 = Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)
	t_5 = Float64(Float64(b * a) * Float64(b * Float64(-a)))
	t_6 = Float64(Float64(4.0 * t_5) / (Float64(x_45_scale * y_45_scale) ^ 2.0))
	return Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * t_6) * t_5) * Float64(Float64(t_4 + t_3) + sqrt(Float64((Float64(t_4 - t_3) ^ 2.0) + (Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale) ^ 2.0))))))) / t_6)
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 = ((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale;
	t_4 = ((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale;
	t_5 = (b * a) * (b * -a);
	t_6 = (4.0 * t_5) / ((x_45_scale * y_45_scale) ^ 2.0);
	tmp = -sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + sqrt((((t_4 - t_3) ^ 2.0) + ((((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale) ^ 2.0)))))) / t_6;
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[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]}, Block[{t$95$4 = 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]}, Block[{t$95$5 = N[(N[(b * a), $MachinePrecision] * N[(b * (-a)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(4.0 * t$95$5), $MachinePrecision] / N[Power[N[(x$45$scale * y$45$scale), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(N[(2.0 * t$95$6), $MachinePrecision] * t$95$5), $MachinePrecision] * N[(N[(t$95$4 + t$95$3), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(t$95$4 - t$95$3), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[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], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$6), $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(a \cdot t_2\right)}^{2} + {\left(b \cdot t_1\right)}^{2}}{y-scale}}{y-scale}\\
t_4 := \frac{\frac{{\left(a \cdot t_1\right)}^{2} + {\left(b \cdot t_2\right)}^{2}}{x-scale}}{x-scale}\\
t_5 := \left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\\
t_6 := \frac{4 \cdot t_5}{{\left(x-scale \cdot y-scale\right)}^{2}}\\
\frac{-\sqrt{\left(\left(2 \cdot t_6\right) \cdot t_5\right) \cdot \left(\left(t_4 + t_3\right) + \sqrt{{\left(t_4 - t_3\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_1\right) \cdot t_2}{x-scale}}{y-scale}\right)}^{2}}\right)}}{t_6}
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 2.5% 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(a \cdot t_2\right)}^{2} + {\left(b \cdot t_1\right)}^{2}}{y-scale}}{y-scale}\\ t_4 := \frac{\frac{{\left(a \cdot t_1\right)}^{2} + {\left(b \cdot t_2\right)}^{2}}{x-scale}}{x-scale}\\ t_5 := \left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\\ t_6 := \frac{4 \cdot t_5}{{\left(x-scale \cdot y-scale\right)}^{2}}\\ \frac{-\sqrt{\left(\left(2 \cdot t_6\right) \cdot t_5\right) \cdot \left(\left(t_4 + t_3\right) + \sqrt{{\left(t_4 - t_3\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_1\right) \cdot t_2}{x-scale}}{y-scale}\right)}^{2}}\right)}}{t_6} \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (* (/ angle 180.0) PI))
        (t_1 (sin t_0))
        (t_2 (cos t_0))
        (t_3
         (/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale))
        (t_4
         (/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
        (t_5 (* (* b a) (* b (- a))))
        (t_6 (/ (* 4.0 t_5) (pow (* x-scale y-scale) 2.0))))
   (/
    (-
     (sqrt
      (*
       (* (* 2.0 t_6) t_5)
       (+
        (+ t_4 t_3)
        (sqrt
         (+
          (pow (- t_4 t_3) 2.0)
          (pow
           (/
            (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
            y-scale)
           2.0)))))))
    t_6)))
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 = ((pow((a * t_2), 2.0) + pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale;
	double t_4 = ((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale;
	double t_5 = (b * a) * (b * -a);
	double t_6 = (4.0 * t_5) / pow((x_45_scale * y_45_scale), 2.0);
	return -sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + sqrt((pow((t_4 - t_3), 2.0) + pow((((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale), 2.0)))))) / t_6;
}
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 = ((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale;
	double t_4 = ((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale;
	double t_5 = (b * a) * (b * -a);
	double t_6 = (4.0 * t_5) / Math.pow((x_45_scale * y_45_scale), 2.0);
	return -Math.sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + Math.sqrt((Math.pow((t_4 - t_3), 2.0) + Math.pow((((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale), 2.0)))))) / t_6;
}
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 = ((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale
	t_4 = ((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale
	t_5 = (b * a) * (b * -a)
	t_6 = (4.0 * t_5) / math.pow((x_45_scale * y_45_scale), 2.0)
	return -math.sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + math.sqrt((math.pow((t_4 - t_3), 2.0) + math.pow((((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale), 2.0)))))) / t_6
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(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale)
	t_4 = Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)
	t_5 = Float64(Float64(b * a) * Float64(b * Float64(-a)))
	t_6 = Float64(Float64(4.0 * t_5) / (Float64(x_45_scale * y_45_scale) ^ 2.0))
	return Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * t_6) * t_5) * Float64(Float64(t_4 + t_3) + sqrt(Float64((Float64(t_4 - t_3) ^ 2.0) + (Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale) ^ 2.0))))))) / t_6)
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 = ((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale;
	t_4 = ((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale;
	t_5 = (b * a) * (b * -a);
	t_6 = (4.0 * t_5) / ((x_45_scale * y_45_scale) ^ 2.0);
	tmp = -sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + sqrt((((t_4 - t_3) ^ 2.0) + ((((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale) ^ 2.0)))))) / t_6;
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[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]}, Block[{t$95$4 = 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]}, Block[{t$95$5 = N[(N[(b * a), $MachinePrecision] * N[(b * (-a)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(4.0 * t$95$5), $MachinePrecision] / N[Power[N[(x$45$scale * y$45$scale), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(N[(2.0 * t$95$6), $MachinePrecision] * t$95$5), $MachinePrecision] * N[(N[(t$95$4 + t$95$3), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(t$95$4 - t$95$3), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[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], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$6), $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(a \cdot t_2\right)}^{2} + {\left(b \cdot t_1\right)}^{2}}{y-scale}}{y-scale}\\
t_4 := \frac{\frac{{\left(a \cdot t_1\right)}^{2} + {\left(b \cdot t_2\right)}^{2}}{x-scale}}{x-scale}\\
t_5 := \left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\\
t_6 := \frac{4 \cdot t_5}{{\left(x-scale \cdot y-scale\right)}^{2}}\\
\frac{-\sqrt{\left(\left(2 \cdot t_6\right) \cdot t_5\right) \cdot \left(\left(t_4 + t_3\right) + \sqrt{{\left(t_4 - t_3\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_1\right) \cdot t_2}{x-scale}}{y-scale}\right)}^{2}}\right)}}{t_6}
\end{array}
\end{array}

Alternative 1: 51.5% accurate, 4.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \pi \cdot \left(0.005555555555555556 \cdot angle\right)\\ t_1 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\ \mathbf{if}\;x-scale \leq -1.52 \cdot 10^{+34}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \left(y-scale \cdot \sqrt{8}\right)\right) \cdot \frac{-\sqrt{2 \cdot \left({\left(a \cdot \cos t_1\right)}^{2} + {\left(b \cdot \sin t_1\right)}^{2}\right)}}{y-scale}\right)\\ \mathbf{elif}\;x-scale \leq 4.4 \cdot 10^{+24}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(\mathsf{hypot}\left(a \cdot \cos t_0, b \cdot \sin t_0\right) \cdot \sqrt{2}\right) \cdot \left(x-scale \cdot \sqrt{8}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (* PI (* 0.005555555555555556 angle)))
        (t_1 (* 0.005555555555555556 (* angle PI))))
   (if (<= x-scale -1.52e+34)
     (*
      0.25
      (*
       (* x-scale (* y-scale (sqrt 8.0)))
       (/
        (-
         (sqrt
          (* 2.0 (+ (pow (* a (cos t_1)) 2.0) (pow (* b (sin t_1)) 2.0)))))
        y-scale)))
     (if (<= x-scale 4.4e+24)
       (fabs (* 4.0 (* 0.25 (* y-scale b))))
       (*
        0.25
        (*
         (* (hypot (* a (cos t_0)) (* b (sin t_0))) (sqrt 2.0))
         (* x-scale (sqrt 8.0))))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = ((double) M_PI) * (0.005555555555555556 * angle);
	double t_1 = 0.005555555555555556 * (angle * ((double) M_PI));
	double tmp;
	if (x_45_scale <= -1.52e+34) {
		tmp = 0.25 * ((x_45_scale * (y_45_scale * sqrt(8.0))) * (-sqrt((2.0 * (pow((a * cos(t_1)), 2.0) + pow((b * sin(t_1)), 2.0)))) / y_45_scale));
	} else if (x_45_scale <= 4.4e+24) {
		tmp = fabs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * ((hypot((a * cos(t_0)), (b * sin(t_0))) * sqrt(2.0)) * (x_45_scale * sqrt(8.0)));
	}
	return tmp;
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = Math.PI * (0.005555555555555556 * angle);
	double t_1 = 0.005555555555555556 * (angle * Math.PI);
	double tmp;
	if (x_45_scale <= -1.52e+34) {
		tmp = 0.25 * ((x_45_scale * (y_45_scale * Math.sqrt(8.0))) * (-Math.sqrt((2.0 * (Math.pow((a * Math.cos(t_1)), 2.0) + Math.pow((b * Math.sin(t_1)), 2.0)))) / y_45_scale));
	} else if (x_45_scale <= 4.4e+24) {
		tmp = Math.abs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * ((Math.hypot((a * Math.cos(t_0)), (b * Math.sin(t_0))) * Math.sqrt(2.0)) * (x_45_scale * Math.sqrt(8.0)));
	}
	return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale):
	t_0 = math.pi * (0.005555555555555556 * angle)
	t_1 = 0.005555555555555556 * (angle * math.pi)
	tmp = 0
	if x_45_scale <= -1.52e+34:
		tmp = 0.25 * ((x_45_scale * (y_45_scale * math.sqrt(8.0))) * (-math.sqrt((2.0 * (math.pow((a * math.cos(t_1)), 2.0) + math.pow((b * math.sin(t_1)), 2.0)))) / y_45_scale))
	elif x_45_scale <= 4.4e+24:
		tmp = math.fabs((4.0 * (0.25 * (y_45_scale * b))))
	else:
		tmp = 0.25 * ((math.hypot((a * math.cos(t_0)), (b * math.sin(t_0))) * math.sqrt(2.0)) * (x_45_scale * math.sqrt(8.0)))
	return tmp
function code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = Float64(pi * Float64(0.005555555555555556 * angle))
	t_1 = Float64(0.005555555555555556 * Float64(angle * pi))
	tmp = 0.0
	if (x_45_scale <= -1.52e+34)
		tmp = Float64(0.25 * Float64(Float64(x_45_scale * Float64(y_45_scale * sqrt(8.0))) * Float64(Float64(-sqrt(Float64(2.0 * Float64((Float64(a * cos(t_1)) ^ 2.0) + (Float64(b * sin(t_1)) ^ 2.0))))) / y_45_scale)));
	elseif (x_45_scale <= 4.4e+24)
		tmp = abs(Float64(4.0 * Float64(0.25 * Float64(y_45_scale * b))));
	else
		tmp = Float64(0.25 * Float64(Float64(hypot(Float64(a * cos(t_0)), Float64(b * sin(t_0))) * sqrt(2.0)) * Float64(x_45_scale * sqrt(8.0))));
	end
	return tmp
end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = pi * (0.005555555555555556 * angle);
	t_1 = 0.005555555555555556 * (angle * pi);
	tmp = 0.0;
	if (x_45_scale <= -1.52e+34)
		tmp = 0.25 * ((x_45_scale * (y_45_scale * sqrt(8.0))) * (-sqrt((2.0 * (((a * cos(t_1)) ^ 2.0) + ((b * sin(t_1)) ^ 2.0)))) / y_45_scale));
	elseif (x_45_scale <= 4.4e+24)
		tmp = abs((4.0 * (0.25 * (y_45_scale * b))));
	else
		tmp = 0.25 * ((hypot((a * cos(t_0)), (b * sin(t_0))) * sqrt(2.0)) * (x_45_scale * sqrt(8.0)));
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$45$scale, -1.52e+34], N[(0.25 * N[(N[(x$45$scale * N[(y$45$scale * N[Sqrt[8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[N[(2.0 * N[(N[Power[N[(a * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$45$scale, 4.4e+24], N[Abs[N[(4.0 * N[(0.25 * N[(y$45$scale * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(0.25 * N[(N[(N[Sqrt[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[(x$45$scale * N[Sqrt[8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \pi \cdot \left(0.005555555555555556 \cdot angle\right)\\
t_1 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
\mathbf{if}\;x-scale \leq -1.52 \cdot 10^{+34}:\\
\;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \left(y-scale \cdot \sqrt{8}\right)\right) \cdot \frac{-\sqrt{2 \cdot \left({\left(a \cdot \cos t_1\right)}^{2} + {\left(b \cdot \sin t_1\right)}^{2}\right)}}{y-scale}\right)\\

\mathbf{elif}\;x-scale \leq 4.4 \cdot 10^{+24}:\\
\;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(\mathsf{hypot}\left(a \cdot \cos t_0, b \cdot \sin t_0\right) \cdot \sqrt{2}\right) \cdot \left(x-scale \cdot \sqrt{8}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x-scale < -1.52000000000000001e34

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in x-scale around inf 12.6%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \left(y-scale \cdot \sqrt{8}\right)\right) \cdot \sqrt{2 \cdot \frac{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}} + 2 \cdot \frac{{b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}}}\right)} \]
    4. Taylor expanded in y-scale around -inf 49.3%

      \[\leadsto 0.25 \cdot \left(\left(x-scale \cdot \left(y-scale \cdot \sqrt{8}\right)\right) \cdot \color{blue}{\left(-1 \cdot \left(\frac{1}{y-scale} \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)\right)}\right) \]
    5. Step-by-step derivation
      1. mul-1-neg49.3%

        \[\leadsto 0.25 \cdot \left(\left(x-scale \cdot \left(y-scale \cdot \sqrt{8}\right)\right) \cdot \color{blue}{\left(-\frac{1}{y-scale} \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)}\right) \]
      2. associate-*l/49.3%

        \[\leadsto 0.25 \cdot \left(\left(x-scale \cdot \left(y-scale \cdot \sqrt{8}\right)\right) \cdot \left(-\color{blue}{\frac{1 \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}}{y-scale}}\right)\right) \]
      3. *-lft-identity49.3%

        \[\leadsto 0.25 \cdot \left(\left(x-scale \cdot \left(y-scale \cdot \sqrt{8}\right)\right) \cdot \left(-\frac{\color{blue}{\sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}}}{y-scale}\right)\right) \]
      4. distribute-neg-frac49.3%

        \[\leadsto 0.25 \cdot \left(\left(x-scale \cdot \left(y-scale \cdot \sqrt{8}\right)\right) \cdot \color{blue}{\frac{-\sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}}{y-scale}}\right) \]
    6. Simplified52.0%

      \[\leadsto 0.25 \cdot \left(\left(x-scale \cdot \left(y-scale \cdot \sqrt{8}\right)\right) \cdot \color{blue}{\frac{-\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)}}{y-scale}}\right) \]

    if -1.52000000000000001e34 < x-scale < 4.40000000000000003e24

    1. Initial program 1.1%

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

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in angle around 0 27.4%

      \[\leadsto \color{blue}{0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. add-exp-log26.3%

        \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)}} \]
      2. associate-*r*26.3%

        \[\leadsto e^{\log \left(0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)} \]
      3. sqrt-unprod26.3%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)\right)} \]
      4. metadata-eval26.3%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \sqrt{\color{blue}{16}}\right)\right)} \]
      5. metadata-eval26.3%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)\right)} \]
    5. Applied egg-rr26.3%

      \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
    6. Step-by-step derivation
      1. rem-exp-log27.6%

        \[\leadsto \color{blue}{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \]
      2. add-sqr-sqrt27.0%

        \[\leadsto \color{blue}{\sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \cdot \sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)}} \]
      3. sqrt-unprod37.9%

        \[\leadsto \color{blue}{\sqrt{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right) \cdot \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
      4. pow237.9%

        \[\leadsto \sqrt{\color{blue}{{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}^{2}}} \]
      5. associate-*l*37.9%

        \[\leadsto \sqrt{{\left(0.25 \cdot \color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)}\right)}^{2}} \]
    7. Applied egg-rr37.9%

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

        \[\leadsto \sqrt{\color{blue}{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right) \cdot \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}} \]
      2. rem-sqrt-square44.6%

        \[\leadsto \color{blue}{\left|0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right|} \]
      3. associate-*r*44.6%

        \[\leadsto \left|0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right)}\right| \]
      4. associate-*l*44.6%

        \[\leadsto \left|\color{blue}{\left(0.25 \cdot \left(b \cdot y-scale\right)\right) \cdot 4}\right| \]
      5. *-commutative44.6%

        \[\leadsto \left|\color{blue}{4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)}\right| \]
    9. Simplified44.6%

      \[\leadsto \color{blue}{\left|4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)\right|} \]

    if 4.40000000000000003e24 < x-scale

    1. Initial program 3.8%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified3.9%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 66.9%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified72.4%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Step-by-step derivation
      1. pow1/272.4%

        \[\leadsto 0.25 \cdot \left(\color{blue}{{\left(2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)\right)}^{0.5}} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      2. *-commutative72.4%

        \[\leadsto 0.25 \cdot \left({\color{blue}{\left(\left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right) \cdot 2\right)}}^{0.5} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      3. pow-prod-down72.4%

        \[\leadsto 0.25 \cdot \left({\left(\left(\color{blue}{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right) \cdot 2\right)}^{0.5} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      4. pow-prod-down66.9%

        \[\leadsto 0.25 \cdot \left({\left(\left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + \color{blue}{{b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}\right) \cdot 2\right)}^{0.5} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      5. unpow-prod-down66.7%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left({\left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}^{0.5} \cdot {2}^{0.5}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    6. Applied egg-rr74.0%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\mathsf{hypot}\left(\cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right) \cdot a, \sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right) \cdot b\right) \cdot \sqrt{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification53.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x-scale \leq -1.52 \cdot 10^{+34}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \left(y-scale \cdot \sqrt{8}\right)\right) \cdot \frac{-\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)}}{y-scale}\right)\\ \mathbf{elif}\;x-scale \leq 4.4 \cdot 10^{+24}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(\mathsf{hypot}\left(a \cdot \cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right), b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right) \cdot \sqrt{2}\right) \cdot \left(x-scale \cdot \sqrt{8}\right)\right)\\ \end{array} \]

Alternative 2: 43.1% accurate, 5.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \pi \cdot \left(0.005555555555555556 \cdot angle\right)\\ t_1 := x-scale \cdot \sqrt{8}\\ \mathbf{if}\;x-scale \leq -1.05 \cdot 10^{+23}:\\ \;\;\;\;0.25 \cdot \left(t_1 \cdot \left(a \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(-\sqrt{2}\right)\right)\right)\right)\\ \mathbf{elif}\;x-scale \leq 4.2 \cdot 10^{+22}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(\mathsf{hypot}\left(a \cdot \cos t_0, b \cdot \sin t_0\right) \cdot \sqrt{2}\right) \cdot t_1\right)\\ \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (* PI (* 0.005555555555555556 angle)))
        (t_1 (* x-scale (sqrt 8.0))))
   (if (<= x-scale -1.05e+23)
     (*
      0.25
      (*
       t_1
       (* a (* (cos (* 0.005555555555555556 (* angle PI))) (- (sqrt 2.0))))))
     (if (<= x-scale 4.2e+22)
       (fabs (* 4.0 (* 0.25 (* y-scale b))))
       (*
        0.25
        (* (* (hypot (* a (cos t_0)) (* b (sin t_0))) (sqrt 2.0)) t_1))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = ((double) M_PI) * (0.005555555555555556 * angle);
	double t_1 = x_45_scale * sqrt(8.0);
	double tmp;
	if (x_45_scale <= -1.05e+23) {
		tmp = 0.25 * (t_1 * (a * (cos((0.005555555555555556 * (angle * ((double) M_PI)))) * -sqrt(2.0))));
	} else if (x_45_scale <= 4.2e+22) {
		tmp = fabs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * ((hypot((a * cos(t_0)), (b * sin(t_0))) * sqrt(2.0)) * t_1);
	}
	return tmp;
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = Math.PI * (0.005555555555555556 * angle);
	double t_1 = x_45_scale * Math.sqrt(8.0);
	double tmp;
	if (x_45_scale <= -1.05e+23) {
		tmp = 0.25 * (t_1 * (a * (Math.cos((0.005555555555555556 * (angle * Math.PI))) * -Math.sqrt(2.0))));
	} else if (x_45_scale <= 4.2e+22) {
		tmp = Math.abs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * ((Math.hypot((a * Math.cos(t_0)), (b * Math.sin(t_0))) * Math.sqrt(2.0)) * t_1);
	}
	return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale):
	t_0 = math.pi * (0.005555555555555556 * angle)
	t_1 = x_45_scale * math.sqrt(8.0)
	tmp = 0
	if x_45_scale <= -1.05e+23:
		tmp = 0.25 * (t_1 * (a * (math.cos((0.005555555555555556 * (angle * math.pi))) * -math.sqrt(2.0))))
	elif x_45_scale <= 4.2e+22:
		tmp = math.fabs((4.0 * (0.25 * (y_45_scale * b))))
	else:
		tmp = 0.25 * ((math.hypot((a * math.cos(t_0)), (b * math.sin(t_0))) * math.sqrt(2.0)) * t_1)
	return tmp
function code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = Float64(pi * Float64(0.005555555555555556 * angle))
	t_1 = Float64(x_45_scale * sqrt(8.0))
	tmp = 0.0
	if (x_45_scale <= -1.05e+23)
		tmp = Float64(0.25 * Float64(t_1 * Float64(a * Float64(cos(Float64(0.005555555555555556 * Float64(angle * pi))) * Float64(-sqrt(2.0))))));
	elseif (x_45_scale <= 4.2e+22)
		tmp = abs(Float64(4.0 * Float64(0.25 * Float64(y_45_scale * b))));
	else
		tmp = Float64(0.25 * Float64(Float64(hypot(Float64(a * cos(t_0)), Float64(b * sin(t_0))) * sqrt(2.0)) * t_1));
	end
	return tmp
end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = pi * (0.005555555555555556 * angle);
	t_1 = x_45_scale * sqrt(8.0);
	tmp = 0.0;
	if (x_45_scale <= -1.05e+23)
		tmp = 0.25 * (t_1 * (a * (cos((0.005555555555555556 * (angle * pi))) * -sqrt(2.0))));
	elseif (x_45_scale <= 4.2e+22)
		tmp = abs((4.0 * (0.25 * (y_45_scale * b))));
	else
		tmp = 0.25 * ((hypot((a * cos(t_0)), (b * sin(t_0))) * sqrt(2.0)) * t_1);
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$45$scale * N[Sqrt[8.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$45$scale, -1.05e+23], N[(0.25 * N[(t$95$1 * N[(a * N[(N[Cos[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$45$scale, 4.2e+22], N[Abs[N[(4.0 * N[(0.25 * N[(y$45$scale * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(0.25 * N[(N[(N[Sqrt[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \pi \cdot \left(0.005555555555555556 \cdot angle\right)\\
t_1 := x-scale \cdot \sqrt{8}\\
\mathbf{if}\;x-scale \leq -1.05 \cdot 10^{+23}:\\
\;\;\;\;0.25 \cdot \left(t_1 \cdot \left(a \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(-\sqrt{2}\right)\right)\right)\right)\\

\mathbf{elif}\;x-scale \leq 4.2 \cdot 10^{+22}:\\
\;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(\mathsf{hypot}\left(a \cdot \cos t_0, b \cdot \sin t_0\right) \cdot \sqrt{2}\right) \cdot t_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x-scale < -1.0500000000000001e23

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 1.0%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified1.0%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Taylor expanded in a around -inf 19.2%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(-1 \cdot \left(a \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt{2}\right)\right)\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    6. Step-by-step derivation
      1. mul-1-neg19.2%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(-a \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt{2}\right)\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      2. *-commutative19.2%

        \[\leadsto 0.25 \cdot \left(\left(-\color{blue}{\left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt{2}\right) \cdot a}\right) \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      3. distribute-rgt-neg-in19.2%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt{2}\right) \cdot \left(-a\right)\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      4. *-commutative19.2%

        \[\leadsto 0.25 \cdot \left(\left(\color{blue}{\left(\sqrt{2} \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)} \cdot \left(-a\right)\right) \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    7. Simplified19.2%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\left(\sqrt{2} \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \left(-a\right)\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]

    if -1.0500000000000001e23 < x-scale < 4.1999999999999996e22

    1. Initial program 1.1%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified2.8%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in angle around 0 28.3%

      \[\leadsto \color{blue}{0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. add-exp-log27.1%

        \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)}} \]
      2. associate-*r*27.1%

        \[\leadsto e^{\log \left(0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)} \]
      3. sqrt-unprod27.1%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)\right)} \]
      4. metadata-eval27.1%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \sqrt{\color{blue}{16}}\right)\right)} \]
      5. metadata-eval27.1%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)\right)} \]
    5. Applied egg-rr27.1%

      \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
    6. Step-by-step derivation
      1. rem-exp-log28.4%

        \[\leadsto \color{blue}{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \]
      2. add-sqr-sqrt27.8%

        \[\leadsto \color{blue}{\sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \cdot \sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)}} \]
      3. sqrt-unprod39.3%

        \[\leadsto \color{blue}{\sqrt{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right) \cdot \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
      4. pow239.3%

        \[\leadsto \sqrt{\color{blue}{{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}^{2}}} \]
      5. associate-*l*39.3%

        \[\leadsto \sqrt{{\left(0.25 \cdot \color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)}\right)}^{2}} \]
    7. Applied egg-rr39.3%

      \[\leadsto \color{blue}{\sqrt{{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}^{2}}} \]
    8. Step-by-step derivation
      1. unpow239.3%

        \[\leadsto \sqrt{\color{blue}{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right) \cdot \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}} \]
      2. rem-sqrt-square46.1%

        \[\leadsto \color{blue}{\left|0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right|} \]
      3. associate-*r*46.1%

        \[\leadsto \left|0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right)}\right| \]
      4. associate-*l*46.1%

        \[\leadsto \left|\color{blue}{\left(0.25 \cdot \left(b \cdot y-scale\right)\right) \cdot 4}\right| \]
      5. *-commutative46.1%

        \[\leadsto \left|\color{blue}{4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)}\right| \]
    9. Simplified46.1%

      \[\leadsto \color{blue}{\left|4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)\right|} \]

    if 4.1999999999999996e22 < x-scale

    1. Initial program 3.8%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified3.9%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 66.9%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified72.4%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Step-by-step derivation
      1. pow1/272.4%

        \[\leadsto 0.25 \cdot \left(\color{blue}{{\left(2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)\right)}^{0.5}} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      2. *-commutative72.4%

        \[\leadsto 0.25 \cdot \left({\color{blue}{\left(\left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right) \cdot 2\right)}}^{0.5} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      3. pow-prod-down72.4%

        \[\leadsto 0.25 \cdot \left({\left(\left(\color{blue}{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right) \cdot 2\right)}^{0.5} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      4. pow-prod-down66.9%

        \[\leadsto 0.25 \cdot \left({\left(\left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + \color{blue}{{b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}\right) \cdot 2\right)}^{0.5} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      5. unpow-prod-down66.7%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left({\left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}^{0.5} \cdot {2}^{0.5}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    6. Applied egg-rr74.0%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\mathsf{hypot}\left(\cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right) \cdot a, \sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right) \cdot b\right) \cdot \sqrt{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification44.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x-scale \leq -1.05 \cdot 10^{+23}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(-\sqrt{2}\right)\right)\right)\right)\\ \mathbf{elif}\;x-scale \leq 4.2 \cdot 10^{+22}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(\mathsf{hypot}\left(a \cdot \cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right), b \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right) \cdot \sqrt{2}\right) \cdot \left(x-scale \cdot \sqrt{8}\right)\right)\\ \end{array} \]

Alternative 3: 42.0% accurate, 6.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\ t_1 := x-scale \cdot \sqrt{8}\\ \mathbf{if}\;x-scale \leq -3.1 \cdot 10^{+22}:\\ \;\;\;\;0.25 \cdot \left(t_1 \cdot \left(a \cdot \left(\cos t_0 \cdot \left(-\sqrt{2}\right)\right)\right)\right)\\ \mathbf{elif}\;x-scale \leq 16500:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(t_1 \cdot \sqrt{2 \cdot \left({\left(b \cdot \sin t_0\right)}^{2} + {a}^{2}\right)}\right)\\ \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (* 0.005555555555555556 (* angle PI)))
        (t_1 (* x-scale (sqrt 8.0))))
   (if (<= x-scale -3.1e+22)
     (* 0.25 (* t_1 (* a (* (cos t_0) (- (sqrt 2.0))))))
     (if (<= x-scale 16500.0)
       (fabs (* 4.0 (* 0.25 (* y-scale b))))
       (*
        0.25
        (* t_1 (sqrt (* 2.0 (+ (pow (* b (sin t_0)) 2.0) (pow a 2.0))))))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
	double t_1 = x_45_scale * sqrt(8.0);
	double tmp;
	if (x_45_scale <= -3.1e+22) {
		tmp = 0.25 * (t_1 * (a * (cos(t_0) * -sqrt(2.0))));
	} else if (x_45_scale <= 16500.0) {
		tmp = fabs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * (t_1 * sqrt((2.0 * (pow((b * sin(t_0)), 2.0) + pow(a, 2.0)))));
	}
	return tmp;
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = 0.005555555555555556 * (angle * Math.PI);
	double t_1 = x_45_scale * Math.sqrt(8.0);
	double tmp;
	if (x_45_scale <= -3.1e+22) {
		tmp = 0.25 * (t_1 * (a * (Math.cos(t_0) * -Math.sqrt(2.0))));
	} else if (x_45_scale <= 16500.0) {
		tmp = Math.abs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * (t_1 * Math.sqrt((2.0 * (Math.pow((b * Math.sin(t_0)), 2.0) + Math.pow(a, 2.0)))));
	}
	return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale):
	t_0 = 0.005555555555555556 * (angle * math.pi)
	t_1 = x_45_scale * math.sqrt(8.0)
	tmp = 0
	if x_45_scale <= -3.1e+22:
		tmp = 0.25 * (t_1 * (a * (math.cos(t_0) * -math.sqrt(2.0))))
	elif x_45_scale <= 16500.0:
		tmp = math.fabs((4.0 * (0.25 * (y_45_scale * b))))
	else:
		tmp = 0.25 * (t_1 * math.sqrt((2.0 * (math.pow((b * math.sin(t_0)), 2.0) + math.pow(a, 2.0)))))
	return tmp
function code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = Float64(0.005555555555555556 * Float64(angle * pi))
	t_1 = Float64(x_45_scale * sqrt(8.0))
	tmp = 0.0
	if (x_45_scale <= -3.1e+22)
		tmp = Float64(0.25 * Float64(t_1 * Float64(a * Float64(cos(t_0) * Float64(-sqrt(2.0))))));
	elseif (x_45_scale <= 16500.0)
		tmp = abs(Float64(4.0 * Float64(0.25 * Float64(y_45_scale * b))));
	else
		tmp = Float64(0.25 * Float64(t_1 * sqrt(Float64(2.0 * Float64((Float64(b * sin(t_0)) ^ 2.0) + (a ^ 2.0))))));
	end
	return tmp
end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = 0.005555555555555556 * (angle * pi);
	t_1 = x_45_scale * sqrt(8.0);
	tmp = 0.0;
	if (x_45_scale <= -3.1e+22)
		tmp = 0.25 * (t_1 * (a * (cos(t_0) * -sqrt(2.0))));
	elseif (x_45_scale <= 16500.0)
		tmp = abs((4.0 * (0.25 * (y_45_scale * b))));
	else
		tmp = 0.25 * (t_1 * sqrt((2.0 * (((b * sin(t_0)) ^ 2.0) + (a ^ 2.0)))));
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$45$scale * N[Sqrt[8.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$45$scale, -3.1e+22], N[(0.25 * N[(t$95$1 * N[(a * N[(N[Cos[t$95$0], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$45$scale, 16500.0], N[Abs[N[(4.0 * N[(0.25 * N[(y$45$scale * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(0.25 * N[(t$95$1 * N[Sqrt[N[(2.0 * N[(N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
t_1 := x-scale \cdot \sqrt{8}\\
\mathbf{if}\;x-scale \leq -3.1 \cdot 10^{+22}:\\
\;\;\;\;0.25 \cdot \left(t_1 \cdot \left(a \cdot \left(\cos t_0 \cdot \left(-\sqrt{2}\right)\right)\right)\right)\\

\mathbf{elif}\;x-scale \leq 16500:\\
\;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(t_1 \cdot \sqrt{2 \cdot \left({\left(b \cdot \sin t_0\right)}^{2} + {a}^{2}\right)}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x-scale < -3.1000000000000002e22

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 1.0%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified1.0%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Taylor expanded in a around -inf 19.2%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(-1 \cdot \left(a \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt{2}\right)\right)\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    6. Step-by-step derivation
      1. mul-1-neg19.2%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(-a \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt{2}\right)\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      2. *-commutative19.2%

        \[\leadsto 0.25 \cdot \left(\left(-\color{blue}{\left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt{2}\right) \cdot a}\right) \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      3. distribute-rgt-neg-in19.2%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt{2}\right) \cdot \left(-a\right)\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      4. *-commutative19.2%

        \[\leadsto 0.25 \cdot \left(\left(\color{blue}{\left(\sqrt{2} \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)} \cdot \left(-a\right)\right) \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    7. Simplified19.2%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\left(\sqrt{2} \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \left(-a\right)\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]

    if -3.1000000000000002e22 < x-scale < 16500

    1. Initial program 1.1%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified2.9%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in angle around 0 28.1%

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

        \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)}} \]
      2. associate-*r*26.9%

        \[\leadsto e^{\log \left(0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)} \]
      3. sqrt-unprod26.9%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)\right)} \]
      4. metadata-eval26.9%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \sqrt{\color{blue}{16}}\right)\right)} \]
      5. metadata-eval26.9%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)\right)} \]
    5. Applied egg-rr26.9%

      \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
    6. Step-by-step derivation
      1. rem-exp-log28.3%

        \[\leadsto \color{blue}{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \]
      2. add-sqr-sqrt27.7%

        \[\leadsto \color{blue}{\sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \cdot \sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)}} \]
      3. sqrt-unprod38.5%

        \[\leadsto \color{blue}{\sqrt{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right) \cdot \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
      4. pow238.5%

        \[\leadsto \sqrt{\color{blue}{{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}^{2}}} \]
      5. associate-*l*38.5%

        \[\leadsto \sqrt{{\left(0.25 \cdot \color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)}\right)}^{2}} \]
    7. Applied egg-rr38.5%

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

        \[\leadsto \sqrt{\color{blue}{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right) \cdot \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}} \]
      2. rem-sqrt-square45.6%

        \[\leadsto \color{blue}{\left|0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right|} \]
      3. associate-*r*45.6%

        \[\leadsto \left|0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right)}\right| \]
      4. associate-*l*45.6%

        \[\leadsto \left|\color{blue}{\left(0.25 \cdot \left(b \cdot y-scale\right)\right) \cdot 4}\right| \]
      5. *-commutative45.6%

        \[\leadsto \left|\color{blue}{4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)}\right| \]
    9. Simplified45.6%

      \[\leadsto \color{blue}{\left|4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)\right|} \]

    if 16500 < x-scale

    1. Initial program 3.7%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified3.8%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 67.0%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified72.2%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Taylor expanded in angle around 0 72.3%

      \[\leadsto 0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \color{blue}{1}\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification44.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x-scale \leq -3.1 \cdot 10^{+22}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(-\sqrt{2}\right)\right)\right)\right)\\ \mathbf{elif}\;x-scale \leq 16500:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {a}^{2}\right)}\right)\\ \end{array} \]

Alternative 4: 34.1% accurate, 9.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x-scale \leq -2.2 \cdot 10^{+76}:\\ \;\;\;\;0.25 \cdot \left(a \cdot \left(\left(x-scale \cdot \cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right) \cdot \left(\sqrt{2} \cdot \left(-\sqrt{8}\right)\right)\right)\right)\\ \mathbf{elif}\;x-scale \leq 2.2 \cdot 10^{+20}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \sqrt{2}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (if (<= x-scale -2.2e+76)
   (*
    0.25
    (*
     a
     (*
      (* x-scale (cos (* PI (* 0.005555555555555556 angle))))
      (* (sqrt 2.0) (- (sqrt 8.0))))))
   (if (<= x-scale 2.2e+20)
     (fabs (* 4.0 (* 0.25 (* y-scale b))))
     (* 0.25 (* (* x-scale (sqrt 8.0)) (* a (sqrt 2.0)))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (x_45_scale <= -2.2e+76) {
		tmp = 0.25 * (a * ((x_45_scale * cos((((double) M_PI) * (0.005555555555555556 * angle)))) * (sqrt(2.0) * -sqrt(8.0))));
	} else if (x_45_scale <= 2.2e+20) {
		tmp = fabs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * ((x_45_scale * sqrt(8.0)) * (a * sqrt(2.0)));
	}
	return tmp;
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (x_45_scale <= -2.2e+76) {
		tmp = 0.25 * (a * ((x_45_scale * Math.cos((Math.PI * (0.005555555555555556 * angle)))) * (Math.sqrt(2.0) * -Math.sqrt(8.0))));
	} else if (x_45_scale <= 2.2e+20) {
		tmp = Math.abs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * ((x_45_scale * Math.sqrt(8.0)) * (a * Math.sqrt(2.0)));
	}
	return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale):
	tmp = 0
	if x_45_scale <= -2.2e+76:
		tmp = 0.25 * (a * ((x_45_scale * math.cos((math.pi * (0.005555555555555556 * angle)))) * (math.sqrt(2.0) * -math.sqrt(8.0))))
	elif x_45_scale <= 2.2e+20:
		tmp = math.fabs((4.0 * (0.25 * (y_45_scale * b))))
	else:
		tmp = 0.25 * ((x_45_scale * math.sqrt(8.0)) * (a * math.sqrt(2.0)))
	return tmp
function code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.0
	if (x_45_scale <= -2.2e+76)
		tmp = Float64(0.25 * Float64(a * Float64(Float64(x_45_scale * cos(Float64(pi * Float64(0.005555555555555556 * angle)))) * Float64(sqrt(2.0) * Float64(-sqrt(8.0))))));
	elseif (x_45_scale <= 2.2e+20)
		tmp = abs(Float64(4.0 * Float64(0.25 * Float64(y_45_scale * b))));
	else
		tmp = Float64(0.25 * Float64(Float64(x_45_scale * sqrt(8.0)) * Float64(a * sqrt(2.0))));
	end
	return tmp
end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.0;
	if (x_45_scale <= -2.2e+76)
		tmp = 0.25 * (a * ((x_45_scale * cos((pi * (0.005555555555555556 * angle)))) * (sqrt(2.0) * -sqrt(8.0))));
	elseif (x_45_scale <= 2.2e+20)
		tmp = abs((4.0 * (0.25 * (y_45_scale * b))));
	else
		tmp = 0.25 * ((x_45_scale * sqrt(8.0)) * (a * sqrt(2.0)));
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[x$45$scale, -2.2e+76], N[(0.25 * N[(a * N[(N[(x$45$scale * N[Cos[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[8.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$45$scale, 2.2e+20], N[Abs[N[(4.0 * N[(0.25 * N[(y$45$scale * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(0.25 * N[(N[(x$45$scale * N[Sqrt[8.0], $MachinePrecision]), $MachinePrecision] * N[(a * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x-scale \leq -2.2 \cdot 10^{+76}:\\
\;\;\;\;0.25 \cdot \left(a \cdot \left(\left(x-scale \cdot \cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right) \cdot \left(\sqrt{2} \cdot \left(-\sqrt{8}\right)\right)\right)\right)\\

\mathbf{elif}\;x-scale \leq 2.2 \cdot 10^{+20}:\\
\;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \sqrt{2}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x-scale < -2.2e76

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 1.0%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified1.0%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Taylor expanded in a around -inf 22.8%

      \[\leadsto 0.25 \cdot \color{blue}{\left(-1 \cdot \left(a \cdot \left(x-scale \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg22.8%

        \[\leadsto 0.25 \cdot \color{blue}{\left(-a \cdot \left(x-scale \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)} \]
      2. associate-*r*22.8%

        \[\leadsto 0.25 \cdot \left(-a \cdot \color{blue}{\left(\left(x-scale \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right) \]
      3. *-commutative22.8%

        \[\leadsto 0.25 \cdot \left(-a \cdot \left(\color{blue}{\left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot x-scale\right)} \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right) \]
      4. associate-*r*24.4%

        \[\leadsto 0.25 \cdot \left(-a \cdot \left(\left(\cos \color{blue}{\left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)} \cdot x-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right) \]
      5. *-commutative24.4%

        \[\leadsto 0.25 \cdot \left(-a \cdot \left(\left(\cos \color{blue}{\left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)} \cdot x-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right) \]
    7. Simplified24.4%

      \[\leadsto 0.25 \cdot \color{blue}{\left(-a \cdot \left(\left(\cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot x-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]

    if -2.2e76 < x-scale < 2.2e20

    1. Initial program 1.0%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified2.5%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in angle around 0 27.0%

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

        \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)}} \]
      2. associate-*r*25.9%

        \[\leadsto e^{\log \left(0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)} \]
      3. sqrt-unprod25.9%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)\right)} \]
      4. metadata-eval25.9%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \sqrt{\color{blue}{16}}\right)\right)} \]
      5. metadata-eval25.9%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)\right)} \]
    5. Applied egg-rr25.9%

      \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
    6. Step-by-step derivation
      1. rem-exp-log27.2%

        \[\leadsto \color{blue}{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \]
      2. add-sqr-sqrt26.6%

        \[\leadsto \color{blue}{\sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \cdot \sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)}} \]
      3. sqrt-unprod36.7%

        \[\leadsto \color{blue}{\sqrt{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right) \cdot \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
      4. pow236.7%

        \[\leadsto \sqrt{\color{blue}{{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}^{2}}} \]
      5. associate-*l*36.7%

        \[\leadsto \sqrt{{\left(0.25 \cdot \color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)}\right)}^{2}} \]
    7. Applied egg-rr36.7%

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

        \[\leadsto \sqrt{\color{blue}{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right) \cdot \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}} \]
      2. rem-sqrt-square44.3%

        \[\leadsto \color{blue}{\left|0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right|} \]
      3. associate-*r*44.3%

        \[\leadsto \left|0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right)}\right| \]
      4. associate-*l*44.3%

        \[\leadsto \left|\color{blue}{\left(0.25 \cdot \left(b \cdot y-scale\right)\right) \cdot 4}\right| \]
      5. *-commutative44.3%

        \[\leadsto \left|\color{blue}{4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)}\right| \]
    9. Simplified44.3%

      \[\leadsto \color{blue}{\left|4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)\right|} \]

    if 2.2e20 < x-scale

    1. Initial program 3.8%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified3.9%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 66.9%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified72.4%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Taylor expanded in angle around 0 28.3%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(a \cdot \sqrt{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    6. Step-by-step derivation
      1. *-commutative28.3%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\sqrt{2} \cdot a\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    7. Simplified28.3%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\sqrt{2} \cdot a\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification36.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x-scale \leq -2.2 \cdot 10^{+76}:\\ \;\;\;\;0.25 \cdot \left(a \cdot \left(\left(x-scale \cdot \cos \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right) \cdot \left(\sqrt{2} \cdot \left(-\sqrt{8}\right)\right)\right)\right)\\ \mathbf{elif}\;x-scale \leq 2.2 \cdot 10^{+20}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \sqrt{2}\right)\right)\\ \end{array} \]

Alternative 5: 33.7% accurate, 9.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x-scale \leq -6.5 \cdot 10^{+23}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot a\right) \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\sqrt{2} \cdot \left(-\sqrt{8}\right)\right)\right)\right)\\ \mathbf{elif}\;x-scale \leq 3.2 \cdot 10^{+25}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \sqrt{2}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (if (<= x-scale -6.5e+23)
   (*
    0.25
    (*
     (* x-scale a)
     (*
      (cos (* 0.005555555555555556 (* angle PI)))
      (* (sqrt 2.0) (- (sqrt 8.0))))))
   (if (<= x-scale 3.2e+25)
     (fabs (* 4.0 (* 0.25 (* y-scale b))))
     (* 0.25 (* (* x-scale (sqrt 8.0)) (* a (sqrt 2.0)))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (x_45_scale <= -6.5e+23) {
		tmp = 0.25 * ((x_45_scale * a) * (cos((0.005555555555555556 * (angle * ((double) M_PI)))) * (sqrt(2.0) * -sqrt(8.0))));
	} else if (x_45_scale <= 3.2e+25) {
		tmp = fabs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * ((x_45_scale * sqrt(8.0)) * (a * sqrt(2.0)));
	}
	return tmp;
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (x_45_scale <= -6.5e+23) {
		tmp = 0.25 * ((x_45_scale * a) * (Math.cos((0.005555555555555556 * (angle * Math.PI))) * (Math.sqrt(2.0) * -Math.sqrt(8.0))));
	} else if (x_45_scale <= 3.2e+25) {
		tmp = Math.abs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * ((x_45_scale * Math.sqrt(8.0)) * (a * Math.sqrt(2.0)));
	}
	return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale):
	tmp = 0
	if x_45_scale <= -6.5e+23:
		tmp = 0.25 * ((x_45_scale * a) * (math.cos((0.005555555555555556 * (angle * math.pi))) * (math.sqrt(2.0) * -math.sqrt(8.0))))
	elif x_45_scale <= 3.2e+25:
		tmp = math.fabs((4.0 * (0.25 * (y_45_scale * b))))
	else:
		tmp = 0.25 * ((x_45_scale * math.sqrt(8.0)) * (a * math.sqrt(2.0)))
	return tmp
function code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.0
	if (x_45_scale <= -6.5e+23)
		tmp = Float64(0.25 * Float64(Float64(x_45_scale * a) * Float64(cos(Float64(0.005555555555555556 * Float64(angle * pi))) * Float64(sqrt(2.0) * Float64(-sqrt(8.0))))));
	elseif (x_45_scale <= 3.2e+25)
		tmp = abs(Float64(4.0 * Float64(0.25 * Float64(y_45_scale * b))));
	else
		tmp = Float64(0.25 * Float64(Float64(x_45_scale * sqrt(8.0)) * Float64(a * sqrt(2.0))));
	end
	return tmp
end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.0;
	if (x_45_scale <= -6.5e+23)
		tmp = 0.25 * ((x_45_scale * a) * (cos((0.005555555555555556 * (angle * pi))) * (sqrt(2.0) * -sqrt(8.0))));
	elseif (x_45_scale <= 3.2e+25)
		tmp = abs((4.0 * (0.25 * (y_45_scale * b))));
	else
		tmp = 0.25 * ((x_45_scale * sqrt(8.0)) * (a * sqrt(2.0)));
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[x$45$scale, -6.5e+23], N[(0.25 * N[(N[(x$45$scale * a), $MachinePrecision] * N[(N[Cos[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[8.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$45$scale, 3.2e+25], N[Abs[N[(4.0 * N[(0.25 * N[(y$45$scale * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(0.25 * N[(N[(x$45$scale * N[Sqrt[8.0], $MachinePrecision]), $MachinePrecision] * N[(a * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x-scale \leq -6.5 \cdot 10^{+23}:\\
\;\;\;\;0.25 \cdot \left(\left(x-scale \cdot a\right) \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\sqrt{2} \cdot \left(-\sqrt{8}\right)\right)\right)\right)\\

\mathbf{elif}\;x-scale \leq 3.2 \cdot 10^{+25}:\\
\;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \sqrt{2}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x-scale < -6.4999999999999996e23

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 1.0%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified1.0%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Taylor expanded in a around -inf 19.1%

      \[\leadsto 0.25 \cdot \color{blue}{\left(-1 \cdot \left(a \cdot \left(x-scale \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg19.1%

        \[\leadsto 0.25 \cdot \color{blue}{\left(-a \cdot \left(x-scale \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)} \]
      2. associate-*r*19.1%

        \[\leadsto 0.25 \cdot \left(-\color{blue}{\left(a \cdot x-scale\right) \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right) \]
      3. distribute-lft-neg-in19.1%

        \[\leadsto 0.25 \cdot \color{blue}{\left(\left(-a \cdot x-scale\right) \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
    7. Simplified19.1%

      \[\leadsto 0.25 \cdot \color{blue}{\left(\left(-a \cdot x-scale\right) \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]

    if -6.4999999999999996e23 < x-scale < 3.1999999999999999e25

    1. Initial program 1.1%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified2.8%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in angle around 0 28.3%

      \[\leadsto \color{blue}{0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. add-exp-log27.1%

        \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)}} \]
      2. associate-*r*27.1%

        \[\leadsto e^{\log \left(0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)} \]
      3. sqrt-unprod27.1%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)\right)} \]
      4. metadata-eval27.1%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \sqrt{\color{blue}{16}}\right)\right)} \]
      5. metadata-eval27.1%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)\right)} \]
    5. Applied egg-rr27.1%

      \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
    6. Step-by-step derivation
      1. rem-exp-log28.4%

        \[\leadsto \color{blue}{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \]
      2. add-sqr-sqrt27.8%

        \[\leadsto \color{blue}{\sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \cdot \sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)}} \]
      3. sqrt-unprod39.3%

        \[\leadsto \color{blue}{\sqrt{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right) \cdot \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
      4. pow239.3%

        \[\leadsto \sqrt{\color{blue}{{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}^{2}}} \]
      5. associate-*l*39.3%

        \[\leadsto \sqrt{{\left(0.25 \cdot \color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)}\right)}^{2}} \]
    7. Applied egg-rr39.3%

      \[\leadsto \color{blue}{\sqrt{{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}^{2}}} \]
    8. Step-by-step derivation
      1. unpow239.3%

        \[\leadsto \sqrt{\color{blue}{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right) \cdot \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}} \]
      2. rem-sqrt-square46.1%

        \[\leadsto \color{blue}{\left|0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right|} \]
      3. associate-*r*46.1%

        \[\leadsto \left|0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right)}\right| \]
      4. associate-*l*46.1%

        \[\leadsto \left|\color{blue}{\left(0.25 \cdot \left(b \cdot y-scale\right)\right) \cdot 4}\right| \]
      5. *-commutative46.1%

        \[\leadsto \left|\color{blue}{4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)}\right| \]
    9. Simplified46.1%

      \[\leadsto \color{blue}{\left|4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)\right|} \]

    if 3.1999999999999999e25 < x-scale

    1. Initial program 3.8%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified3.9%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 66.9%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified72.4%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Taylor expanded in angle around 0 28.3%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(a \cdot \sqrt{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    6. Step-by-step derivation
      1. *-commutative28.3%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\sqrt{2} \cdot a\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    7. Simplified28.3%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\sqrt{2} \cdot a\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification34.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x-scale \leq -6.5 \cdot 10^{+23}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot a\right) \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\sqrt{2} \cdot \left(-\sqrt{8}\right)\right)\right)\right)\\ \mathbf{elif}\;x-scale \leq 3.2 \cdot 10^{+25}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \sqrt{2}\right)\right)\\ \end{array} \]

Alternative 6: 33.6% accurate, 9.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x-scale \cdot \sqrt{8}\\ \mathbf{if}\;x-scale \leq -3 \cdot 10^{+22}:\\ \;\;\;\;0.25 \cdot \left(t_0 \cdot \left(a \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(-\sqrt{2}\right)\right)\right)\right)\\ \mathbf{elif}\;x-scale \leq 3.2 \cdot 10^{+20}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(t_0 \cdot \left(a \cdot \sqrt{2}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (* x-scale (sqrt 8.0))))
   (if (<= x-scale -3e+22)
     (*
      0.25
      (*
       t_0
       (* a (* (cos (* 0.005555555555555556 (* angle PI))) (- (sqrt 2.0))))))
     (if (<= x-scale 3.2e+20)
       (fabs (* 4.0 (* 0.25 (* y-scale b))))
       (* 0.25 (* t_0 (* a (sqrt 2.0))))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = x_45_scale * sqrt(8.0);
	double tmp;
	if (x_45_scale <= -3e+22) {
		tmp = 0.25 * (t_0 * (a * (cos((0.005555555555555556 * (angle * ((double) M_PI)))) * -sqrt(2.0))));
	} else if (x_45_scale <= 3.2e+20) {
		tmp = fabs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * (t_0 * (a * sqrt(2.0)));
	}
	return tmp;
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = x_45_scale * Math.sqrt(8.0);
	double tmp;
	if (x_45_scale <= -3e+22) {
		tmp = 0.25 * (t_0 * (a * (Math.cos((0.005555555555555556 * (angle * Math.PI))) * -Math.sqrt(2.0))));
	} else if (x_45_scale <= 3.2e+20) {
		tmp = Math.abs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * (t_0 * (a * Math.sqrt(2.0)));
	}
	return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale):
	t_0 = x_45_scale * math.sqrt(8.0)
	tmp = 0
	if x_45_scale <= -3e+22:
		tmp = 0.25 * (t_0 * (a * (math.cos((0.005555555555555556 * (angle * math.pi))) * -math.sqrt(2.0))))
	elif x_45_scale <= 3.2e+20:
		tmp = math.fabs((4.0 * (0.25 * (y_45_scale * b))))
	else:
		tmp = 0.25 * (t_0 * (a * math.sqrt(2.0)))
	return tmp
function code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = Float64(x_45_scale * sqrt(8.0))
	tmp = 0.0
	if (x_45_scale <= -3e+22)
		tmp = Float64(0.25 * Float64(t_0 * Float64(a * Float64(cos(Float64(0.005555555555555556 * Float64(angle * pi))) * Float64(-sqrt(2.0))))));
	elseif (x_45_scale <= 3.2e+20)
		tmp = abs(Float64(4.0 * Float64(0.25 * Float64(y_45_scale * b))));
	else
		tmp = Float64(0.25 * Float64(t_0 * Float64(a * sqrt(2.0))));
	end
	return tmp
end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = x_45_scale * sqrt(8.0);
	tmp = 0.0;
	if (x_45_scale <= -3e+22)
		tmp = 0.25 * (t_0 * (a * (cos((0.005555555555555556 * (angle * pi))) * -sqrt(2.0))));
	elseif (x_45_scale <= 3.2e+20)
		tmp = abs((4.0 * (0.25 * (y_45_scale * b))));
	else
		tmp = 0.25 * (t_0 * (a * sqrt(2.0)));
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(x$45$scale * N[Sqrt[8.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$45$scale, -3e+22], N[(0.25 * N[(t$95$0 * N[(a * N[(N[Cos[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$45$scale, 3.2e+20], N[Abs[N[(4.0 * N[(0.25 * N[(y$45$scale * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(0.25 * N[(t$95$0 * N[(a * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x-scale \cdot \sqrt{8}\\
\mathbf{if}\;x-scale \leq -3 \cdot 10^{+22}:\\
\;\;\;\;0.25 \cdot \left(t_0 \cdot \left(a \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(-\sqrt{2}\right)\right)\right)\right)\\

\mathbf{elif}\;x-scale \leq 3.2 \cdot 10^{+20}:\\
\;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(t_0 \cdot \left(a \cdot \sqrt{2}\right)\right)\\


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

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 1.0%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified1.0%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Taylor expanded in a around -inf 19.2%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(-1 \cdot \left(a \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt{2}\right)\right)\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    6. Step-by-step derivation
      1. mul-1-neg19.2%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(-a \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt{2}\right)\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      2. *-commutative19.2%

        \[\leadsto 0.25 \cdot \left(\left(-\color{blue}{\left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt{2}\right) \cdot a}\right) \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      3. distribute-rgt-neg-in19.2%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \sqrt{2}\right) \cdot \left(-a\right)\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
      4. *-commutative19.2%

        \[\leadsto 0.25 \cdot \left(\left(\color{blue}{\left(\sqrt{2} \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)} \cdot \left(-a\right)\right) \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    7. Simplified19.2%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\left(\sqrt{2} \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right) \cdot \left(-a\right)\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]

    if -3e22 < x-scale < 3.2e20

    1. Initial program 1.1%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified2.8%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in angle around 0 28.3%

      \[\leadsto \color{blue}{0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. add-exp-log27.1%

        \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)}} \]
      2. associate-*r*27.1%

        \[\leadsto e^{\log \left(0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)} \]
      3. sqrt-unprod27.1%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)\right)} \]
      4. metadata-eval27.1%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \sqrt{\color{blue}{16}}\right)\right)} \]
      5. metadata-eval27.1%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)\right)} \]
    5. Applied egg-rr27.1%

      \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
    6. Step-by-step derivation
      1. rem-exp-log28.4%

        \[\leadsto \color{blue}{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \]
      2. add-sqr-sqrt27.8%

        \[\leadsto \color{blue}{\sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \cdot \sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)}} \]
      3. sqrt-unprod39.3%

        \[\leadsto \color{blue}{\sqrt{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right) \cdot \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
      4. pow239.3%

        \[\leadsto \sqrt{\color{blue}{{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}^{2}}} \]
      5. associate-*l*39.3%

        \[\leadsto \sqrt{{\left(0.25 \cdot \color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)}\right)}^{2}} \]
    7. Applied egg-rr39.3%

      \[\leadsto \color{blue}{\sqrt{{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}^{2}}} \]
    8. Step-by-step derivation
      1. unpow239.3%

        \[\leadsto \sqrt{\color{blue}{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right) \cdot \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}} \]
      2. rem-sqrt-square46.1%

        \[\leadsto \color{blue}{\left|0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right|} \]
      3. associate-*r*46.1%

        \[\leadsto \left|0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right)}\right| \]
      4. associate-*l*46.1%

        \[\leadsto \left|\color{blue}{\left(0.25 \cdot \left(b \cdot y-scale\right)\right) \cdot 4}\right| \]
      5. *-commutative46.1%

        \[\leadsto \left|\color{blue}{4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)}\right| \]
    9. Simplified46.1%

      \[\leadsto \color{blue}{\left|4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)\right|} \]

    if 3.2e20 < x-scale

    1. Initial program 3.8%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified3.9%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 66.9%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified72.4%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Taylor expanded in angle around 0 28.3%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(a \cdot \sqrt{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    6. Step-by-step derivation
      1. *-commutative28.3%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\sqrt{2} \cdot a\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    7. Simplified28.3%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\sqrt{2} \cdot a\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification34.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x-scale \leq -3 \cdot 10^{+22}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \left(\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(-\sqrt{2}\right)\right)\right)\right)\\ \mathbf{elif}\;x-scale \leq 3.2 \cdot 10^{+20}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \sqrt{2}\right)\right)\\ \end{array} \]

Alternative 7: 34.2% accurate, 9.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x-scale \leq -3.3 \cdot 10^{+181}:\\ \;\;\;\;0.25 \cdot \left(\left(4 \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right) \cdot \left(\log \left(e^{x-scale}\right) \cdot \left(-b\right)\right)\right)\\ \mathbf{elif}\;x-scale \leq 8.5 \cdot 10^{+21}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \sqrt{2}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (if (<= x-scale -3.3e+181)
   (*
    0.25
    (*
     (* 4.0 (sin (* PI (* 0.005555555555555556 angle))))
     (* (log (exp x-scale)) (- b))))
   (if (<= x-scale 8.5e+21)
     (fabs (* 4.0 (* 0.25 (* y-scale b))))
     (* 0.25 (* (* x-scale (sqrt 8.0)) (* a (sqrt 2.0)))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (x_45_scale <= -3.3e+181) {
		tmp = 0.25 * ((4.0 * sin((((double) M_PI) * (0.005555555555555556 * angle)))) * (log(exp(x_45_scale)) * -b));
	} else if (x_45_scale <= 8.5e+21) {
		tmp = fabs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * ((x_45_scale * sqrt(8.0)) * (a * sqrt(2.0)));
	}
	return tmp;
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (x_45_scale <= -3.3e+181) {
		tmp = 0.25 * ((4.0 * Math.sin((Math.PI * (0.005555555555555556 * angle)))) * (Math.log(Math.exp(x_45_scale)) * -b));
	} else if (x_45_scale <= 8.5e+21) {
		tmp = Math.abs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * ((x_45_scale * Math.sqrt(8.0)) * (a * Math.sqrt(2.0)));
	}
	return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale):
	tmp = 0
	if x_45_scale <= -3.3e+181:
		tmp = 0.25 * ((4.0 * math.sin((math.pi * (0.005555555555555556 * angle)))) * (math.log(math.exp(x_45_scale)) * -b))
	elif x_45_scale <= 8.5e+21:
		tmp = math.fabs((4.0 * (0.25 * (y_45_scale * b))))
	else:
		tmp = 0.25 * ((x_45_scale * math.sqrt(8.0)) * (a * math.sqrt(2.0)))
	return tmp
function code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.0
	if (x_45_scale <= -3.3e+181)
		tmp = Float64(0.25 * Float64(Float64(4.0 * sin(Float64(pi * Float64(0.005555555555555556 * angle)))) * Float64(log(exp(x_45_scale)) * Float64(-b))));
	elseif (x_45_scale <= 8.5e+21)
		tmp = abs(Float64(4.0 * Float64(0.25 * Float64(y_45_scale * b))));
	else
		tmp = Float64(0.25 * Float64(Float64(x_45_scale * sqrt(8.0)) * Float64(a * sqrt(2.0))));
	end
	return tmp
end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.0;
	if (x_45_scale <= -3.3e+181)
		tmp = 0.25 * ((4.0 * sin((pi * (0.005555555555555556 * angle)))) * (log(exp(x_45_scale)) * -b));
	elseif (x_45_scale <= 8.5e+21)
		tmp = abs((4.0 * (0.25 * (y_45_scale * b))));
	else
		tmp = 0.25 * ((x_45_scale * sqrt(8.0)) * (a * sqrt(2.0)));
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[x$45$scale, -3.3e+181], N[(0.25 * N[(N[(4.0 * N[Sin[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Log[N[Exp[x$45$scale], $MachinePrecision]], $MachinePrecision] * (-b)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$45$scale, 8.5e+21], N[Abs[N[(4.0 * N[(0.25 * N[(y$45$scale * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(0.25 * N[(N[(x$45$scale * N[Sqrt[8.0], $MachinePrecision]), $MachinePrecision] * N[(a * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x-scale \leq -3.3 \cdot 10^{+181}:\\
\;\;\;\;0.25 \cdot \left(\left(4 \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right) \cdot \left(\log \left(e^{x-scale}\right) \cdot \left(-b\right)\right)\right)\\

\mathbf{elif}\;x-scale \leq 8.5 \cdot 10^{+21}:\\
\;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \sqrt{2}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x-scale < -3.30000000000000017e181

    1. Initial program 0.0%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified0.3%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 0.8%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified0.7%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Taylor expanded in b around -inf 12.9%

      \[\leadsto 0.25 \cdot \color{blue}{\left(-1 \cdot \left(b \cdot \left(x-scale \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg12.9%

        \[\leadsto 0.25 \cdot \color{blue}{\left(-b \cdot \left(x-scale \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)} \]
      2. associate-*r*9.7%

        \[\leadsto 0.25 \cdot \left(-\color{blue}{\left(b \cdot x-scale\right) \cdot \left(\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right) \]
      3. associate-*r*9.9%

        \[\leadsto 0.25 \cdot \left(-\left(b \cdot x-scale\right) \cdot \left(\sin \color{blue}{\left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right)} \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right) \]
      4. *-commutative9.9%

        \[\leadsto 0.25 \cdot \left(-\left(b \cdot x-scale\right) \cdot \left(\sin \color{blue}{\left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)} \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right) \]
    7. Simplified9.9%

      \[\leadsto 0.25 \cdot \color{blue}{\left(-\left(b \cdot x-scale\right) \cdot \left(\sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
    8. Step-by-step derivation
      1. add-log-exp15.4%

        \[\leadsto 0.25 \cdot \left(-\color{blue}{\log \left(e^{\left(b \cdot x-scale\right) \cdot \left(\sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)}\right) \]
      2. exp-prod15.3%

        \[\leadsto 0.25 \cdot \left(-\log \color{blue}{\left({\left(e^{b \cdot x-scale}\right)}^{\left(\sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)}\right) \]
      3. *-commutative15.3%

        \[\leadsto 0.25 \cdot \left(-\log \left({\left(e^{\color{blue}{x-scale \cdot b}}\right)}^{\left(\sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)\right) \]
      4. exp-prod15.4%

        \[\leadsto 0.25 \cdot \left(-\log \left({\color{blue}{\left({\left(e^{x-scale}\right)}^{b}\right)}}^{\left(\sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)\right) \]
      5. associate-*r*22.4%

        \[\leadsto 0.25 \cdot \left(-\log \left({\left({\left(e^{x-scale}\right)}^{b}\right)}^{\left(\sin \color{blue}{\left(\left(\pi \cdot 0.005555555555555556\right) \cdot angle\right)} \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)\right) \]
      6. sqrt-unprod22.4%

        \[\leadsto 0.25 \cdot \left(-\log \left({\left({\left(e^{x-scale}\right)}^{b}\right)}^{\left(\sin \left(\left(\pi \cdot 0.005555555555555556\right) \cdot angle\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)}\right)\right) \]
      7. metadata-eval22.4%

        \[\leadsto 0.25 \cdot \left(-\log \left({\left({\left(e^{x-scale}\right)}^{b}\right)}^{\left(\sin \left(\left(\pi \cdot 0.005555555555555556\right) \cdot angle\right) \cdot \sqrt{\color{blue}{16}}\right)}\right)\right) \]
      8. metadata-eval22.4%

        \[\leadsto 0.25 \cdot \left(-\log \left({\left({\left(e^{x-scale}\right)}^{b}\right)}^{\left(\sin \left(\left(\pi \cdot 0.005555555555555556\right) \cdot angle\right) \cdot \color{blue}{4}\right)}\right)\right) \]
    9. Applied egg-rr22.4%

      \[\leadsto 0.25 \cdot \left(-\color{blue}{\log \left({\left({\left(e^{x-scale}\right)}^{b}\right)}^{\left(\sin \left(\left(\pi \cdot 0.005555555555555556\right) \cdot angle\right) \cdot 4\right)}\right)}\right) \]
    10. Step-by-step derivation
      1. log-pow22.4%

        \[\leadsto 0.25 \cdot \left(-\color{blue}{\left(\sin \left(\left(\pi \cdot 0.005555555555555556\right) \cdot angle\right) \cdot 4\right) \cdot \log \left({\left(e^{x-scale}\right)}^{b}\right)}\right) \]
      2. *-commutative22.4%

        \[\leadsto 0.25 \cdot \left(-\color{blue}{\left(4 \cdot \sin \left(\left(\pi \cdot 0.005555555555555556\right) \cdot angle\right)\right)} \cdot \log \left({\left(e^{x-scale}\right)}^{b}\right)\right) \]
      3. associate-*l*15.4%

        \[\leadsto 0.25 \cdot \left(-\left(4 \cdot \sin \color{blue}{\left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)}\right) \cdot \log \left({\left(e^{x-scale}\right)}^{b}\right)\right) \]
      4. log-pow15.4%

        \[\leadsto 0.25 \cdot \left(-\left(4 \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right) \cdot \color{blue}{\left(b \cdot \log \left(e^{x-scale}\right)\right)}\right) \]
    11. Simplified15.4%

      \[\leadsto 0.25 \cdot \left(-\color{blue}{\left(4 \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right) \cdot \left(b \cdot \log \left(e^{x-scale}\right)\right)}\right) \]

    if -3.30000000000000017e181 < x-scale < 8.5e21

    1. Initial program 0.8%

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

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in angle around 0 25.4%

      \[\leadsto \color{blue}{0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. add-exp-log24.3%

        \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)}} \]
      2. associate-*r*24.3%

        \[\leadsto e^{\log \left(0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)} \]
      3. sqrt-unprod24.3%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)\right)} \]
      4. metadata-eval24.3%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \sqrt{\color{blue}{16}}\right)\right)} \]
      5. metadata-eval24.3%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)\right)} \]
    5. Applied egg-rr24.3%

      \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
    6. Step-by-step derivation
      1. rem-exp-log25.6%

        \[\leadsto \color{blue}{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \]
      2. add-sqr-sqrt25.0%

        \[\leadsto \color{blue}{\sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \cdot \sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)}} \]
      3. sqrt-unprod35.4%

        \[\leadsto \color{blue}{\sqrt{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right) \cdot \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
      4. pow235.4%

        \[\leadsto \sqrt{\color{blue}{{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}^{2}}} \]
      5. associate-*l*35.4%

        \[\leadsto \sqrt{{\left(0.25 \cdot \color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)}\right)}^{2}} \]
    7. Applied egg-rr35.4%

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

        \[\leadsto \sqrt{\color{blue}{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right) \cdot \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}} \]
      2. rem-sqrt-square41.6%

        \[\leadsto \color{blue}{\left|0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right|} \]
      3. associate-*r*41.6%

        \[\leadsto \left|0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right)}\right| \]
      4. associate-*l*41.6%

        \[\leadsto \left|\color{blue}{\left(0.25 \cdot \left(b \cdot y-scale\right)\right) \cdot 4}\right| \]
      5. *-commutative41.6%

        \[\leadsto \left|\color{blue}{4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)}\right| \]
    9. Simplified41.6%

      \[\leadsto \color{blue}{\left|4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)\right|} \]

    if 8.5e21 < x-scale

    1. Initial program 3.8%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified3.9%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 66.9%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified72.4%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Taylor expanded in angle around 0 28.3%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(a \cdot \sqrt{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    6. Step-by-step derivation
      1. *-commutative28.3%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\sqrt{2} \cdot a\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    7. Simplified28.3%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\sqrt{2} \cdot a\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification35.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x-scale \leq -3.3 \cdot 10^{+181}:\\ \;\;\;\;0.25 \cdot \left(\left(4 \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right) \cdot \left(\log \left(e^{x-scale}\right) \cdot \left(-b\right)\right)\right)\\ \mathbf{elif}\;x-scale \leq 8.5 \cdot 10^{+21}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \sqrt{2}\right)\right)\\ \end{array} \]

Alternative 8: 33.1% accurate, 17.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x-scale \leq 2.75 \cdot 10^{+20}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(a \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2}\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (if (<= x-scale 2.75e+20)
   (fabs (* 4.0 (* 0.25 (* y-scale b))))
   (* 0.25 (* a (* x-scale (* (sqrt 8.0) (sqrt 2.0)))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (x_45_scale <= 2.75e+20) {
		tmp = fabs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * (a * (x_45_scale * (sqrt(8.0) * sqrt(2.0))));
	}
	return tmp;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle
    real(8), intent (in) :: x_45scale
    real(8), intent (in) :: y_45scale
    real(8) :: tmp
    if (x_45scale <= 2.75d+20) then
        tmp = abs((4.0d0 * (0.25d0 * (y_45scale * b))))
    else
        tmp = 0.25d0 * (a * (x_45scale * (sqrt(8.0d0) * sqrt(2.0d0))))
    end if
    code = tmp
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (x_45_scale <= 2.75e+20) {
		tmp = Math.abs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * (a * (x_45_scale * (Math.sqrt(8.0) * Math.sqrt(2.0))));
	}
	return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale):
	tmp = 0
	if x_45_scale <= 2.75e+20:
		tmp = math.fabs((4.0 * (0.25 * (y_45_scale * b))))
	else:
		tmp = 0.25 * (a * (x_45_scale * (math.sqrt(8.0) * math.sqrt(2.0))))
	return tmp
function code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.0
	if (x_45_scale <= 2.75e+20)
		tmp = abs(Float64(4.0 * Float64(0.25 * Float64(y_45_scale * b))));
	else
		tmp = Float64(0.25 * Float64(a * Float64(x_45_scale * Float64(sqrt(8.0) * sqrt(2.0)))));
	end
	return tmp
end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.0;
	if (x_45_scale <= 2.75e+20)
		tmp = abs((4.0 * (0.25 * (y_45_scale * b))));
	else
		tmp = 0.25 * (a * (x_45_scale * (sqrt(8.0) * sqrt(2.0))));
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[x$45$scale, 2.75e+20], N[Abs[N[(4.0 * N[(0.25 * N[(y$45$scale * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(0.25 * N[(a * N[(x$45$scale * N[(N[Sqrt[8.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x-scale \leq 2.75 \cdot 10^{+20}:\\
\;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(a \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2}\right)\right)\right)\\


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

    1. Initial program 0.7%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified1.9%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in angle around 0 22.0%

      \[\leadsto \color{blue}{0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. add-exp-log21.0%

        \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)}} \]
      2. associate-*r*21.0%

        \[\leadsto e^{\log \left(0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)} \]
      3. sqrt-unprod21.0%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)\right)} \]
      4. metadata-eval21.0%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \sqrt{\color{blue}{16}}\right)\right)} \]
      5. metadata-eval21.0%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)\right)} \]
    5. Applied egg-rr21.0%

      \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
    6. Step-by-step derivation
      1. rem-exp-log22.2%

        \[\leadsto \color{blue}{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \]
      2. add-sqr-sqrt21.6%

        \[\leadsto \color{blue}{\sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \cdot \sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)}} \]
      3. sqrt-unprod32.7%

        \[\leadsto \color{blue}{\sqrt{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right) \cdot \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
      4. pow232.7%

        \[\leadsto \sqrt{\color{blue}{{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}^{2}}} \]
      5. associate-*l*32.7%

        \[\leadsto \sqrt{{\left(0.25 \cdot \color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)}\right)}^{2}} \]
    7. Applied egg-rr32.7%

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

        \[\leadsto \sqrt{\color{blue}{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right) \cdot \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}} \]
      2. rem-sqrt-square37.6%

        \[\leadsto \color{blue}{\left|0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right|} \]
      3. associate-*r*37.6%

        \[\leadsto \left|0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right)}\right| \]
      4. associate-*l*37.6%

        \[\leadsto \left|\color{blue}{\left(0.25 \cdot \left(b \cdot y-scale\right)\right) \cdot 4}\right| \]
      5. *-commutative37.6%

        \[\leadsto \left|\color{blue}{4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)}\right| \]
    9. Simplified37.6%

      \[\leadsto \color{blue}{\left|4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)\right|} \]

    if 2.75e20 < x-scale

    1. Initial program 3.8%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified3.9%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 66.9%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified72.4%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Taylor expanded in angle around 0 28.2%

      \[\leadsto 0.25 \cdot \color{blue}{\left(a \cdot \left(x-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification35.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x-scale \leq 2.75 \cdot 10^{+20}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(a \cdot \left(x-scale \cdot \left(\sqrt{8} \cdot \sqrt{2}\right)\right)\right)\\ \end{array} \]

Alternative 9: 33.2% accurate, 17.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x-scale \leq 9.5 \cdot 10^{+24}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(a \cdot \left(\sqrt{8} \cdot \left(x-scale \cdot \sqrt{2}\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (if (<= x-scale 9.5e+24)
   (fabs (* 4.0 (* 0.25 (* y-scale b))))
   (* 0.25 (* a (* (sqrt 8.0) (* x-scale (sqrt 2.0)))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (x_45_scale <= 9.5e+24) {
		tmp = fabs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * (a * (sqrt(8.0) * (x_45_scale * sqrt(2.0))));
	}
	return tmp;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle
    real(8), intent (in) :: x_45scale
    real(8), intent (in) :: y_45scale
    real(8) :: tmp
    if (x_45scale <= 9.5d+24) then
        tmp = abs((4.0d0 * (0.25d0 * (y_45scale * b))))
    else
        tmp = 0.25d0 * (a * (sqrt(8.0d0) * (x_45scale * sqrt(2.0d0))))
    end if
    code = tmp
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (x_45_scale <= 9.5e+24) {
		tmp = Math.abs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * (a * (Math.sqrt(8.0) * (x_45_scale * Math.sqrt(2.0))));
	}
	return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale):
	tmp = 0
	if x_45_scale <= 9.5e+24:
		tmp = math.fabs((4.0 * (0.25 * (y_45_scale * b))))
	else:
		tmp = 0.25 * (a * (math.sqrt(8.0) * (x_45_scale * math.sqrt(2.0))))
	return tmp
function code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.0
	if (x_45_scale <= 9.5e+24)
		tmp = abs(Float64(4.0 * Float64(0.25 * Float64(y_45_scale * b))));
	else
		tmp = Float64(0.25 * Float64(a * Float64(sqrt(8.0) * Float64(x_45_scale * sqrt(2.0)))));
	end
	return tmp
end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.0;
	if (x_45_scale <= 9.5e+24)
		tmp = abs((4.0 * (0.25 * (y_45_scale * b))));
	else
		tmp = 0.25 * (a * (sqrt(8.0) * (x_45_scale * sqrt(2.0))));
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[x$45$scale, 9.5e+24], N[Abs[N[(4.0 * N[(0.25 * N[(y$45$scale * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(0.25 * N[(a * N[(N[Sqrt[8.0], $MachinePrecision] * N[(x$45$scale * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x-scale \leq 9.5 \cdot 10^{+24}:\\
\;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(a \cdot \left(\sqrt{8} \cdot \left(x-scale \cdot \sqrt{2}\right)\right)\right)\\


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

    1. Initial program 0.7%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified1.9%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in angle around 0 22.0%

      \[\leadsto \color{blue}{0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. add-exp-log21.0%

        \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)}} \]
      2. associate-*r*21.0%

        \[\leadsto e^{\log \left(0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)} \]
      3. sqrt-unprod21.0%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)\right)} \]
      4. metadata-eval21.0%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \sqrt{\color{blue}{16}}\right)\right)} \]
      5. metadata-eval21.0%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)\right)} \]
    5. Applied egg-rr21.0%

      \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
    6. Step-by-step derivation
      1. rem-exp-log22.2%

        \[\leadsto \color{blue}{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \]
      2. add-sqr-sqrt21.6%

        \[\leadsto \color{blue}{\sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \cdot \sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)}} \]
      3. sqrt-unprod32.7%

        \[\leadsto \color{blue}{\sqrt{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right) \cdot \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
      4. pow232.7%

        \[\leadsto \sqrt{\color{blue}{{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}^{2}}} \]
      5. associate-*l*32.7%

        \[\leadsto \sqrt{{\left(0.25 \cdot \color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)}\right)}^{2}} \]
    7. Applied egg-rr32.7%

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

        \[\leadsto \sqrt{\color{blue}{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right) \cdot \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}} \]
      2. rem-sqrt-square37.6%

        \[\leadsto \color{blue}{\left|0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right|} \]
      3. associate-*r*37.6%

        \[\leadsto \left|0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right)}\right| \]
      4. associate-*l*37.6%

        \[\leadsto \left|\color{blue}{\left(0.25 \cdot \left(b \cdot y-scale\right)\right) \cdot 4}\right| \]
      5. *-commutative37.6%

        \[\leadsto \left|\color{blue}{4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)}\right| \]
    9. Simplified37.6%

      \[\leadsto \color{blue}{\left|4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)\right|} \]

    if 9.5000000000000001e24 < x-scale

    1. Initial program 3.8%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified3.9%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 66.9%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified72.4%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Step-by-step derivation
      1. add-cbrt-cube68.0%

        \[\leadsto 0.25 \cdot \color{blue}{\sqrt[3]{\left(\left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)\right) \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)}} \]
      2. pow1/367.3%

        \[\leadsto 0.25 \cdot \color{blue}{{\left(\left(\left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)\right) \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)\right)}^{0.3333333333333333}} \]
    6. Applied egg-rr67.4%

      \[\leadsto 0.25 \cdot \color{blue}{{\left({\left(\left(\sqrt{2} \cdot \mathsf{hypot}\left(\cos \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right) \cdot a, \sin \left(\left(0.005555555555555556 \cdot angle\right) \cdot \pi\right) \cdot b\right)\right) \cdot \left(\sqrt{8} \cdot x-scale\right)\right)}^{3}\right)}^{0.3333333333333333}} \]
    7. Taylor expanded in angle around 0 28.2%

      \[\leadsto 0.25 \cdot \color{blue}{\left(a \cdot \left(x-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
    8. Step-by-step derivation
      1. associate-*r*28.2%

        \[\leadsto 0.25 \cdot \left(a \cdot \color{blue}{\left(\left(x-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)}\right) \]
    9. Simplified28.2%

      \[\leadsto 0.25 \cdot \color{blue}{\left(a \cdot \left(\left(x-scale \cdot \sqrt{2}\right) \cdot \sqrt{8}\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification35.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x-scale \leq 9.5 \cdot 10^{+24}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(a \cdot \left(\sqrt{8} \cdot \left(x-scale \cdot \sqrt{2}\right)\right)\right)\\ \end{array} \]

Alternative 10: 33.2% accurate, 17.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x-scale \leq 2.35 \cdot 10^{+25}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \sqrt{2}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (if (<= x-scale 2.35e+25)
   (fabs (* 4.0 (* 0.25 (* y-scale b))))
   (* 0.25 (* (* x-scale (sqrt 8.0)) (* a (sqrt 2.0))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (x_45_scale <= 2.35e+25) {
		tmp = fabs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * ((x_45_scale * sqrt(8.0)) * (a * sqrt(2.0)));
	}
	return tmp;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle
    real(8), intent (in) :: x_45scale
    real(8), intent (in) :: y_45scale
    real(8) :: tmp
    if (x_45scale <= 2.35d+25) then
        tmp = abs((4.0d0 * (0.25d0 * (y_45scale * b))))
    else
        tmp = 0.25d0 * ((x_45scale * sqrt(8.0d0)) * (a * sqrt(2.0d0)))
    end if
    code = tmp
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (x_45_scale <= 2.35e+25) {
		tmp = Math.abs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = 0.25 * ((x_45_scale * Math.sqrt(8.0)) * (a * Math.sqrt(2.0)));
	}
	return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale):
	tmp = 0
	if x_45_scale <= 2.35e+25:
		tmp = math.fabs((4.0 * (0.25 * (y_45_scale * b))))
	else:
		tmp = 0.25 * ((x_45_scale * math.sqrt(8.0)) * (a * math.sqrt(2.0)))
	return tmp
function code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.0
	if (x_45_scale <= 2.35e+25)
		tmp = abs(Float64(4.0 * Float64(0.25 * Float64(y_45_scale * b))));
	else
		tmp = Float64(0.25 * Float64(Float64(x_45_scale * sqrt(8.0)) * Float64(a * sqrt(2.0))));
	end
	return tmp
end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.0;
	if (x_45_scale <= 2.35e+25)
		tmp = abs((4.0 * (0.25 * (y_45_scale * b))));
	else
		tmp = 0.25 * ((x_45_scale * sqrt(8.0)) * (a * sqrt(2.0)));
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[x$45$scale, 2.35e+25], N[Abs[N[(4.0 * N[(0.25 * N[(y$45$scale * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(0.25 * N[(N[(x$45$scale * N[Sqrt[8.0], $MachinePrecision]), $MachinePrecision] * N[(a * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x-scale \leq 2.35 \cdot 10^{+25}:\\
\;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \sqrt{2}\right)\right)\\


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

    1. Initial program 0.7%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified1.9%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in angle around 0 22.0%

      \[\leadsto \color{blue}{0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. add-exp-log21.0%

        \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)}} \]
      2. associate-*r*21.0%

        \[\leadsto e^{\log \left(0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)} \]
      3. sqrt-unprod21.0%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)\right)} \]
      4. metadata-eval21.0%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \sqrt{\color{blue}{16}}\right)\right)} \]
      5. metadata-eval21.0%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)\right)} \]
    5. Applied egg-rr21.0%

      \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
    6. Step-by-step derivation
      1. rem-exp-log22.2%

        \[\leadsto \color{blue}{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \]
      2. add-sqr-sqrt21.6%

        \[\leadsto \color{blue}{\sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \cdot \sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)}} \]
      3. sqrt-unprod32.7%

        \[\leadsto \color{blue}{\sqrt{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right) \cdot \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
      4. pow232.7%

        \[\leadsto \sqrt{\color{blue}{{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}^{2}}} \]
      5. associate-*l*32.7%

        \[\leadsto \sqrt{{\left(0.25 \cdot \color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)}\right)}^{2}} \]
    7. Applied egg-rr32.7%

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

        \[\leadsto \sqrt{\color{blue}{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right) \cdot \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}} \]
      2. rem-sqrt-square37.6%

        \[\leadsto \color{blue}{\left|0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right|} \]
      3. associate-*r*37.6%

        \[\leadsto \left|0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right)}\right| \]
      4. associate-*l*37.6%

        \[\leadsto \left|\color{blue}{\left(0.25 \cdot \left(b \cdot y-scale\right)\right) \cdot 4}\right| \]
      5. *-commutative37.6%

        \[\leadsto \left|\color{blue}{4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)}\right| \]
    9. Simplified37.6%

      \[\leadsto \color{blue}{\left|4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)\right|} \]

    if 2.3499999999999999e25 < x-scale

    1. Initial program 3.8%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified3.9%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in y-scale around 0 66.9%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{2 \cdot \left({a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right) + 2 \cdot \left({b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}\right)}\right)} \]
    4. Simplified72.4%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{2 \cdot \left({\left(a \cdot \cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}^{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right)} \]
    5. Taylor expanded in angle around 0 28.3%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(a \cdot \sqrt{2}\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    6. Step-by-step derivation
      1. *-commutative28.3%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\sqrt{2} \cdot a\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
    7. Simplified28.3%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\sqrt{2} \cdot a\right)} \cdot \left(\sqrt{8} \cdot x-scale\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification35.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x-scale \leq 2.35 \cdot 10^{+25}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \left(a \cdot \sqrt{2}\right)\right)\\ \end{array} \]

Alternative 11: 32.5% accurate, 17.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x-scale \leq 5.6 \cdot 10^{+230}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(0.25 \cdot \left(4 \cdot \left(y-scale \cdot b\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (if (<= x-scale 5.6e+230)
   (fabs (* 4.0 (* 0.25 (* y-scale b))))
   (log1p (expm1 (* 0.25 (* 4.0 (* y-scale b)))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (x_45_scale <= 5.6e+230) {
		tmp = fabs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = log1p(expm1((0.25 * (4.0 * (y_45_scale * b)))));
	}
	return tmp;
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double tmp;
	if (x_45_scale <= 5.6e+230) {
		tmp = Math.abs((4.0 * (0.25 * (y_45_scale * b))));
	} else {
		tmp = Math.log1p(Math.expm1((0.25 * (4.0 * (y_45_scale * b)))));
	}
	return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale):
	tmp = 0
	if x_45_scale <= 5.6e+230:
		tmp = math.fabs((4.0 * (0.25 * (y_45_scale * b))))
	else:
		tmp = math.log1p(math.expm1((0.25 * (4.0 * (y_45_scale * b)))))
	return tmp
function code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.0
	if (x_45_scale <= 5.6e+230)
		tmp = abs(Float64(4.0 * Float64(0.25 * Float64(y_45_scale * b))));
	else
		tmp = log1p(expm1(Float64(0.25 * Float64(4.0 * Float64(y_45_scale * b)))));
	end
	return tmp
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[x$45$scale, 5.6e+230], N[Abs[N[(4.0 * N[(0.25 * N[(y$45$scale * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Log[1 + N[(Exp[N[(0.25 * N[(4.0 * N[(y$45$scale * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x-scale \leq 5.6 \cdot 10^{+230}:\\
\;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\

\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(0.25 \cdot \left(4 \cdot \left(y-scale \cdot b\right)\right)\right)\right)\\


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

    1. Initial program 1.1%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified2.6%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in angle around 0 20.3%

      \[\leadsto \color{blue}{0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. add-exp-log19.3%

        \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)}} \]
      2. associate-*r*19.3%

        \[\leadsto e^{\log \left(0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)} \]
      3. sqrt-unprod19.3%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)\right)} \]
      4. metadata-eval19.3%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \sqrt{\color{blue}{16}}\right)\right)} \]
      5. metadata-eval19.3%

        \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)\right)} \]
    5. Applied egg-rr19.3%

      \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
    6. Step-by-step derivation
      1. rem-exp-log20.5%

        \[\leadsto \color{blue}{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \]
      2. add-sqr-sqrt19.9%

        \[\leadsto \color{blue}{\sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \cdot \sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)}} \]
      3. sqrt-unprod32.2%

        \[\leadsto \color{blue}{\sqrt{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right) \cdot \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
      4. pow232.2%

        \[\leadsto \sqrt{\color{blue}{{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}^{2}}} \]
      5. associate-*l*32.2%

        \[\leadsto \sqrt{{\left(0.25 \cdot \color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)}\right)}^{2}} \]
    7. Applied egg-rr32.2%

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

        \[\leadsto \sqrt{\color{blue}{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right) \cdot \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}} \]
      2. rem-sqrt-square36.8%

        \[\leadsto \color{blue}{\left|0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right|} \]
      3. associate-*r*36.8%

        \[\leadsto \left|0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right)}\right| \]
      4. associate-*l*36.8%

        \[\leadsto \left|\color{blue}{\left(0.25 \cdot \left(b \cdot y-scale\right)\right) \cdot 4}\right| \]
      5. *-commutative36.8%

        \[\leadsto \left|\color{blue}{4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)}\right| \]
    9. Simplified36.8%

      \[\leadsto \color{blue}{\left|4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)\right|} \]

    if 5.6000000000000004e230 < x-scale

    1. Initial program 4.3%

      \[\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \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}\right) + \sqrt{{\left(\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} - \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}\right)}^{2} + {\left(\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}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}} \]
    2. Simplified0.0%

      \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
    3. Taylor expanded in angle around 0 6.8%

      \[\leadsto \color{blue}{0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. log1p-expm1-u36.0%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)\right)} \]
      2. associate-*r*36.0%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)\right) \]
      3. sqrt-unprod36.0%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)\right)\right) \]
      4. metadata-eval36.0%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \sqrt{\color{blue}{16}}\right)\right)\right) \]
      5. metadata-eval36.0%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)\right)\right) \]
    5. Applied egg-rr36.0%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification36.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x-scale \leq 5.6 \cdot 10^{+230}:\\ \;\;\;\;\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(0.25 \cdot \left(4 \cdot \left(y-scale \cdot b\right)\right)\right)\right)\\ \end{array} \]

Alternative 12: 32.4% accurate, 35.0× speedup?

\[\begin{array}{l} \\ \left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right| \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (fabs (* 4.0 (* 0.25 (* y-scale b)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return fabs((4.0 * (0.25 * (y_45_scale * b))));
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle
    real(8), intent (in) :: x_45scale
    real(8), intent (in) :: y_45scale
    code = abs((4.0d0 * (0.25d0 * (y_45scale * b))))
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return Math.abs((4.0 * (0.25 * (y_45_scale * b))));
}
def code(a, b, angle, x_45_scale, y_45_scale):
	return math.fabs((4.0 * (0.25 * (y_45_scale * b))))
function code(a, b, angle, x_45_scale, y_45_scale)
	return abs(Float64(4.0 * Float64(0.25 * Float64(y_45_scale * b))))
end
function tmp = code(a, b, angle, x_45_scale, y_45_scale)
	tmp = abs((4.0 * (0.25 * (y_45_scale * b))));
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[Abs[N[(4.0 * N[(0.25 * N[(y$45$scale * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right|
\end{array}
Derivation
  1. Initial program 1.4%

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

    \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
  3. Taylor expanded in angle around 0 19.1%

    \[\leadsto \color{blue}{0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
  4. Step-by-step derivation
    1. add-exp-log18.2%

      \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)}} \]
    2. associate-*r*18.2%

      \[\leadsto e^{\log \left(0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)} \]
    3. sqrt-unprod18.2%

      \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)\right)} \]
    4. metadata-eval18.2%

      \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \sqrt{\color{blue}{16}}\right)\right)} \]
    5. metadata-eval18.2%

      \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)\right)} \]
  5. Applied egg-rr18.2%

    \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
  6. Step-by-step derivation
    1. rem-exp-log19.3%

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \]
    2. add-sqr-sqrt18.7%

      \[\leadsto \color{blue}{\sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)} \cdot \sqrt{0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)}} \]
    3. sqrt-unprod31.1%

      \[\leadsto \color{blue}{\sqrt{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right) \cdot \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
    4. pow231.1%

      \[\leadsto \sqrt{\color{blue}{{\left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}^{2}}} \]
    5. associate-*l*31.1%

      \[\leadsto \sqrt{{\left(0.25 \cdot \color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)}\right)}^{2}} \]
  7. Applied egg-rr31.1%

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

      \[\leadsto \sqrt{\color{blue}{\left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right) \cdot \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}} \]
    2. rem-sqrt-square34.5%

      \[\leadsto \color{blue}{\left|0.25 \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right|} \]
    3. associate-*r*34.5%

      \[\leadsto \left|0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right)}\right| \]
    4. associate-*l*34.5%

      \[\leadsto \left|\color{blue}{\left(0.25 \cdot \left(b \cdot y-scale\right)\right) \cdot 4}\right| \]
    5. *-commutative34.5%

      \[\leadsto \left|\color{blue}{4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)}\right| \]
  9. Simplified34.5%

    \[\leadsto \color{blue}{\left|4 \cdot \left(0.25 \cdot \left(b \cdot y-scale\right)\right)\right|} \]
  10. Final simplification34.5%

    \[\leadsto \left|4 \cdot \left(0.25 \cdot \left(y-scale \cdot b\right)\right)\right| \]

Alternative 13: 18.0% accurate, 1249.0× speedup?

\[\begin{array}{l} \\ y-scale \cdot b \end{array} \]
(FPCore (a b angle x-scale y-scale) :precision binary64 (* y-scale b))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return y_45_scale * b;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: angle
    real(8), intent (in) :: x_45scale
    real(8), intent (in) :: y_45scale
    code = y_45scale * b
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return y_45_scale * b;
}
def code(a, b, angle, x_45_scale, y_45_scale):
	return y_45_scale * b
function code(a, b, angle, x_45_scale, y_45_scale)
	return Float64(y_45_scale * b)
end
function tmp = code(a, b, angle, x_45_scale, y_45_scale)
	tmp = y_45_scale * b;
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(y$45$scale * b), $MachinePrecision]
\begin{array}{l}

\\
y-scale \cdot b
\end{array}
Derivation
  1. Initial program 1.4%

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

    \[\leadsto \color{blue}{{\left(x-scale \cdot y-scale\right)}^{2} \cdot \left(-0.25 \cdot \frac{\sqrt{\left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right) \cdot \left(\frac{8 \cdot \left(b \cdot \left({a}^{2} \cdot \left(-b\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}} \cdot \left(\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}^{2}} + \left(\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}^{2}} + \mathsf{hypot}\left(\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}^{2}} - \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}^{2}}, \frac{\cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale} \cdot \frac{\left(\sin \left(\frac{angle}{180} \cdot \pi\right) \cdot 2\right) \cdot \left({b}^{2} - {a}^{2}\right)}{y-scale}\right)\right)\right)\right)}}{b \cdot \left({a}^{2} \cdot \left(-b\right)\right)}\right)} \]
  3. Taylor expanded in angle around 0 19.1%

    \[\leadsto \color{blue}{0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)} \]
  4. Step-by-step derivation
    1. add-exp-log18.2%

      \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(b \cdot \left(y-scale \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)\right)\right)}} \]
    2. associate-*r*18.2%

      \[\leadsto e^{\log \left(0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(\sqrt{2} \cdot \sqrt{8}\right)\right)}\right)} \]
    3. sqrt-unprod18.2%

      \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{2 \cdot 8}}\right)\right)} \]
    4. metadata-eval18.2%

      \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \sqrt{\color{blue}{16}}\right)\right)} \]
    5. metadata-eval18.2%

      \[\leadsto e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)\right)} \]
  5. Applied egg-rr18.2%

    \[\leadsto \color{blue}{e^{\log \left(0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}} \]
  6. Taylor expanded in b around 0 19.3%

    \[\leadsto \color{blue}{b \cdot y-scale} \]
  7. Final simplification19.3%

    \[\leadsto y-scale \cdot b \]

Reproduce

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