
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI))
(t_1 (sin t_0))
(t_2 (cos t_0))
(t_3
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
y-scale)))
(-
(* t_3 t_3)
(*
(*
4.0
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * ((double) M_PI);
double t_1 = sin(t_0);
double t_2 = cos(t_0);
double t_3 = ((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
return (t_3 * t_3) - ((4.0 * (((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a * t_2), 2.0) + pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * Math.PI;
double t_1 = Math.sin(t_0);
double t_2 = Math.cos(t_0);
double t_3 = ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
return (t_3 * t_3) - ((4.0 * (((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (angle / 180.0) * math.pi t_1 = math.sin(t_0) t_2 = math.cos(t_0) t_3 = ((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale return (t_3 * t_3) - ((4.0 * (((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale))
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(angle / 180.0) * pi) t_1 = sin(t_0) t_2 = cos(t_0) t_3 = Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale) return Float64(Float64(t_3 * t_3) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale))) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (angle / 180.0) * pi; t_1 = sin(t_0); t_2 = cos(t_0); t_3 = ((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale; tmp = (t_3 * t_3) - ((4.0 * (((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale)); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a * t$95$1), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$2), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$1), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := \sin t_0\\
t_2 := \cos t_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_1\right) \cdot t_2}{x-scale}}{y-scale}\\
t_3 \cdot t_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t_1\right)}^{2} + {\left(b \cdot t_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t_2\right)}^{2} + {\left(b \cdot t_1\right)}^{2}}{y-scale}}{y-scale}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI))
(t_1 (sin t_0))
(t_2 (cos t_0))
(t_3
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
y-scale)))
(-
(* t_3 t_3)
(*
(*
4.0
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * ((double) M_PI);
double t_1 = sin(t_0);
double t_2 = cos(t_0);
double t_3 = ((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
return (t_3 * t_3) - ((4.0 * (((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a * t_2), 2.0) + pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * Math.PI;
double t_1 = Math.sin(t_0);
double t_2 = Math.cos(t_0);
double t_3 = ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
return (t_3 * t_3) - ((4.0 * (((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (angle / 180.0) * math.pi t_1 = math.sin(t_0) t_2 = math.cos(t_0) t_3 = ((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale return (t_3 * t_3) - ((4.0 * (((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale))
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(angle / 180.0) * pi) t_1 = sin(t_0) t_2 = cos(t_0) t_3 = Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale) return Float64(Float64(t_3 * t_3) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale))) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (angle / 180.0) * pi; t_1 = sin(t_0); t_2 = cos(t_0); t_3 = ((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale; tmp = (t_3 * t_3) - ((4.0 * (((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale)); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a * t$95$1), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$2), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$1), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := \sin t_0\\
t_2 := \cos t_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_1\right) \cdot t_2}{x-scale}}{y-scale}\\
t_3 \cdot t_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t_1\right)}^{2} + {\left(b \cdot t_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t_2\right)}^{2} + {\left(b \cdot t_1\right)}^{2}}{y-scale}}{y-scale}
\end{array}
\end{array}
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ a y-scale) (/ b x-scale)))
(t_1 (* (/ angle 180.0) PI))
(t_2 (sin t_1))
(t_3 (cos t_1))
(t_4
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_2) t_3) x-scale)
y-scale)))
(if (<=
(-
(* t_4 t_4)
(*
(*
4.0
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_3) 2.0)) x-scale) x-scale))
(/ (/ (+ (pow (* a t_3) 2.0) (pow (* b t_2) 2.0)) y-scale) y-scale)))
1e+182)
(* t_0 (* -4.0 t_0))
(* -4.0 (pow (/ (* b a) (* x-scale y-scale)) 2.0)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (a / y_45_scale) * (b / x_45_scale);
double t_1 = (angle / 180.0) * ((double) M_PI);
double t_2 = sin(t_1);
double t_3 = cos(t_1);
double t_4 = ((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_2) * t_3) / x_45_scale) / y_45_scale;
double tmp;
if (((t_4 * t_4) - ((4.0 * (((pow((a * t_2), 2.0) + pow((b * t_3), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a * t_3), 2.0) + pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale))) <= 1e+182) {
tmp = t_0 * (-4.0 * t_0);
} else {
tmp = -4.0 * pow(((b * a) / (x_45_scale * y_45_scale)), 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 = (a / y_45_scale) * (b / x_45_scale);
double t_1 = (angle / 180.0) * Math.PI;
double t_2 = Math.sin(t_1);
double t_3 = Math.cos(t_1);
double t_4 = ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_2) * t_3) / x_45_scale) / y_45_scale;
double tmp;
if (((t_4 * t_4) - ((4.0 * (((Math.pow((a * t_2), 2.0) + Math.pow((b * t_3), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a * t_3), 2.0) + Math.pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale))) <= 1e+182) {
tmp = t_0 * (-4.0 * t_0);
} else {
tmp = -4.0 * Math.pow(((b * a) / (x_45_scale * y_45_scale)), 2.0);
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (a / y_45_scale) * (b / x_45_scale) t_1 = (angle / 180.0) * math.pi t_2 = math.sin(t_1) t_3 = math.cos(t_1) t_4 = ((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_2) * t_3) / x_45_scale) / y_45_scale tmp = 0 if ((t_4 * t_4) - ((4.0 * (((math.pow((a * t_2), 2.0) + math.pow((b * t_3), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a * t_3), 2.0) + math.pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale))) <= 1e+182: tmp = t_0 * (-4.0 * t_0) else: tmp = -4.0 * math.pow(((b * a) / (x_45_scale * y_45_scale)), 2.0) return tmp
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(a / y_45_scale) * Float64(b / x_45_scale)) t_1 = Float64(Float64(angle / 180.0) * pi) t_2 = sin(t_1) t_3 = cos(t_1) t_4 = Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_2) * t_3) / x_45_scale) / y_45_scale) tmp = 0.0 if (Float64(Float64(t_4 * t_4) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_3) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a * t_3) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / y_45_scale) / y_45_scale))) <= 1e+182) tmp = Float64(t_0 * Float64(-4.0 * t_0)); else tmp = Float64(-4.0 * (Float64(Float64(b * a) / Float64(x_45_scale * y_45_scale)) ^ 2.0)); end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (a / y_45_scale) * (b / x_45_scale); t_1 = (angle / 180.0) * pi; t_2 = sin(t_1); t_3 = cos(t_1); t_4 = ((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_2) * t_3) / x_45_scale) / y_45_scale; tmp = 0.0; if (((t_4 * t_4) - ((4.0 * (((((a * t_2) ^ 2.0) + ((b * t_3) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a * t_3) ^ 2.0) + ((b * t_2) ^ 2.0)) / y_45_scale) / y_45_scale))) <= 1e+182) tmp = t_0 * (-4.0 * t_0); else tmp = -4.0 * (((b * a) / (x_45_scale * y_45_scale)) ^ 2.0); end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(a / y$45$scale), $MachinePrecision] * N[(b / 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[Cos[t$95$1], $MachinePrecision]}, Block[{t$95$4 = 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$3), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$4 * t$95$4), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$3), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a * t$95$3), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$2), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+182], N[(t$95$0 * N[(-4.0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[Power[N[(N[(b * a), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{y-scale} \cdot \frac{b}{x-scale}\\
t_1 := \frac{angle}{180} \cdot \pi\\
t_2 := \sin t_1\\
t_3 := \cos t_1\\
t_4 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_2\right) \cdot t_3}{x-scale}}{y-scale}\\
\mathbf{if}\;t_4 \cdot t_4 - \left(4 \cdot \frac{\frac{{\left(a \cdot t_2\right)}^{2} + {\left(b \cdot t_3\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t_3\right)}^{2} + {\left(b \cdot t_2\right)}^{2}}{y-scale}}{y-scale} \leq 10^{+182}:\\
\;\;\;\;t_0 \cdot \left(-4 \cdot t_0\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot {\left(\frac{b \cdot a}{x-scale \cdot y-scale}\right)}^{2}\\
\end{array}
\end{array}
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))) < 1.0000000000000001e182Initial program 62.6%
Taylor expanded in angle around 0 70.7%
times-frac72.6%
unpow272.6%
unpow272.6%
unpow272.6%
unpow272.6%
Simplified72.6%
pow272.6%
frac-times70.7%
pow270.7%
pow270.7%
pow270.7%
associate-*r/70.8%
pow-prod-down71.6%
pow-prod-down79.2%
Applied egg-rr79.2%
associate-/l*78.7%
div-inv78.7%
clear-num79.1%
pow-prod-down78.1%
pow278.1%
unpow278.1%
swap-sqr70.7%
frac-times72.6%
unpow272.6%
frac-times82.0%
add-sqr-sqrt82.0%
associate-*r*82.0%
Applied egg-rr99.8%
if 1.0000000000000001e182 < (-.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))) Initial program 0.0%
Taylor expanded in angle around 0 31.9%
times-frac31.2%
unpow231.2%
unpow231.2%
unpow231.2%
unpow231.2%
Simplified31.2%
pow231.2%
frac-times31.9%
pow231.9%
pow231.9%
pow231.9%
associate-*r/31.9%
pow-prod-down54.0%
pow-prod-down74.4%
Applied egg-rr74.4%
Taylor expanded in a around 0 31.9%
associate-*r/31.9%
unpow231.9%
unpow231.9%
swap-sqr54.0%
unpow254.0%
*-commutative54.0%
unpow254.0%
unpow254.0%
swap-sqr74.4%
unpow274.4%
associate-*l/74.4%
Simplified95.5%
Final simplification97.1%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(if (or (<= b 3e-166) (not (<= b 2.05e+101)))
(* -4.0 (* (* (/ b x-scale) (/ b x-scale)) (* (/ a y-scale) (/ a y-scale))))
(*
-4.0
(* (/ (* b b) (* x-scale y-scale)) (/ (* a a) (* x-scale y-scale))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if ((b <= 3e-166) || !(b <= 2.05e+101)) {
tmp = -4.0 * (((b / x_45_scale) * (b / x_45_scale)) * ((a / y_45_scale) * (a / y_45_scale)));
} else {
tmp = -4.0 * (((b * b) / (x_45_scale * y_45_scale)) * ((a * a) / (x_45_scale * y_45_scale)));
}
return tmp;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: tmp
if ((b <= 3d-166) .or. (.not. (b <= 2.05d+101))) then
tmp = (-4.0d0) * (((b / x_45scale) * (b / x_45scale)) * ((a / y_45scale) * (a / y_45scale)))
else
tmp = (-4.0d0) * (((b * b) / (x_45scale * y_45scale)) * ((a * a) / (x_45scale * y_45scale)))
end if
code = tmp
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if ((b <= 3e-166) || !(b <= 2.05e+101)) {
tmp = -4.0 * (((b / x_45_scale) * (b / x_45_scale)) * ((a / y_45_scale) * (a / y_45_scale)));
} else {
tmp = -4.0 * (((b * b) / (x_45_scale * y_45_scale)) * ((a * a) / (x_45_scale * y_45_scale)));
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): tmp = 0 if (b <= 3e-166) or not (b <= 2.05e+101): tmp = -4.0 * (((b / x_45_scale) * (b / x_45_scale)) * ((a / y_45_scale) * (a / y_45_scale))) else: tmp = -4.0 * (((b * b) / (x_45_scale * y_45_scale)) * ((a * a) / (x_45_scale * y_45_scale))) return tmp
function code(a, b, angle, x_45_scale, y_45_scale) tmp = 0.0 if ((b <= 3e-166) || !(b <= 2.05e+101)) tmp = Float64(-4.0 * Float64(Float64(Float64(b / x_45_scale) * Float64(b / x_45_scale)) * Float64(Float64(a / y_45_scale) * Float64(a / y_45_scale)))); else tmp = Float64(-4.0 * Float64(Float64(Float64(b * b) / Float64(x_45_scale * y_45_scale)) * Float64(Float64(a * a) / Float64(x_45_scale * y_45_scale)))); end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) tmp = 0.0; if ((b <= 3e-166) || ~((b <= 2.05e+101))) tmp = -4.0 * (((b / x_45_scale) * (b / x_45_scale)) * ((a / y_45_scale) * (a / y_45_scale))); else tmp = -4.0 * (((b * b) / (x_45_scale * y_45_scale)) * ((a * a) / (x_45_scale * y_45_scale))); end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := If[Or[LessEqual[b, 3e-166], N[Not[LessEqual[b, 2.05e+101]], $MachinePrecision]], N[(-4.0 * N[(N[(N[(b / x$45$scale), $MachinePrecision] * N[(b / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(a / y$45$scale), $MachinePrecision] * N[(a / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(N[(N[(b * b), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3 \cdot 10^{-166} \lor \neg \left(b \leq 2.05 \cdot 10^{+101}\right):\\
\;\;\;\;-4 \cdot \left(\left(\frac{b}{x-scale} \cdot \frac{b}{x-scale}\right) \cdot \left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(\frac{b \cdot b}{x-scale \cdot y-scale} \cdot \frac{a \cdot a}{x-scale \cdot y-scale}\right)\\
\end{array}
\end{array}
if b < 3.0000000000000003e-166 or 2.05e101 < b Initial program 22.7%
Taylor expanded in angle around 0 44.9%
pow244.9%
pow244.9%
pow244.9%
frac-times45.4%
pow245.4%
*-commutative45.4%
times-frac59.7%
times-frac76.7%
Applied egg-rr76.7%
if 3.0000000000000003e-166 < b < 2.05e101Initial program 27.8%
Taylor expanded in angle around 0 53.3%
times-frac53.1%
unpow253.1%
unpow253.1%
unpow253.1%
unpow253.1%
Simplified53.1%
pow253.1%
associate-*r/55.6%
times-frac69.6%
pow269.6%
Applied egg-rr69.6%
associate-*r/67.1%
frac-times53.1%
unpow253.1%
frac-times53.3%
*-commutative53.3%
swap-sqr69.2%
times-frac84.8%
unpow284.8%
Applied egg-rr84.8%
Final simplification78.3%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(if (or (<= b 8.6e-181) (not (<= b 1.34e+154)))
(* -4.0 (* (* (/ b x-scale) (/ b x-scale)) (* (/ a y-scale) (/ a y-scale))))
(*
-4.0
(* (/ (/ a y-scale) x-scale) (/ (* (/ a y-scale) (* b b)) x-scale)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if ((b <= 8.6e-181) || !(b <= 1.34e+154)) {
tmp = -4.0 * (((b / x_45_scale) * (b / x_45_scale)) * ((a / y_45_scale) * (a / y_45_scale)));
} else {
tmp = -4.0 * (((a / y_45_scale) / x_45_scale) * (((a / y_45_scale) * (b * b)) / x_45_scale));
}
return tmp;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: tmp
if ((b <= 8.6d-181) .or. (.not. (b <= 1.34d+154))) then
tmp = (-4.0d0) * (((b / x_45scale) * (b / x_45scale)) * ((a / y_45scale) * (a / y_45scale)))
else
tmp = (-4.0d0) * (((a / y_45scale) / x_45scale) * (((a / y_45scale) * (b * b)) / x_45scale))
end if
code = tmp
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if ((b <= 8.6e-181) || !(b <= 1.34e+154)) {
tmp = -4.0 * (((b / x_45_scale) * (b / x_45_scale)) * ((a / y_45_scale) * (a / y_45_scale)));
} else {
tmp = -4.0 * (((a / y_45_scale) / x_45_scale) * (((a / y_45_scale) * (b * b)) / x_45_scale));
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): tmp = 0 if (b <= 8.6e-181) or not (b <= 1.34e+154): tmp = -4.0 * (((b / x_45_scale) * (b / x_45_scale)) * ((a / y_45_scale) * (a / y_45_scale))) else: tmp = -4.0 * (((a / y_45_scale) / x_45_scale) * (((a / y_45_scale) * (b * b)) / x_45_scale)) return tmp
function code(a, b, angle, x_45_scale, y_45_scale) tmp = 0.0 if ((b <= 8.6e-181) || !(b <= 1.34e+154)) tmp = Float64(-4.0 * Float64(Float64(Float64(b / x_45_scale) * Float64(b / x_45_scale)) * Float64(Float64(a / y_45_scale) * Float64(a / y_45_scale)))); else tmp = Float64(-4.0 * Float64(Float64(Float64(a / y_45_scale) / x_45_scale) * Float64(Float64(Float64(a / y_45_scale) * Float64(b * b)) / x_45_scale))); end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) tmp = 0.0; if ((b <= 8.6e-181) || ~((b <= 1.34e+154))) tmp = -4.0 * (((b / x_45_scale) * (b / x_45_scale)) * ((a / y_45_scale) * (a / y_45_scale))); else tmp = -4.0 * (((a / y_45_scale) / x_45_scale) * (((a / y_45_scale) * (b * b)) / x_45_scale)); end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := If[Or[LessEqual[b, 8.6e-181], N[Not[LessEqual[b, 1.34e+154]], $MachinePrecision]], N[(-4.0 * N[(N[(N[(b / x$45$scale), $MachinePrecision] * N[(b / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(a / y$45$scale), $MachinePrecision] * N[(a / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(N[(N[(a / y$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision] * N[(N[(N[(a / y$45$scale), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 8.6 \cdot 10^{-181} \lor \neg \left(b \leq 1.34 \cdot 10^{+154}\right):\\
\;\;\;\;-4 \cdot \left(\left(\frac{b}{x-scale} \cdot \frac{b}{x-scale}\right) \cdot \left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(\frac{\frac{a}{y-scale}}{x-scale} \cdot \frac{\frac{a}{y-scale} \cdot \left(b \cdot b\right)}{x-scale}\right)\\
\end{array}
\end{array}
if b < 8.6e-181 or 1.34000000000000001e154 < b Initial program 24.2%
Taylor expanded in angle around 0 44.5%
pow244.5%
pow244.5%
pow244.5%
frac-times45.0%
pow245.0%
*-commutative45.0%
times-frac60.4%
times-frac75.4%
Applied egg-rr75.4%
if 8.6e-181 < b < 1.34000000000000001e154Initial program 22.4%
Taylor expanded in angle around 0 52.7%
times-frac52.6%
unpow252.6%
unpow252.6%
unpow252.6%
unpow252.6%
Simplified52.6%
pow252.6%
associate-*r/54.5%
times-frac73.2%
pow273.2%
Applied egg-rr73.2%
associate-*l*74.8%
times-frac94.0%
Applied egg-rr94.0%
Final simplification80.1%
(FPCore (a b angle x-scale y-scale) :precision binary64 (if (<= x-scale 1.3e+142) (* -4.0 (* (* (/ a y-scale) (/ a y-scale)) (/ (* b b) (* x-scale x-scale)))) 0.0))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (x_45_scale <= 1.3e+142) {
tmp = -4.0 * (((a / y_45_scale) * (a / y_45_scale)) * ((b * b) / (x_45_scale * x_45_scale)));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: tmp
if (x_45scale <= 1.3d+142) then
tmp = (-4.0d0) * (((a / y_45scale) * (a / y_45scale)) * ((b * b) / (x_45scale * x_45scale)))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (x_45_scale <= 1.3e+142) {
tmp = -4.0 * (((a / y_45_scale) * (a / y_45_scale)) * ((b * b) / (x_45_scale * x_45_scale)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): tmp = 0 if x_45_scale <= 1.3e+142: tmp = -4.0 * (((a / y_45_scale) * (a / y_45_scale)) * ((b * b) / (x_45_scale * x_45_scale))) else: tmp = 0.0 return tmp
function code(a, b, angle, x_45_scale, y_45_scale) tmp = 0.0 if (x_45_scale <= 1.3e+142) tmp = Float64(-4.0 * Float64(Float64(Float64(a / y_45_scale) * Float64(a / y_45_scale)) * Float64(Float64(b * b) / Float64(x_45_scale * x_45_scale)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) tmp = 0.0; if (x_45_scale <= 1.3e+142) tmp = -4.0 * (((a / y_45_scale) * (a / y_45_scale)) * ((b * b) / (x_45_scale * x_45_scale))); else tmp = 0.0; end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[x$45$scale, 1.3e+142], N[(-4.0 * N[(N[(N[(a / y$45$scale), $MachinePrecision] * N[(a / y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x-scale \leq 1.3 \cdot 10^{+142}:\\
\;\;\;\;-4 \cdot \left(\left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right) \cdot \frac{b \cdot b}{x-scale \cdot x-scale}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x-scale < 1.30000000000000011e142Initial program 21.1%
Taylor expanded in angle around 0 47.1%
times-frac48.0%
unpow248.0%
unpow248.0%
unpow248.0%
unpow248.0%
Simplified48.0%
Taylor expanded in a around 0 48.0%
unpow248.0%
associate-/r*55.2%
unpow255.2%
associate-*r/60.2%
associate-*l/62.0%
Simplified62.0%
if 1.30000000000000011e142 < x-scale Initial program 37.4%
fma-neg37.4%
Simplified34.9%
Taylor expanded in b around 0 46.8%
*-commutative46.8%
*-commutative46.8%
*-commutative46.8%
distribute-lft-out46.8%
Simplified60.1%
Final simplification61.7%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* -4.0 (* (* (/ b x-scale) (/ b x-scale)) (* (/ a y-scale) (/ a y-scale)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return -4.0 * (((b / x_45_scale) * (b / x_45_scale)) * ((a / y_45_scale) * (a / y_45_scale)));
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = (-4.0d0) * (((b / x_45scale) * (b / x_45scale)) * ((a / y_45scale) * (a / y_45scale)))
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return -4.0 * (((b / x_45_scale) * (b / x_45_scale)) * ((a / y_45_scale) * (a / y_45_scale)));
}
def code(a, b, angle, x_45_scale, y_45_scale): return -4.0 * (((b / x_45_scale) * (b / x_45_scale)) * ((a / y_45_scale) * (a / y_45_scale)))
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(-4.0 * Float64(Float64(Float64(b / x_45_scale) * Float64(b / x_45_scale)) * Float64(Float64(a / y_45_scale) * Float64(a / y_45_scale)))) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = -4.0 * (((b / x_45_scale) * (b / x_45_scale)) * ((a / y_45_scale) * (a / y_45_scale))); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(-4.0 * N[(N[(N[(b / x$45$scale), $MachinePrecision] * N[(b / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(a / y$45$scale), $MachinePrecision] * N[(a / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-4 \cdot \left(\left(\frac{b}{x-scale} \cdot \frac{b}{x-scale}\right) \cdot \left(\frac{a}{y-scale} \cdot \frac{a}{y-scale}\right)\right)
\end{array}
Initial program 23.7%
Taylor expanded in angle around 0 46.6%
pow246.6%
pow246.6%
pow246.6%
frac-times46.9%
pow246.9%
*-commutative46.9%
times-frac59.2%
times-frac75.9%
Applied egg-rr75.9%
Final simplification75.9%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* -4.0 (/ a (* (/ (* x-scale y-scale) (* b a)) (/ (* x-scale y-scale) b)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return -4.0 * (a / (((x_45_scale * y_45_scale) / (b * a)) * ((x_45_scale * y_45_scale) / b)));
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = (-4.0d0) * (a / (((x_45scale * y_45scale) / (b * a)) * ((x_45scale * y_45scale) / b)))
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return -4.0 * (a / (((x_45_scale * y_45_scale) / (b * a)) * ((x_45_scale * y_45_scale) / b)));
}
def code(a, b, angle, x_45_scale, y_45_scale): return -4.0 * (a / (((x_45_scale * y_45_scale) / (b * a)) * ((x_45_scale * y_45_scale) / b)))
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(-4.0 * Float64(a / Float64(Float64(Float64(x_45_scale * y_45_scale) / Float64(b * a)) * Float64(Float64(x_45_scale * y_45_scale) / b)))) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = -4.0 * (a / (((x_45_scale * y_45_scale) / (b * a)) * ((x_45_scale * y_45_scale) / b))); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(-4.0 * N[(a / N[(N[(N[(x$45$scale * y$45$scale), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision] * N[(N[(x$45$scale * y$45$scale), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-4 \cdot \frac{a}{\frac{x-scale \cdot y-scale}{b \cdot a} \cdot \frac{x-scale \cdot y-scale}{b}}
\end{array}
Initial program 23.7%
Taylor expanded in angle around 0 46.6%
times-frac46.9%
unpow246.9%
unpow246.9%
unpow246.9%
unpow246.9%
Simplified46.9%
pow246.9%
associate-*r/47.5%
times-frac59.7%
pow259.7%
Applied egg-rr59.7%
associate-*r/59.2%
frac-times46.9%
unpow246.9%
frac-times46.6%
unpow246.6%
swap-sqr60.6%
times-frac65.3%
Applied egg-rr65.3%
frac-times60.6%
pow260.6%
pow260.6%
pow-prod-down76.2%
pow276.2%
frac-times94.9%
clear-num94.9%
associate-/l*94.1%
frac-times92.7%
*-un-lft-identity92.7%
Applied egg-rr92.7%
Final simplification92.7%
(FPCore (a b angle x-scale y-scale) :precision binary64 (let* ((t_0 (* (/ a y-scale) (/ b x-scale)))) (* t_0 (* -4.0 t_0))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (a / y_45_scale) * (b / x_45_scale);
return t_0 * (-4.0 * t_0);
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
t_0 = (a / y_45scale) * (b / x_45scale)
code = t_0 * ((-4.0d0) * t_0)
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (a / y_45_scale) * (b / x_45_scale);
return t_0 * (-4.0 * t_0);
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (a / y_45_scale) * (b / x_45_scale) return t_0 * (-4.0 * t_0)
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(a / y_45_scale) * Float64(b / x_45_scale)) return Float64(t_0 * Float64(-4.0 * t_0)) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (a / y_45_scale) * (b / x_45_scale); tmp = t_0 * (-4.0 * t_0); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(a / y$45$scale), $MachinePrecision] * N[(b / x$45$scale), $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * N[(-4.0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{y-scale} \cdot \frac{b}{x-scale}\\
t_0 \cdot \left(-4 \cdot t_0\right)
\end{array}
\end{array}
Initial program 23.7%
Taylor expanded in angle around 0 46.6%
times-frac46.9%
unpow246.9%
unpow246.9%
unpow246.9%
unpow246.9%
Simplified46.9%
pow246.9%
frac-times46.6%
pow246.6%
pow246.6%
pow246.6%
associate-*r/46.6%
pow-prod-down60.7%
pow-prod-down76.2%
Applied egg-rr76.2%
associate-/l*76.0%
div-inv76.0%
clear-num76.2%
pow-prod-down58.4%
pow258.4%
unpow258.4%
swap-sqr46.6%
frac-times46.9%
unpow246.9%
frac-times59.2%
add-sqr-sqrt59.2%
associate-*r*59.2%
Applied egg-rr94.9%
Final simplification94.9%
(FPCore (a b angle x-scale y-scale) :precision binary64 0.0)
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return 0.0;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = 0.0d0
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return 0.0;
}
def code(a, b, angle, x_45_scale, y_45_scale): return 0.0
function code(a, b, angle, x_45_scale, y_45_scale) return 0.0 end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = 0.0; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 23.7%
fma-neg25.2%
Simplified22.6%
Taylor expanded in b around 0 27.0%
*-commutative27.0%
*-commutative27.0%
*-commutative27.0%
distribute-lft-out27.0%
Simplified37.2%
Final simplification37.2%
herbie shell --seed 2023240
(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))))