b from scale-rotated-ellipse

Percentage Accurate: 0.1% → 27.2%
Time: 36.8s
Alternatives: 6
Speedup: 8.2×

Specification

?
\[\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} \]
(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}
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}

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 6 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: 0.1% accurate, 1.0× speedup?

\[\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} \]
(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}
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}

Alternative 1: 27.2% accurate, 4.7× speedup?

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

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{\left|a\right| \cdot \left(\left|y-scale\right| \cdot \sqrt{8 \cdot \left({b}^{4} \cdot t\_0\right)}\right)}{{b}^{2}}\\


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

    1. Initial program 0.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. Taylor expanded in x-scale around 0

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

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

      \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
    5. Step-by-step derivation
      1. lower-/.f64N/A

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

      \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
    7. Applied rewrites18.0%

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

      \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \left(\frac{1}{2} - \left(\sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)\right)}\right)}{\left|y-scale\right|} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{1}{4} \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \left(\frac{1}{2} - \left(\sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{4}} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)}\right)}{\left|y-scale\right|} \]
    10. Applied rewrites25.4%

      \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \left(0.5 - \left(\sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}} + 0.5 \cdot \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\right)\right)}\right)}{\left|y-scale\right|} \]

    if 6.39999999999999988e151 < y-scale

    1. Initial program 0.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. Taylor expanded in x-scale around 0

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

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

      \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
    5. Step-by-step derivation
      1. lower-/.f64N/A

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

      \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
    7. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \frac{1}{4} \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{{b}^{2}} \]
      2. pow1/2N/A

        \[\leadsto \frac{1}{4} \cdot \frac{a \cdot \left({y-scale}^{2} \cdot {\left(8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}\right)}^{\frac{1}{2}}\right)}{{b}^{2}} \]
      3. lower-pow.f644.1%

        \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot {\left(8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}\right)}^{0.5}\right)}{{b}^{2}} \]
    8. Applied rewrites3.6%

      \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot {\left(\left({b}^{4} \cdot \frac{\left(0.5 - \cos \left(\left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right) \cdot 2\right) \cdot 0.5\right) - \sqrt{{\sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}^{4}}}{y-scale \cdot y-scale}\right) \cdot 8\right)}^{0.5}\right)}{{b}^{2}} \]
    9. Taylor expanded in y-scale around 0

      \[\leadsto 0.25 \cdot \frac{a \cdot \left(y-scale \cdot \sqrt{8 \cdot \left({b}^{4} \cdot \left(\frac{1}{2} - \left(\sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)\right)\right)}\right)}{{b}^{2}} \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

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

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

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

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

      \[\leadsto 0.25 \cdot \frac{a \cdot \left(y-scale \cdot \sqrt{8 \cdot \left({b}^{4} \cdot \left(0.5 - \left(\sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}} + 0.5 \cdot \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\right)\right)\right)}\right)}{{b}^{2}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 26.2% accurate, 5.0× speedup?

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

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\frac{\left|a\right| \cdot \left(\left|y-scale\right| \cdot \left|y-scale\right|\right)}{b} \cdot \frac{\frac{\sqrt{8 \cdot \left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left({angle}^{2} \cdot {\pi}^{2}\right) - \sqrt{{\sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}^{4}}\right) \cdot {b}^{4}\right)}}{t\_0}}{b}\right)\\


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

    1. Initial program 0.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. Taylor expanded in x-scale around 0

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

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

      \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
    5. Step-by-step derivation
      1. lower-/.f64N/A

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

      \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
    7. Applied rewrites18.0%

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

      \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \left(\frac{1}{2} - \left(\sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)\right)}\right)}{\left|y-scale\right|} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{1}{4} \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \left(\frac{1}{2} - \left(\sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{4}} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)}\right)}{\left|y-scale\right|} \]
    10. Applied rewrites25.4%

      \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \left(0.5 - \left(\sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}} + 0.5 \cdot \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\right)\right)}\right)}{\left|y-scale\right|} \]

    if 1.35000000000000003e154 < y-scale

    1. Initial program 0.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. Taylor expanded in x-scale around 0

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

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

      \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
    5. Step-by-step derivation
      1. lower-/.f64N/A

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

      \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
    7. Applied rewrites18.0%

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

      \[\leadsto 0.25 \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{\sqrt{8 \cdot \left(\left(\frac{1}{32400} \cdot \left({angle}^{2} \cdot {\pi}^{2}\right) - \sqrt{{\sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}^{4}}\right) \cdot {b}^{4}\right)}}{\left|y-scale\right|}}{b}\right) \]
    9. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{1}{4} \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{\sqrt{8 \cdot \left(\left(\frac{1}{32400} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) - \sqrt{{\sin \left(\left(\pi \cdot angle\right) \cdot \frac{1}{180}\right)}^{4}}\right) \cdot {b}^{4}\right)}}{\left|y-scale\right|}}{b}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{4} \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{\sqrt{8 \cdot \left(\left(\frac{1}{32400} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) - \sqrt{{\sin \left(\left(\pi \cdot angle\right) \cdot \frac{1}{180}\right)}^{4}}\right) \cdot {b}^{4}\right)}}{\left|y-scale\right|}}{b}\right) \]
      3. lower-pow.f64N/A

        \[\leadsto \frac{1}{4} \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{\sqrt{8 \cdot \left(\left(\frac{1}{32400} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) - \sqrt{{\sin \left(\left(\pi \cdot angle\right) \cdot \frac{1}{180}\right)}^{4}}\right) \cdot {b}^{4}\right)}}{\left|y-scale\right|}}{b}\right) \]
      4. lower-pow.f64N/A

        \[\leadsto \frac{1}{4} \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{\sqrt{8 \cdot \left(\left(\frac{1}{32400} \cdot \left({angle}^{2} \cdot {\mathsf{PI}\left(\right)}^{2}\right) - \sqrt{{\sin \left(\left(\pi \cdot angle\right) \cdot \frac{1}{180}\right)}^{4}}\right) \cdot {b}^{4}\right)}}{\left|y-scale\right|}}{b}\right) \]
      5. lower-PI.f6413.7%

        \[\leadsto 0.25 \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{\sqrt{8 \cdot \left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left({angle}^{2} \cdot {\pi}^{2}\right) - \sqrt{{\sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}^{4}}\right) \cdot {b}^{4}\right)}}{\left|y-scale\right|}}{b}\right) \]
    10. Applied rewrites13.7%

      \[\leadsto 0.25 \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{\sqrt{8 \cdot \left(\left(3.08641975308642 \cdot 10^{-5} \cdot \left({angle}^{2} \cdot {\pi}^{2}\right) - \sqrt{{\sin \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)}^{4}}\right) \cdot {b}^{4}\right)}}{\left|y-scale\right|}}{b}\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 25.6% accurate, 5.5× speedup?

