Average Error: 40.8 → 5.3
Time: 1.8min
Precision: binary64
Cost: 160196
\[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} \cdot \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{y-scale}}{y-scale} \]
\[\begin{array}{l} t_0 := \frac{b}{y-scale} \cdot \frac{a}{x-scale}\\ t_1 := \frac{angle}{180} \cdot \pi\\ t_2 := \sin t_1\\ t_3 := \frac{b}{\frac{x-scale \cdot y-scale}{a}}\\ t_4 := \cos t_1\\ t_5 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_2\right) \cdot t_4}{x-scale}}{y-scale}\\ \mathbf{if}\;t_5 \cdot t_5 + \frac{\frac{{\left(a \cdot t_4\right)}^{2} + {\left(b \cdot t_2\right)}^{2}}{y-scale}}{y-scale} \cdot \left(\frac{\frac{{\left(a \cdot t_2\right)}^{2} + {\left(b \cdot t_4\right)}^{2}}{x-scale}}{x-scale} \cdot -4\right) \leq 0:\\ \;\;\;\;-4 \cdot \left(t_0 \cdot t_0\right)\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(t_3 \cdot t_3\right)\\ \end{array} \]
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (-
  (*
   (/
    (/
     (*
      (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) PI)))
      (cos (* (/ angle 180.0) PI)))
     x-scale)
    y-scale)
   (/
    (/
     (*
      (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) PI)))
      (cos (* (/ angle 180.0) PI)))
     x-scale)
    y-scale))
  (*
   (*
    4.0
    (/
     (/
      (+
       (pow (* a (sin (* (/ angle 180.0) PI))) 2.0)
       (pow (* b (cos (* (/ angle 180.0) PI))) 2.0))
      x-scale)
     x-scale))
   (/
    (/
     (+
      (pow (* a (cos (* (/ angle 180.0) PI))) 2.0)
      (pow (* b (sin (* (/ angle 180.0) PI))) 2.0))
     y-scale)
    y-scale))))
(FPCore (a b angle x-scale y-scale)
 :precision binary64
 (let* ((t_0 (* (/ b y-scale) (/ a x-scale)))
        (t_1 (* (/ angle 180.0) PI))
        (t_2 (sin t_1))
        (t_3 (/ b (/ (* x-scale y-scale) a)))
        (t_4 (cos t_1))
        (t_5
         (/
          (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_2) t_4) x-scale)
          y-scale)))
   (if (<=
        (+
         (* t_5 t_5)
         (*
          (/ (/ (+ (pow (* a t_4) 2.0) (pow (* b t_2) 2.0)) y-scale) y-scale)
          (*
           (/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_4) 2.0)) x-scale) x-scale)
           -4.0)))
        0.0)
     (* -4.0 (* t_0 t_0))
     (* -4.0 (* t_3 t_3)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return ((((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(((angle / 180.0) * ((double) M_PI)))) * cos(((angle / 180.0) * ((double) M_PI)))) / x_45_scale) / y_45_scale) * (((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(((angle / 180.0) * ((double) M_PI)))) * cos(((angle / 180.0) * ((double) M_PI)))) / x_45_scale) / y_45_scale)) - ((4.0 * (((pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a * cos(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * sin(((angle / 180.0) * ((double) M_PI)))), 2.0)) / y_45_scale) / y_45_scale));
}
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = (b / y_45_scale) * (a / x_45_scale);
	double t_1 = (angle / 180.0) * ((double) M_PI);
	double t_2 = sin(t_1);
	double t_3 = b / ((x_45_scale * y_45_scale) / a);
	double t_4 = cos(t_1);
	double t_5 = ((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_2) * t_4) / x_45_scale) / y_45_scale;
	double tmp;
	if (((t_5 * t_5) + ((((pow((a * t_4), 2.0) + pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale) * ((((pow((a * t_2), 2.0) + pow((b * t_4), 2.0)) / x_45_scale) / x_45_scale) * -4.0))) <= 0.0) {
		tmp = -4.0 * (t_0 * t_0);
	} else {
		tmp = -4.0 * (t_3 * t_3);
	}
	return tmp;
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	return ((((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(((angle / 180.0) * Math.PI))) * Math.cos(((angle / 180.0) * Math.PI))) / x_45_scale) / y_45_scale) * (((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(((angle / 180.0) * Math.PI))) * Math.cos(((angle / 180.0) * Math.PI))) / x_45_scale) / y_45_scale)) - ((4.0 * (((Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a * Math.cos(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.sin(((angle / 180.0) * Math.PI))), 2.0)) / y_45_scale) / y_45_scale));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
	double t_0 = (b / y_45_scale) * (a / x_45_scale);
	double t_1 = (angle / 180.0) * Math.PI;
	double t_2 = Math.sin(t_1);
	double t_3 = b / ((x_45_scale * y_45_scale) / a);
	double t_4 = Math.cos(t_1);
	double t_5 = ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_2) * t_4) / x_45_scale) / y_45_scale;
	double tmp;
	if (((t_5 * t_5) + ((((Math.pow((a * t_4), 2.0) + Math.pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale) * ((((Math.pow((a * t_2), 2.0) + Math.pow((b * t_4), 2.0)) / x_45_scale) / x_45_scale) * -4.0))) <= 0.0) {
		tmp = -4.0 * (t_0 * t_0);
	} else {
		tmp = -4.0 * (t_3 * t_3);
	}
	return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale):
	return ((((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(((angle / 180.0) * math.pi))) * math.cos(((angle / 180.0) * math.pi))) / x_45_scale) / y_45_scale) * (((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(((angle / 180.0) * math.pi))) * math.cos(((angle / 180.0) * math.pi))) / x_45_scale) / y_45_scale)) - ((4.0 * (((math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a * math.cos(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.sin(((angle / 180.0) * math.pi))), 2.0)) / y_45_scale) / y_45_scale))
