Average Error: 40.5 → 6.1
Time: 1.7min
Precision: binary64
Cost: 173000
\[\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{angle}{180} \cdot \pi\\ t_1 := \sin t_0\\ t_2 := \cos t_0\\ t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_1\right) \cdot t_2}{x-scale}}{y-scale}\\ \mathbf{if}\;t_3 \cdot t_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t_1\right)}^{2} + {\left(b \cdot t_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t_2\right)}^{2} + {\left(b \cdot t_1\right)}^{2}}{y-scale}}{y-scale} \leq 5 \cdot 10^{+127}:\\ \;\;\;\;a \cdot \left(\left(\frac{a}{x-scale \cdot y-scale} \cdot \left(-4 \cdot b\right)\right) \cdot \frac{\frac{b}{x-scale}}{y-scale}\right)\\ \mathbf{elif}\;{\left(b \cdot a\right)}^{2} \ne 0:\\ \;\;\;\;\frac{-4}{{\left(\frac{y-scale \cdot x-scale}{b \cdot a}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{b}{x-scale} \cdot a\right)}^{2}}{y-scale} \cdot \frac{-4}{y-scale}\\ \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 (* (/ angle 180.0) PI))
        (t_1 (sin t_0))
        (t_2 (cos t_0))
        (t_3
         (/
          (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
          y-scale)))
   (if (<=
        (-
         (* t_3 t_3)
         (*
          (*
           4.0
           (/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
          (/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale)))
        5e+127)
     (*
      a
      (* (* (/ a (* x-scale y-scale)) (* -4.0 b)) (/ (/ b x-scale) y-scale)))
     (if (!= (pow (* b a) 2.0) 0.0)
       (/ -4.0 (pow (/ (* y-scale x-scale) (* b a)) 2.0))
       (* (/ (pow (* (/ b x-scale) a) 2.0) y-scale) (/ -4.0 y-scale))))))
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 = (angle / 180.0) * ((double) M_PI);
	double t_1 = sin(t_0);
	double t_2 = cos(t_0);
	double t_3 = ((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	double tmp;
	if (((t_3 * t_3) - ((4.0 * (((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a * t_2), 2.0) + pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale))) <= 5e+127) {
		tmp = a * (((a / (x_45_scale * y_45_scale)) * (-4.0 * b)) * ((b / x_45_scale) / y_45_scale));
	} else if (pow((b * a), 2.0) != 0.0) {
		tmp = -4.0 / pow(((y_45_scale * x_45_scale) / (b * a)), 2.0);
	} else {
		tmp = (pow(((b / x_45_scale) * a), 2.0) / y_45_scale) * (-4.0 / y_45_scale);
	}
	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 = (angle / 180.0) * Math.PI;
	double t_1 = Math.sin(t_0);
	double t_2 = Math.cos(t_0);
	double t_3 = ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	double tmp;
	if (((t_3 * t_3) - ((4.0 * (((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale))) <= 5e+127) {
		tmp = a * (((a / (x_45_scale * y_45_scale)) * (-4.0 * b)) * ((b / x_45_scale) / y_45_scale));
	} else if (Math.pow((b * a), 2.0) != 0.0) {
		tmp = -4.0 / Math.pow(((y_45_scale * x_45_scale) / (b * a)), 2.0);
	} else {
		tmp = (Math.pow(((b / x_45_scale) * a), 2.0) / y_45_scale) * (-4.0 / y_45_scale);
	}
	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 = (angle / 180.0) * math.pi
	t_1 = math.sin(t_0)
	t_2 = math.cos(t_0)
	t_3 = ((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale
	tmp = 0
	if ((t_3 * t_3) - ((4.0 * (((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale))) <= 5e+127:
		tmp = a * (((a / (x_45_scale * y_45_scale)) * (-4.0 * b)) * ((b / x_45_scale) / y_45_scale))
	elif math.pow((b * a), 2.0) != 0.0:
		tmp = -4.0 / math.pow(((y_45_scale * x_45_scale) / (b * a)), 2.0)
	else:
		tmp = (math.pow(((b / x_45_scale) * a), 2.0) / y_45_scale) * (-4.0 / y_45_scale)
	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(angle / 180.0) * pi)
	t_1 = sin(t_0)
	t_2 = cos(t_0)
	t_3 = Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale)
	tmp = 0.0
	if (Float64(Float64(t_3 * t_3) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale))) <= 5e+127)
		tmp = Float64(a * Float64(Float64(Float64(a / Float64(x_45_scale * y_45_scale)) * Float64(-4.0 * b)) * Float64(Float64(b / x_45_scale) / y_45_scale)));
	elseif ((Float64(b * a) ^ 2.0) != 0.0)
		tmp = Float64(-4.0 / (Float64(Float64(y_45_scale * x_45_scale) / Float64(b * a)) ^ 2.0));
	else
		tmp = Float64(Float64((Float64(Float64(b / x_45_scale) * a) ^ 2.0) / y_45_scale) * Float64(-4.0 / y_45_scale));
	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 = (angle / 180.0) * pi;
	t_1 = sin(t_0);
	t_2 = cos(t_0);
	t_3 = ((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
	tmp = 0.0;
	if (((t_3 * t_3) - ((4.0 * (((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale))) <= 5e+127)
		tmp = a * (((a / (x_45_scale * y_45_scale)) * (-4.0 * b)) * ((b / x_45_scale) / y_45_scale));
	elseif (((b * a) ^ 2.0) ~= 0.0)
		tmp = -4.0 / (((y_45_scale * x_45_scale) / (b * a)) ^ 2.0);
	else
		tmp = ((((b / x_45_scale) * a) ^ 2.0) / y_45_scale) * (-4.0 / y_45_scale);
	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[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a * t$95$1), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$2), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$1), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+127], N[(a * N[(N[(N[(a / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(-4.0 * b), $MachinePrecision]), $MachinePrecision] * N[(N[(b / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Unequal[N[Power[N[(b * a), $MachinePrecision], 2.0], $MachinePrecision], 0.0], N[(-4.0 / N[Power[N[(N[(y$45$scale * x$45$scale), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(N[(b / x$45$scale), $MachinePrecision] * a), $MachinePrecision], 2.0], $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(-4.0 / y$45$scale), $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{angle}{180} \cdot \pi\\
t_1 := \sin t_0\\
t_2 := \cos t_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_1\right) \cdot t_2}{x-scale}}{y-scale}\\
\mathbf{if}\;t_3 \cdot t_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t_1\right)}^{2} + {\left(b \cdot t_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t_2\right)}^{2} + {\left(b \cdot t_1\right)}^{2}}{y-scale}}{y-scale} \leq 5 \cdot 10^{+127}:\\
\;\;\;\;a \cdot \left(\left(\frac{a}{x-scale \cdot y-scale} \cdot \left(-4 \cdot b\right)\right) \cdot \frac{\frac{b}{x-scale}}{y-scale}\right)\\

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

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


\end{array}

Error

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))) < 5.0000000000000004e127

    1. Initial program 20.0

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

      \[\leadsto \color{blue}{{\left(\frac{\frac{\left(\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)\right) \cdot \cos \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)}{x-scale}}{y-scale}\right)}^{2} + -4 \cdot \frac{\left({\left(a \cdot \sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)\right)}^{2}\right) \cdot \left({\left(a \cdot \cos \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)\right)}^{2}\right)}{\left(x-scale \cdot x-scale\right) \cdot \left(y-scale \cdot y-scale\right)}} \]
      Proof
    3. Taylor expanded in angle around 0 20.8

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

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

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

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

      \[\leadsto \color{blue}{a \cdot \left(\frac{-4 \cdot \left(b \cdot b\right)}{x-scale \cdot y-scale} \cdot \frac{a}{x-scale \cdot y-scale}\right)} \]
      Proof
    8. Applied egg-rr3.2

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

    if 5.0000000000000004e127 < (-.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 64.0

      \[\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} \cdot \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale} - \left(4 \cdot \frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{y-scale}}{y-scale} \]
    2. Simplified63.7

      \[\leadsto \color{blue}{{\left(\frac{\frac{\left(\left(2 \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right) \cdot \sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)\right) \cdot \cos \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)}{x-scale}}{y-scale}\right)}^{2} + -4 \cdot \frac{\left({\left(a \cdot \sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)\right)}^{2}\right) \cdot \left({\left(a \cdot \cos \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(angle \cdot 0.005555555555555556\right) \cdot \pi\right)\right)}^{2}\right)}{\left(x-scale \cdot x-scale\right) \cdot \left(y-scale \cdot y-scale\right)}} \]
      Proof
    3. Taylor expanded in angle around 0 60.3

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

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

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;{\left(b \cdot a\right)}^{2} \ne 0:\\ \;\;\;\;\frac{-4}{{\left(\frac{y-scale \cdot x-scale}{b \cdot a}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-4}{y-scale \cdot y-scale} \cdot {\left(\frac{b \cdot a}{x-scale}\right)}^{2}\\ } \end{array}} \]
    6. Applied egg-rr9.7

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(b \cdot a\right)}^{2} \ne 0:\\ \;\;\;\;\frac{-4}{{\left(\frac{y-scale \cdot x-scale}{b \cdot a}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{b \cdot a}{x-scale}\right)}^{2}}{y-scale} \cdot \frac{-4}{y-scale}\\ \end{array} \]
    7. Applied egg-rr9.5

      \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(b \cdot a\right)}^{2} \ne 0:\\ \;\;\;\;\frac{-4}{{\left(\frac{y-scale \cdot x-scale}{b \cdot a}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{b}{x-scale} \cdot a\right)}^{2}}{y-scale} \cdot \frac{-4}{y-scale}\\ \end{array} \]
  3. Recombined 2 regimes into one program.