\[0.25 \cdot \frac{\left|a\right| \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \left(0.5 - \left(\sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}} + 0.5 \cdot \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\right)\right)}\right)}{\left|y-scale\right|} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (*
  0.25
  (/
   (*
    (fabs a)
    (*
     (pow y-scale 2.0)
     (sqrt
      (*
       8.0
       (-
        0.5
        (+
         (sqrt (pow (sin (* 0.005555555555555556 (* angle PI))) 4.0))
         (* 0.5 (cos (* 0.011111111111111112 (* angle PI))))))))))
   (fabs y-scale))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return 0.25 * ((fabs(a) * (pow(y_45_scale, 2.0) * sqrt((8.0 * (0.5 - (sqrt(pow(sin((0.005555555555555556 * (angle * ((double) M_PI)))), 4.0)) + (0.5 * cos((0.011111111111111112 * (angle * ((double) M_PI))))))))))) / fabs(y_45_scale));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return 0.25 * ((Math.abs(a) * (Math.pow(y_45_scale, 2.0) * Math.sqrt((8.0 * (0.5 - (Math.sqrt(Math.pow(Math.sin((0.005555555555555556 * (angle * Math.PI))), 4.0)) + (0.5 * Math.cos((0.011111111111111112 * (angle * Math.PI)))))))))) / Math.abs(y_45_scale));
}
def code(a, b, angle, x_45_scale, y_45_scale):
	return 0.25 * ((math.fabs(a) * (math.pow(y_45_scale, 2.0) * math.sqrt((8.0 * (0.5 - (math.sqrt(math.pow(math.sin((0.005555555555555556 * (angle * math.pi))), 4.0)) + (0.5 * math.cos((0.011111111111111112 * (angle * math.pi)))))))))) / math.fabs(y_45_scale))