def code(a, b, angle, x_45_scale, y_45_scale):
	t_0 = (b / y_45_scale) * (a / x_45_scale)
	t_1 = (angle / 180.0) * math.pi
	t_2 = math.sin(t_1)
	t_3 = b / ((x_45_scale * y_45_scale) / a)
	t_4 = math.cos(t_1)
	t_5 = ((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_2) * t_4) / x_45_scale) / y_45_scale
	tmp = 0
	if ((t_5 * t_5) + ((((math.pow((a * t_4), 2.0) + math.pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale) * ((((math.pow((a * t_2), 2.0) + math.pow((b * t_4), 2.0)) / x_45_scale) / x_45_scale) * -4.0))) <= 0.0:
		tmp = -4.0 * (t_0 * t_0)
	else:
		tmp = -4.0 * (t_3 * t_3)
	return tmp
function code(a, b, angle, x_45_scale, y_45_scale)
	return Float64(Float64(Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(Float64(Float64(angle / 180.0) * pi))) * cos(Float64(Float64(angle / 180.0) * pi))) / x_45_scale) / y_45_scale) * Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(Float64(Float64(angle / 180.0) * pi))) * cos(Float64(Float64(angle / 180.0) * pi))) / x_45_scale) / y_45_scale)) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) / y_45_scale) / y_45_scale)))
end
function code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = Float64(Float64(b / y_45_scale) * Float64(a / x_45_scale))
	t_1 = Float64(Float64(angle / 180.0) * pi)
	t_2 = sin(t_1)
	t_3 = Float64(b / Float64(Float64(x_45_scale * y_45_scale) / a))
	t_4 = cos(t_1)
	t_5 = Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_2) * t_4) / x_45_scale) / y_45_scale)
	tmp = 0.0
	if (Float64(Float64(t_5 * t_5) + Float64(Float64(Float64(Float64((Float64(a * t_4) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / y_45_scale) / y_45_scale) * Float64(Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_4) ^ 2.0)) / x_45_scale) / x_45_scale) * -4.0))) <= 0.0)
		tmp = Float64(-4.0 * Float64(t_0 * t_0));
	else
		tmp = Float64(-4.0 * Float64(t_3 * t_3));
	end
	return tmp
end
function tmp = code(a, b, angle, x_45_scale, y_45_scale)
	tmp = ((((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(((angle / 180.0) * pi))) * cos(((angle / 180.0) * pi))) / x_45_scale) / y_45_scale) * (((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(((angle / 180.0) * pi))) * cos(((angle / 180.0) * pi))) / x_45_scale) / y_45_scale)) - ((4.0 * (((((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos(((angle / 180.0) * pi))) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a * cos(((angle / 180.0) * pi))) ^ 2.0) + ((b * sin(((angle / 180.0) * pi))) ^ 2.0)) / y_45_scale) / y_45_scale));