Alternatives

Alternative 1
Error5.7
Cost14156
\[\begin{array}{l} t_0 := \frac{\frac{b \cdot a}{x-scale}}{y-scale} \cdot \frac{\frac{-4 \cdot \left(b \cdot a\right)}{x-scale}}{y-scale}\\ \mathbf{if}\;x-scale \leq -2.3 \cdot 10^{-141}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x-scale \leq 5.4 \cdot 10^{-92}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;{\left(b \cdot a\right)}^{2} \ne 0:\\ \;\;\;\;\frac{-4}{{\left(\frac{y-scale \cdot x-scale}{b \cdot a}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-4}{y-scale \cdot y-scale} \cdot {\left(\frac{b}{x-scale} \cdot a\right)}^{2}\\ \end{array}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error12.4
Cost1616
\[\begin{array}{l} t_0 := \frac{\frac{b}{x-scale}}{y-scale}\\ t_1 := \frac{\frac{a}{y-scale}}{x-scale}\\ t_2 := \frac{a}{x-scale \cdot y-scale}\\ \mathbf{if}\;b \leq -2.2 \cdot 10^{-178}:\\ \;\;\;\;a \cdot \left(\left(t_2 \cdot \left(-4 \cdot b\right)\right) \cdot t_0\right)\\ \mathbf{elif}\;b \leq 1.2 \cdot 10^{-170}:\\ \;\;\;\;\left(b \cdot a\right) \cdot \left(\frac{b \cdot a}{y-scale} \cdot \frac{-4}{x-scale \cdot \left(x-scale \cdot y-scale\right)}\right)\\ \mathbf{elif}\;b \leq 1.1 \cdot 10^{-79}:\\ \;\;\;\;a \cdot \left(\left(-4 \cdot b\right) \cdot \left(t_0 \cdot t_2\right)\right)\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{+103}:\\ \;\;\;\;\left(-4 \cdot \left(b \cdot b\right)\right) \cdot \left(t_1 \cdot t_1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot a\right) \cdot \left(\frac{b}{x-scale \cdot y-scale} \cdot \frac{a \cdot -4}{x-scale \cdot y-scale}\right)\\ \end{array} \]
Alternative 3
Error11.6
Cost1484
\[\begin{array}{l} t_0 := a \cdot \left(\left(\frac{a}{x-scale \cdot y-scale} \cdot \left(-4 \cdot b\right)\right) \cdot \frac{\frac{b}{x-scale}}{y-scale}\right)\\ \mathbf{if}\;x-scale \leq -6.2 \cdot 10^{+141}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x-scale \leq -4.8 \cdot 10^{-101}:\\ \;\;\;\;\left(b \cdot a\right) \cdot \left(\frac{b}{y-scale} \cdot \frac{a \cdot -4}{x-scale \cdot \left(x-scale \cdot y-scale\right)}\right)\\ \mathbf{elif}\;x-scale \leq -1.65 \cdot 10^{-220}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot a\right) \cdot \left(\frac{b}{x-scale \cdot y-scale} \cdot \frac{a \cdot -4}{x-scale \cdot y-scale}\right)\\ \end{array} \]
Alternative 4
Error8.1
Cost1484
\[\begin{array}{l} t_0 := \frac{-4 \cdot \left(b \cdot a\right)}{x-scale} \cdot \frac{\frac{\frac{b \cdot a}{x-scale}}{y-scale}}{y-scale}\\ t_1 := \frac{a}{y-scale \cdot x-scale}\\ \mathbf{if}\;y-scale \leq -1.6 \cdot 10^{-187}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y-scale \leq 1.02 \cdot 10^{-220}:\\ \;\;\;\;\left(-4 \cdot b\right) \cdot \left(b \cdot \left(t_1 \cdot t_1\right)\right)\\ \mathbf{elif}\;y-scale \leq 1.25 \cdot 10^{+166}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot a\right) \cdot \left(\frac{b}{x-scale \cdot y-scale} \cdot \frac{a \cdot -4}{x-scale \cdot y-scale}\right)\\ \end{array} \]
Alternative 5
Error12.2
Cost1352
\[\begin{array}{l} t_0 := a \cdot \left(\left(\frac{a}{x-scale \cdot y-scale} \cdot \left(-4 \cdot b\right)\right) \cdot \frac{\frac{b}{x-scale}}{y-scale}\right)\\ t_1 := \frac{a}{y-scale \cdot x-scale}\\ \mathbf{if}\;b \leq 3.7 \cdot 10^{-68}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 6.2 \cdot 10^{+101}:\\ \;\;\;\;\left(-4 \cdot b\right) \cdot \left(b \cdot \left(t_1 \cdot t_1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error12.2
Cost1352
\[\begin{array}{l} t_0 := \frac{a}{y-scale \cdot x-scale}\\ \mathbf{if}\;b \leq 3.4 \cdot 10^{-68}:\\ \;\;\;\;a \cdot \left(\left(\frac{a}{x-scale \cdot y-scale} \cdot \left(-4 \cdot b\right)\right) \cdot \frac{\frac{b}{x-scale}}{y-scale}\right)\\ \mathbf{elif}\;b \leq 9.5 \cdot 10^{+113}:\\ \;\;\;\;\left(-4 \cdot b\right) \cdot \left(b \cdot \left(t_0 \cdot t_0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-4 \cdot b\right) \cdot \frac{\frac{\left(b \cdot a\right) \cdot a}{y-scale \cdot x-scale}}{y-scale \cdot x-scale}\\ \end{array} \]
Alternative 7
Error12.3
Cost1352
\[\begin{array}{l} t_0 := \frac{\frac{a}{y-scale}}{x-scale}\\ \mathbf{if}\;b \leq 1.6 \cdot 10^{-76}:\\ \;\;\;\;a \cdot \left(\left(\frac{a}{x-scale \cdot y-scale} \cdot \left(-4 \cdot b\right)\right) \cdot \frac{\frac{b}{x-scale}}{y-scale}\right)\\ \mathbf{elif}\;b \leq 9.2 \cdot 10^{+113}:\\ \;\;\;\;\left(-4 \cdot \left(b \cdot b\right)\right) \cdot \left(t_0 \cdot t_0\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-4 \cdot b\right) \cdot \frac{\frac{\left(b \cdot a\right) \cdot a}{y-scale \cdot x-scale}}{y-scale \cdot x-scale}\\ \end{array} \]
Alternative 8
Error13.0
Cost1352
\[\begin{array}{l} t_0 := \frac{\frac{a}{y-scale}}{x-scale}\\ \mathbf{if}\;b \leq 2 \cdot 10^{-79}:\\ \;\;\;\;a \cdot \left(\left(\frac{a}{x-scale \cdot y-scale} \cdot \left(-4 \cdot b\right)\right) \cdot \frac{\frac{b}{x-scale}}{y-scale}\right)\\ \mathbf{elif}\;b \leq 3.7 \cdot 10^{+98}:\\ \;\;\;\;\left(-4 \cdot \left(b \cdot b\right)\right) \cdot \left(t_0 \cdot t_0\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot a\right) \cdot \left(\frac{b}{y-scale} \cdot \frac{a \cdot -4}{x-scale \cdot \left(x-scale \cdot y-scale\right)}\right)\\ \end{array} \]
Alternative 9
Error6.2
Cost1220
\[\begin{array}{l} \mathbf{if}\;y-scale \leq 2 \cdot 10^{+166}:\\ \;\;\;\;\frac{\frac{b \cdot a}{x-scale}}{y-scale} \cdot \frac{\frac{-4 \cdot \left(b \cdot a\right)}{x-scale}}{y-scale}\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot a\right) \cdot \left(\frac{b}{x-scale \cdot y-scale} \cdot \frac{a \cdot -4}{x-scale \cdot y-scale}\right)\\ \end{array} \]
Alternative 10
Error13.4
Cost1088
\[a \cdot \left(\left(-4 \cdot b\right) \cdot \left(\frac{\frac{b}{x-scale}}{y-scale} \cdot \frac{a}{x-scale \cdot y-scale}\right)\right) \]
Alternative 11
Error12.5
Cost1088
\[a \cdot \left(\left(\frac{a}{x-scale \cdot y-scale} \cdot \left(-4 \cdot b\right)\right) \cdot \frac{\frac{b}{x-scale}}{y-scale}\right) \]

Error

Reproduce

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