function code(a, b, angle, x_45_scale, y_45_scale)
	return Float64(0.25 * Float64(Float64(abs(a) * Float64((y_45_scale ^ 2.0) * sqrt(Float64(8.0 * Float64(0.5 - Float64(sqrt((sin(Float64(0.005555555555555556 * Float64(angle * pi))) ^ 4.0)) + Float64(0.5 * cos(Float64(0.011111111111111112 * Float64(angle * pi)))))))))) / abs(y_45_scale)))
end
function tmp = code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.25 * ((abs(a) * ((y_45_scale ^ 2.0) * sqrt((8.0 * (0.5 - (sqrt((sin((0.005555555555555556 * (angle * pi))) ^ 4.0)) + (0.5 * cos((0.011111111111111112 * (angle * pi)))))))))) / abs(y_45_scale));
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(0.25 * N[(N[(N[Abs[a], $MachinePrecision] * N[(N[Power[y$45$scale, 2.0], $MachinePrecision] * N[Sqrt[N[(8.0 * N[(0.5 - N[(N[Sqrt[N[Power[N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 4.0], $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Cos[N[(0.011111111111111112 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[y$45$scale], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
0.25 \cdot \frac{\left|a\right| \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \left(0.5 - \left(\sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}} + 0.5 \cdot \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\right)\right)}\right)}{\left|y-scale\right|}
Derivation
  1. Initial program 0.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. Taylor expanded in x-scale around 0

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

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

    \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
  5. Step-by-step derivation
    1. lower-/.f64N/A

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

    \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
  7. Applied rewrites18.0%

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

    \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \left(\frac{1}{2} - \left(\sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)\right)}\right)}{\left|y-scale\right|} \]
  9. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{1}{4} \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \left(\frac{1}{2} - \left(\sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{4}} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)}\right)}{\left|y-scale\right|} \]
  10. Applied rewrites25.4%

    \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \left(0.5 - \left(\sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}} + 0.5 \cdot \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\right)\right)}\right)}{\left|y-scale\right|} \]
  11. Add Preprocessing

Alternative 4: 23.4% accurate, 5.8× speedup?

\[0.25 \cdot \left(\frac{\left|a\right| \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{b \cdot \sqrt{8 \cdot \left(0.5 - \left(\sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}} + 0.5 \cdot \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\right)\right)}}{\left|y-scale\right|}\right) \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (*
  0.25
  (*
   (/ (* (fabs a) (* y-scale y-scale)) b)
   (/
    (*
     b
     (sqrt
      (*
       8.0
       (-
        0.5
        (+
         (sqrt (pow (sin (* 0.005555555555555556 (* angle PI))) 4.0))
         (* 0.5 (cos (* 0.011111111111111112 (* angle PI)))))))))
    (fabs y-scale)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return 0.25 * (((fabs(a) * (y_45_scale * y_45_scale)) / b) * ((b * sqrt((8.0 * (0.5 - (sqrt(pow(sin((0.005555555555555556 * (angle * ((double) M_PI)))), 4.0)) + (0.5 * cos((0.011111111111111112 * (angle * ((double) M_PI)))))))))) / fabs(y_45_scale)));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return 0.25 * (((Math.abs(a) * (y_45_scale * y_45_scale)) / b) * ((b * Math.sqrt((8.0 * (0.5 - (Math.sqrt(Math.pow(Math.sin((0.005555555555555556 * (angle * Math.PI))), 4.0)) + (0.5 * Math.cos((0.011111111111111112 * (angle * Math.PI))))))))) / Math.abs(y_45_scale)));
}
def code(a, b, angle, x_45_scale, y_45_scale):
	return 0.25 * (((math.fabs(a) * (y_45_scale * y_45_scale)) / b) * ((b * math.sqrt((8.0 * (0.5 - (math.sqrt(math.pow(math.sin((0.005555555555555556 * (angle * math.pi))), 4.0)) + (0.5 * math.cos((0.011111111111111112 * (angle * math.pi))))))))) / math.fabs(y_45_scale)))
function code(a, b, angle, x_45_scale, y_45_scale)
	return Float64(0.25 * Float64(Float64(Float64(abs(a) * Float64(y_45_scale * y_45_scale)) / b) * Float64(Float64(b * sqrt(Float64(8.0 * Float64(0.5 - Float64(sqrt((sin(Float64(0.005555555555555556 * Float64(angle * pi))) ^ 4.0)) + Float64(0.5 * cos(Float64(0.011111111111111112 * Float64(angle * pi))))))))) / abs(y_45_scale))))
end
function tmp = code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.25 * (((abs(a) * (y_45_scale * y_45_scale)) / b) * ((b * sqrt((8.0 * (0.5 - (sqrt((sin((0.005555555555555556 * (angle * pi))) ^ 4.0)) + (0.5 * cos((0.011111111111111112 * (angle * pi))))))))) / abs(y_45_scale)));
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(0.25 * N[(N[(N[(N[Abs[a], $MachinePrecision] * N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision] * N[(N[(b * N[Sqrt[N[(8.0 * N[(0.5 - N[(N[Sqrt[N[Power[N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 4.0], $MachinePrecision]], $MachinePrecision] + N[(0.5 * N[Cos[N[(0.011111111111111112 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Abs[y$45$scale], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
0.25 \cdot \left(\frac{\left|a\right| \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{b \cdot \sqrt{8 \cdot \left(0.5 - \left(\sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}} + 0.5 \cdot \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\right)\right)}}{\left|y-scale\right|}\right)
Derivation
  1. Initial program 0.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. Taylor expanded in x-scale around 0

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

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

    \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
  5. Step-by-step derivation
    1. lower-/.f64N/A

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

    \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
  7. Applied rewrites18.0%

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

    \[\leadsto 0.25 \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{b \cdot \sqrt{8 \cdot \left(\frac{1}{2} - \left(\sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \pi\right)\right)\right)\right)}}{\left|y-scale\right|}\right) \]
  9. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{1}{4} \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{b \cdot \sqrt{8 \cdot \left(\frac{1}{2} - \left(\sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)}^{4}} + \frac{1}{2} \cdot \cos \left(\frac{1}{90} \cdot \left(angle \cdot \mathsf{PI}\left(\right)\right)\right)\right)\right)}}{\left|y-scale\right|}\right) \]
  10. Applied rewrites23.3%

    \[\leadsto 0.25 \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{b \cdot \sqrt{8 \cdot \left(0.5 - \left(\sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}} + 0.5 \cdot \cos \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)\right)\right)}}{\left|y-scale\right|}\right) \]
  11. Add Preprocessing

Alternative 5: 19.5% accurate, 8.2× speedup?

\[0.25 \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{9.525986892242036 \cdot 10^{-10} \cdot {\pi}^{4}} + -3.08641975308642 \cdot 10^{-5} \cdot {\pi}^{2}\right)\right)}}{\left|y-scale\right|}}{b}\right) \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (*
  0.25
  (*
   (/ (* a (* y-scale y-scale)) b)
   (/
    (/
     (*
      angle
      (sqrt
       (*
        -8.0
        (*
         (pow b 4.0)
         (+
          (sqrt (* 9.525986892242036e-10 (pow PI 4.0)))
          (* -3.08641975308642e-5 (pow PI 2.0)))))))
     (fabs y-scale))
    b))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return 0.25 * (((a * (y_45_scale * y_45_scale)) / b) * (((angle * sqrt((-8.0 * (pow(b, 4.0) * (sqrt((9.525986892242036e-10 * pow(((double) M_PI), 4.0))) + (-3.08641975308642e-5 * pow(((double) M_PI), 2.0))))))) / fabs(y_45_scale)) / b));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return 0.25 * (((a * (y_45_scale * y_45_scale)) / b) * (((angle * Math.sqrt((-8.0 * (Math.pow(b, 4.0) * (Math.sqrt((9.525986892242036e-10 * Math.pow(Math.PI, 4.0))) + (-3.08641975308642e-5 * Math.pow(Math.PI, 2.0))))))) / Math.abs(y_45_scale)) / b));
}
def code(a, b, angle, x_45_scale, y_45_scale):
	return 0.25 * (((a * (y_45_scale * y_45_scale)) / b) * (((angle * math.sqrt((-8.0 * (math.pow(b, 4.0) * (math.sqrt((9.525986892242036e-10 * math.pow(math.pi, 4.0))) + (-3.08641975308642e-5 * math.pow(math.pi, 2.0))))))) / math.fabs(y_45_scale)) / b))
function code(a, b, angle, x_45_scale, y_45_scale)
	return Float64(0.25 * Float64(Float64(Float64(a * Float64(y_45_scale * y_45_scale)) / b) * Float64(Float64(Float64(angle * sqrt(Float64(-8.0 * Float64((b ^ 4.0) * Float64(sqrt(Float64(9.525986892242036e-10 * (pi ^ 4.0))) + Float64(-3.08641975308642e-5 * (pi ^ 2.0))))))) / abs(y_45_scale)) / b)))
end
function tmp = code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.25 * (((a * (y_45_scale * y_45_scale)) / b) * (((angle * sqrt((-8.0 * ((b ^ 4.0) * (sqrt((9.525986892242036e-10 * (pi ^ 4.0))) + (-3.08641975308642e-5 * (pi ^ 2.0))))))) / abs(y_45_scale)) / b));
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(0.25 * N[(N[(N[(a * N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision] * N[(N[(N[(angle * N[Sqrt[N[(-8.0 * N[(N[Power[b, 4.0], $MachinePrecision] * N[(N[Sqrt[N[(9.525986892242036e-10 * N[Power[Pi, 4.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(-3.08641975308642e-5 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Abs[y$45$scale], $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
0.25 \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{9.525986892242036 \cdot 10^{-10} \cdot {\pi}^{4}} + -3.08641975308642 \cdot 10^{-5} \cdot {\pi}^{2}\right)\right)}}{\left|y-scale\right|}}{b}\right)
Derivation
  1. Initial program 0.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. Taylor expanded in x-scale around 0

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

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

    \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
  5. Step-by-step derivation
    1. lower-/.f64N/A

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

    \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
  7. Applied rewrites18.0%

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

    \[\leadsto 0.25 \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{\frac{1}{1049760000} \cdot {\pi}^{4}} + \frac{-1}{32400} \cdot {\pi}^{2}\right)\right)}}{\left|y-scale\right|}}{b}\right) \]
  9. Step-by-step derivation
    1. lower-*.f64N/A

      \[\leadsto \frac{1}{4} \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{\frac{1}{1049760000} \cdot {\mathsf{PI}\left(\right)}^{4}} + \frac{-1}{32400} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}}{\left|y-scale\right|}}{b}\right) \]
    2. lower-sqrt.f64N/A

      \[\leadsto \frac{1}{4} \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{\frac{1}{1049760000} \cdot {\mathsf{PI}\left(\right)}^{4}} + \frac{-1}{32400} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}}{\left|y-scale\right|}}{b}\right) \]
    3. lower-*.f64N/A

      \[\leadsto \frac{1}{4} \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{\frac{1}{1049760000} \cdot {\mathsf{PI}\left(\right)}^{4}} + \frac{-1}{32400} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}}{\left|y-scale\right|}}{b}\right) \]
    4. lower-*.f64N/A

      \[\leadsto \frac{1}{4} \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{\frac{1}{1049760000} \cdot {\mathsf{PI}\left(\right)}^{4}} + \frac{-1}{32400} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}}{\left|y-scale\right|}}{b}\right) \]
    5. lower-pow.f64N/A

      \[\leadsto \frac{1}{4} \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{\frac{1}{1049760000} \cdot {\mathsf{PI}\left(\right)}^{4}} + \frac{-1}{32400} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}}{\left|y-scale\right|}}{b}\right) \]
    6. lower-+.f64N/A

      \[\leadsto \frac{1}{4} \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{\frac{1}{1049760000} \cdot {\mathsf{PI}\left(\right)}^{4}} + \frac{-1}{32400} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}}{\left|y-scale\right|}}{b}\right) \]
  10. Applied rewrites19.5%

    \[\leadsto 0.25 \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{\frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{9.525986892242036 \cdot 10^{-10} \cdot {\pi}^{4}} + -3.08641975308642 \cdot 10^{-5} \cdot {\pi}^{2}\right)\right)}}{\left|y-scale\right|}}{b}\right) \]
  11. Add Preprocessing