end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale)
	t_0 = (b / y_45_scale) * (a / x_45_scale);
	t_1 = (angle / 180.0) * pi;
	t_2 = sin(t_1);
	t_3 = b / ((x_45_scale * y_45_scale) / a);
	t_4 = cos(t_1);
	t_5 = ((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_2) * t_4) / x_45_scale) / y_45_scale;
	tmp = 0.0;
	if (((t_5 * t_5) + ((((((a * t_4) ^ 2.0) + ((b * t_2) ^ 2.0)) / y_45_scale) / y_45_scale) * ((((((a * t_2) ^ 2.0) + ((b * t_4) ^ 2.0)) / x_45_scale) / x_45_scale) * -4.0))) <= 0.0)
		tmp = -4.0 * (t_0 * t_0);
	else
		tmp = -4.0 * (t_3 * t_3);
	end
	tmp_2 = tmp;
end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(b / y$45$scale), $MachinePrecision] * N[(a / x$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[(b / N[(N[(x$45$scale * y$45$scale), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Cos[t$95$1], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$4), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$5 * t$95$5), $MachinePrecision] + N[(N[(N[(N[(N[Power[N[(a * t$95$4), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$2), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(N[(N[(N[(N[Power[N[(a * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$4), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(-4.0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(t$95$3 * t$95$3), $MachinePrecision]), $MachinePrecision]]]]]]]]
\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} \cdot \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{y-scale}}{y-scale}
\begin{array}{l}
t_0 := \frac{b}{y-scale} \cdot \frac{a}{x-scale}\\
t_1 := \frac{angle}{180} \cdot \pi\\
t_2 := \sin t_1\\
t_3 := \frac{b}{\frac{x-scale \cdot y-scale}{a}}\\
t_4 := \cos t_1\\
t_5 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_2\right) \cdot t_4}{x-scale}}{y-scale}\\
\mathbf{if}\;t_5 \cdot t_5 + \frac{\frac{{\left(a \cdot t_4\right)}^{2} + {\left(b \cdot t_2\right)}^{2}}{y-scale}}{y-scale} \cdot \left(\frac{\frac{{\left(a \cdot t_2\right)}^{2} + {\left(b \cdot t_4\right)}^{2}}{x-scale}}{x-scale} \cdot -4\right) \leq 0:\\
\;\;\;\;-4 \cdot \left(t_0 \cdot t_0\right)\\

\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(t_3 \cdot t_3\right)\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 2 (-.f64 (pow.f64 b 2) (pow.f64 a 2))) (sin.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 2 (-.f64 (pow.f64 b 2) (pow.f64 a 2))) (sin.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 4 (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) 2) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) 2)) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) 2) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) 2)) y-scale) y-scale))) < 0.0

    1. Initial program 14.8

      \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} \cdot \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{y-scale}}{y-scale} \]
    2. Taylor expanded in angle around 0 19.4

      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{y-scale}^{2} \cdot {x-scale}^{2}}} \]
    3. Simplified11.0

      \[\leadsto \color{blue}{-4 \cdot \frac{b \cdot b}{\frac{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)}{a \cdot a}}} \]
      Proof
      (*.f64 -4 (/.f64 (*.f64 b b) (/.f64 (*.f64 (*.f64 y-scale x-scale) (*.f64 y-scale x-scale)) (*.f64 a a)))): 0 points increase in error, 0 points decrease in error
      (*.f64 -4 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 b 2)) (/.f64 (*.f64 (*.f64 y-scale x-scale) (*.f64 y-scale x-scale)) (*.f64 a a)))): 0 points increase in error, 0 points decrease in error
      (*.f64 -4 (/.f64 (pow.f64 b 2) (/.f64 (Rewrite<= unswap-sqr_binary64 (*.f64 (*.f64 y-scale y-scale) (*.f64 x-scale x-scale))) (*.f64 a a)))): 42 points increase in error, 2 points decrease in error
      (*.f64 -4 (/.f64 (pow.f64 b 2) (/.f64 (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 y-scale 2)) (*.f64 x-scale x-scale)) (*.f64 a a)))): 0 points increase in error, 0 points decrease in error
      (*.f64 -4 (/.f64 (pow.f64 b 2) (/.f64 (*.f64 (pow.f64 y-scale 2) (Rewrite<= unpow2_binary64 (pow.f64 x-scale 2))) (*.f64 a a)))): 0 points increase in error, 0 points decrease in error
      (*.f64 -4 (/.f64 (pow.f64 b 2) (/.f64 (*.f64 (pow.f64 y-scale 2) (pow.f64 x-scale 2)) (Rewrite<= unpow2_binary64 (pow.f64 a 2))))): 0 points increase in error, 0 points decrease in error
      (*.f64 -4 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (pow.f64 b 2) (pow.f64 a 2)) (*.f64 (pow.f64 y-scale 2) (pow.f64 x-scale 2))))): 11 points increase in error, 6 points decrease in error
      (*.f64 -4 (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 (pow.f64 a 2) (pow.f64 b 2))) (*.f64 (pow.f64 y-scale 2) (pow.f64 x-scale 2)))): 0 points increase in error, 0 points decrease in error
    4. Applied egg-rr0.7

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

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

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

    if 0.0 < (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 2 (-.f64 (pow.f64 b 2) (pow.f64 a 2))) (sin.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 2 (-.f64 (pow.f64 b 2) (pow.f64 a 2))) (sin.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 4 (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) 2) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) 2)) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) 2) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle 180) (PI.f64)))) 2)) y-scale) y-scale)))

    1. Initial program 63.5

      \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} \cdot \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{y-scale}}{y-scale} \]
    2. Taylor expanded in angle around 0 56.6

      \[\leadsto \color{blue}{-4 \cdot \frac{{a}^{2} \cdot {b}^{2}}{{y-scale}^{2} \cdot {x-scale}^{2}}} \]
    3. Simplified48.7

      \[\leadsto \color{blue}{-4 \cdot \frac{b \cdot b}{\frac{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)}{a \cdot a}}} \]
      Proof
      (*.f64 -4 (/.f64 (*.f64 b b) (/.f64 (*.f64 (*.f64 y-scale x-scale) (*.f64 y-scale x-scale)) (*.f64 a a)))): 0 points increase in error, 0 points decrease in error
      (*.f64 -4 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 b 2)) (/.f64 (*.f64 (*.f64 y-scale x-scale) (*.f64 y-scale x-scale)) (*.f64 a a)))): 0 points increase in error, 0 points decrease in error
      (*.f64 -4 (/.f64 (pow.f64 b 2) (/.f64 (Rewrite<= unswap-sqr_binary64 (*.f64 (*.f64 y-scale y-scale) (*.f64 x-scale x-scale))) (*.f64 a a)))): 42 points increase in error, 2 points decrease in error
      (*.f64 -4 (/.f64 (pow.f64 b 2) (/.f64 (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 y-scale 2)) (*.f64 x-scale x-scale)) (*.f64 a a)))): 0 points increase in error, 0 points decrease in error
      (*.f64 -4 (/.f64 (pow.f64 b 2) (/.f64 (*.f64 (pow.f64 y-scale 2) (Rewrite<= unpow2_binary64 (pow.f64 x-scale 2))) (*.f64 a a)))): 0 points increase in error, 0 points decrease in error
      (*.f64 -4 (/.f64 (pow.f64 b 2) (/.f64 (*.f64 (pow.f64 y-scale 2) (pow.f64 x-scale 2)) (Rewrite<= unpow2_binary64 (pow.f64 a 2))))): 0 points increase in error, 0 points decrease in error
      (*.f64 -4 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (pow.f64 b 2) (pow.f64 a 2)) (*.f64 (pow.f64 y-scale 2) (pow.f64 x-scale 2))))): 11 points increase in error, 6 points decrease in error
      (*.f64 -4 (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 (pow.f64 a 2) (pow.f64 b 2))) (*.f64 (pow.f64 y-scale 2) (pow.f64 x-scale 2)))): 0 points increase in error, 0 points decrease in error
    4. Applied egg-rr50.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} \cdot \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} + \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} \cdot \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} \cdot -4\right) \leq 0:\\ \;\;\;\;-4 \cdot \left(\left(\frac{b}{y-scale} \cdot \frac{a}{x-scale}\right) \cdot \left(\frac{b}{y-scale} \cdot \frac{a}{x-scale}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \left(\frac{b}{\frac{x-scale \cdot y-scale}{a}} \cdot \frac{b}{\frac{x-scale \cdot y-scale}{a}}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error10.4
Cost1484
\[\begin{array}{l} t_0 := -4 \cdot \left(\frac{b}{\frac{y-scale}{\frac{a}{x-scale}}} \cdot \frac{\frac{b}{\frac{y-scale}{a}}}{x-scale}\right)\\ t_1 := -4 \cdot \left(a \cdot \frac{b \cdot \left(a \cdot \frac{b}{x-scale \cdot y-scale}\right)}{x-scale \cdot y-scale}\right)\\ \mathbf{if}\;angle \leq -3.5636467661672496 \cdot 10^{-70}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;angle \leq 8.870073465405509 \cdot 10^{-111}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;angle \leq 2.323684774385835 \cdot 10^{+228}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error10.0
Cost1484
\[\begin{array}{l} t_0 := -4 \cdot \left(\frac{b}{\frac{y-scale}{\frac{a}{x-scale}}} \cdot \frac{\frac{b}{\frac{y-scale}{a}}}{x-scale}\right)\\ \mathbf{if}\;y-scale \leq -1 \cdot 10^{-200}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y-scale \leq 10^{-95}:\\ \;\;\;\;-4 \cdot \left(a \cdot \frac{b \cdot \left(a \cdot \frac{b}{x-scale \cdot y-scale}\right)}{x-scale \cdot y-scale}\right)\\ \mathbf{elif}\;y-scale \leq 9.4 \cdot 10^{+61}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-4 \cdot \frac{a \cdot \frac{b}{y-scale}}{x-scale \cdot \frac{y-scale}{b \cdot \frac{a}{x-scale}}}\\ \end{array} \]
Alternative 3
Error8.1
Cost1352
\[\begin{array}{l} t_0 := -4 \cdot \left(\frac{b}{\frac{y-scale}{\frac{a}{x-scale}}} \cdot \frac{b \cdot \frac{a}{x-scale}}{y-scale}\right)\\ \mathbf{if}\;angle \leq -3.5636467661672496 \cdot 10^{-70}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;angle \leq -8.149369021310754 \cdot 10^{-295}:\\ \;\;\;\;-4 \cdot \left(a \cdot \frac{b \cdot \left(a \cdot \frac{b}{x-scale \cdot y-scale}\right)}{x-scale \cdot y-scale}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error6.8
Cost1352
\[\begin{array}{l} t_0 := \frac{b}{y-scale} \cdot \frac{a}{x-scale}\\ t_1 := -4 \cdot \left(t_0 \cdot t_0\right)\\ \mathbf{if}\;angle \leq -3.5636467661672496 \cdot 10^{-70}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;angle \leq 5.333008866517566 \cdot 10^{-284}:\\ \;\;\;\;-4 \cdot \left(a \cdot \frac{b \cdot \left(a \cdot \frac{b}{x-scale \cdot y-scale}\right)}{x-scale \cdot y-scale}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error6.9
Cost1352
\[\begin{array}{l} t_0 := \frac{b}{y-scale} \cdot \frac{a}{x-scale}\\ t_1 := -4 \cdot \left(t_0 \cdot t_0\right)\\ \mathbf{if}\;angle \leq -1.4017548182835972 \cdot 10^{-127}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;angle \leq -1.5457937538102683 \cdot 10^{-256}:\\ \;\;\;\;-4 \cdot \left(a \cdot \left(\frac{a}{y-scale} \cdot \left(\frac{b}{x-scale \cdot y-scale} \cdot \frac{b}{x-scale}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error10.5
Cost1088
\[-4 \cdot \left(\frac{b}{\frac{y-scale}{\frac{a}{x-scale}}} \cdot \frac{\frac{b}{\frac{y-scale}{a}}}{x-scale}\right) \]
Alternative 7
Error30.6
Cost64
\[0 \]

Error

Reproduce

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