Alternative 6: 8.3% accurate, 8.2× speedup?

\[0.25 \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{9.525986892242036 \cdot 10^{-10} \cdot {\pi}^{4}} + -3.08641975308642 \cdot 10^{-5} \cdot {\pi}^{2}\right)\right)}}{b \cdot \left|y-scale\right|}\right) \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (*
  0.25
  (*
   (/ (* a (* y-scale y-scale)) b)
   (/
    (*
     angle
     (sqrt
      (*
       -8.0
       (*
        (pow b 4.0)
        (+
         (sqrt (* 9.525986892242036e-10 (pow PI 4.0)))
         (* -3.08641975308642e-5 (pow PI 2.0)))))))
    (* b (fabs y-scale))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return 0.25 * (((a * (y_45_scale * y_45_scale)) / b) * ((angle * sqrt((-8.0 * (pow(b, 4.0) * (sqrt((9.525986892242036e-10 * pow(((double) M_PI), 4.0))) + (-3.08641975308642e-5 * pow(((double) M_PI), 2.0))))))) / (b * fabs(y_45_scale))));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return 0.25 * (((a * (y_45_scale * y_45_scale)) / b) * ((angle * Math.sqrt((-8.0 * (Math.pow(b, 4.0) * (Math.sqrt((9.525986892242036e-10 * Math.pow(Math.PI, 4.0))) + (-3.08641975308642e-5 * Math.pow(Math.PI, 2.0))))))) / (b * Math.abs(y_45_scale))));
}
def code(a, b, angle, x_45_scale, y_45_scale):
	return 0.25 * (((a * (y_45_scale * y_45_scale)) / b) * ((angle * math.sqrt((-8.0 * (math.pow(b, 4.0) * (math.sqrt((9.525986892242036e-10 * math.pow(math.pi, 4.0))) + (-3.08641975308642e-5 * math.pow(math.pi, 2.0))))))) / (b * math.fabs(y_45_scale))))
function code(a, b, angle, x_45_scale, y_45_scale)
	return Float64(0.25 * Float64(Float64(Float64(a * Float64(y_45_scale * y_45_scale)) / b) * Float64(Float64(angle * sqrt(Float64(-8.0 * Float64((b ^ 4.0) * Float64(sqrt(Float64(9.525986892242036e-10 * (pi ^ 4.0))) + Float64(-3.08641975308642e-5 * (pi ^ 2.0))))))) / Float64(b * abs(y_45_scale)))))
end
function tmp = code(a, b, angle, x_45_scale, y_45_scale)
	tmp = 0.25 * (((a * (y_45_scale * y_45_scale)) / b) * ((angle * sqrt((-8.0 * ((b ^ 4.0) * (sqrt((9.525986892242036e-10 * (pi ^ 4.0))) + (-3.08641975308642e-5 * (pi ^ 2.0))))))) / (b * abs(y_45_scale))));
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(0.25 * N[(N[(N[(a * N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision] * N[(N[(angle * N[Sqrt[N[(-8.0 * N[(N[Power[b, 4.0], $MachinePrecision] * N[(N[Sqrt[N[(9.525986892242036e-10 * N[Power[Pi, 4.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(-3.08641975308642e-5 * N[Power[Pi, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(b * N[Abs[y$45$scale], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
0.25 \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{9.525986892242036 \cdot 10^{-10} \cdot {\pi}^{4}} + -3.08641975308642 \cdot 10^{-5} \cdot {\pi}^{2}\right)\right)}}{b \cdot \left|y-scale\right|}\right)
Derivation
  1. Initial program 0.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. Taylor expanded in x-scale around 0

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

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

    \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(\frac{1}{180} \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
  5. Step-by-step derivation
    1. lower-/.f64N/A

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

    \[\leadsto 0.25 \cdot \frac{a \cdot \left({y-scale}^{2} \cdot \sqrt{8 \cdot \frac{{b}^{4} \cdot \left({\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} - \sqrt{{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{4}}\right)}{{y-scale}^{2}}}\right)}{\color{blue}{{b}^{2}}} \]
  7. Applied rewrites18.0%

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

    \[\leadsto 0.25 \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{\frac{1}{1049760000} \cdot {\pi}^{4}} + \frac{-1}{32400} \cdot {\pi}^{2}\right)\right)}}{b \cdot \color{blue}{\left|y-scale\right|}}\right) \]
  9. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{1}{4} \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{\frac{1}{1049760000} \cdot {\mathsf{PI}\left(\right)}^{4}} + \frac{-1}{32400} \cdot {\mathsf{PI}\left(\right)}^{2}\right)\right)}}{b \cdot \left|y-scale\right|}\right) \]
  10. Applied rewrites8.3%

    \[\leadsto 0.25 \cdot \left(\frac{a \cdot \left(y-scale \cdot y-scale\right)}{b} \cdot \frac{angle \cdot \sqrt{-8 \cdot \left({b}^{4} \cdot \left(\sqrt{9.525986892242036 \cdot 10^{-10} \cdot {\pi}^{4}} + -3.08641975308642 \cdot 10^{-5} \cdot {\pi}^{2}\right)\right)}}{b \cdot \color{blue}{\left|y-scale\right|}}\right) \]
  11. Add Preprocessing

Reproduce

?
herbie shell --seed 2025183 
(FPCore (a b angle x-scale y-scale)
  :name "b 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))))