
(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}
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}
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI))
(t_1 (* 0.005555555555555556 (* angle PI)))
(t_2 (sin t_0))
(t_3
(/
(/ (* -2.0 (* (pow a_m 2.0) (* (cos t_1) (sin t_1)))) x-scale)
y-scale))
(t_4 (cos t_0)))
(if (<= a_m 1.7e-146)
(-
(* t_3 t_3)
(*
(*
4.0
(/ (/ (+ (pow (* a_m t_2) 2.0) (pow (* b t_4) 2.0)) x-scale) x-scale))
(/ (/ (+ (pow (* a_m t_4) 2.0) (pow (* b t_2) 2.0)) y-scale) y-scale)))
(*
(pow a_m 2.0)
(* (pow b 2.0) (/ -4.0 (* (pow x-scale 2.0) (pow y-scale 2.0))))))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * ((double) M_PI);
double t_1 = 0.005555555555555556 * (angle * ((double) M_PI));
double t_2 = sin(t_0);
double t_3 = ((-2.0 * (pow(a_m, 2.0) * (cos(t_1) * sin(t_1)))) / x_45_scale) / y_45_scale;
double t_4 = cos(t_0);
double tmp;
if (a_m <= 1.7e-146) {
tmp = (t_3 * t_3) - ((4.0 * (((pow((a_m * t_2), 2.0) + pow((b * t_4), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a_m * t_4), 2.0) + pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale));
} else {
tmp = pow(a_m, 2.0) * (pow(b, 2.0) * (-4.0 / (pow(x_45_scale, 2.0) * pow(y_45_scale, 2.0))));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * Math.PI;
double t_1 = 0.005555555555555556 * (angle * Math.PI);
double t_2 = Math.sin(t_0);
double t_3 = ((-2.0 * (Math.pow(a_m, 2.0) * (Math.cos(t_1) * Math.sin(t_1)))) / x_45_scale) / y_45_scale;
double t_4 = Math.cos(t_0);
double tmp;
if (a_m <= 1.7e-146) {
tmp = (t_3 * t_3) - ((4.0 * (((Math.pow((a_m * t_2), 2.0) + Math.pow((b * t_4), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a_m * t_4), 2.0) + Math.pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale));
} else {
tmp = Math.pow(a_m, 2.0) * (Math.pow(b, 2.0) * (-4.0 / (Math.pow(x_45_scale, 2.0) * Math.pow(y_45_scale, 2.0))));
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = (angle / 180.0) * math.pi t_1 = 0.005555555555555556 * (angle * math.pi) t_2 = math.sin(t_0) t_3 = ((-2.0 * (math.pow(a_m, 2.0) * (math.cos(t_1) * math.sin(t_1)))) / x_45_scale) / y_45_scale t_4 = math.cos(t_0) tmp = 0 if a_m <= 1.7e-146: tmp = (t_3 * t_3) - ((4.0 * (((math.pow((a_m * t_2), 2.0) + math.pow((b * t_4), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a_m * t_4), 2.0) + math.pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale)) else: tmp = math.pow(a_m, 2.0) * (math.pow(b, 2.0) * (-4.0 / (math.pow(x_45_scale, 2.0) * math.pow(y_45_scale, 2.0)))) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(angle / 180.0) * pi) t_1 = Float64(0.005555555555555556 * Float64(angle * pi)) t_2 = sin(t_0) t_3 = Float64(Float64(Float64(-2.0 * Float64((a_m ^ 2.0) * Float64(cos(t_1) * sin(t_1)))) / x_45_scale) / y_45_scale) t_4 = cos(t_0) tmp = 0.0 if (a_m <= 1.7e-146) tmp = Float64(Float64(t_3 * t_3) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a_m * t_2) ^ 2.0) + (Float64(b * t_4) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a_m * t_4) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / y_45_scale) / y_45_scale))); else tmp = Float64((a_m ^ 2.0) * Float64((b ^ 2.0) * Float64(-4.0 / Float64((x_45_scale ^ 2.0) * (y_45_scale ^ 2.0))))); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = (angle / 180.0) * pi; t_1 = 0.005555555555555556 * (angle * pi); t_2 = sin(t_0); t_3 = ((-2.0 * ((a_m ^ 2.0) * (cos(t_1) * sin(t_1)))) / x_45_scale) / y_45_scale; t_4 = cos(t_0); tmp = 0.0; if (a_m <= 1.7e-146) tmp = (t_3 * t_3) - ((4.0 * (((((a_m * t_2) ^ 2.0) + ((b * t_4) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a_m * t_4) ^ 2.0) + ((b * t_2) ^ 2.0)) / y_45_scale) / y_45_scale)); else tmp = (a_m ^ 2.0) * ((b ^ 2.0) * (-4.0 / ((x_45_scale ^ 2.0) * (y_45_scale ^ 2.0)))); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, 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[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(-2.0 * N[(N[Power[a$95$m, 2.0], $MachinePrecision] * N[(N[Cos[t$95$1], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, Block[{t$95$4 = N[Cos[t$95$0], $MachinePrecision]}, If[LessEqual[a$95$m, 1.7e-146], N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a$95$m * 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]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a$95$m * 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]), $MachinePrecision]), $MachinePrecision], N[(N[Power[a$95$m, 2.0], $MachinePrecision] * N[(N[Power[b, 2.0], $MachinePrecision] * N[(-4.0 / N[(N[Power[x$45$scale, 2.0], $MachinePrecision] * N[Power[y$45$scale, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
t_2 := \sin t\_0\\
t_3 := \frac{\frac{-2 \cdot \left({a\_m}^{2} \cdot \left(\cos t\_1 \cdot \sin t\_1\right)\right)}{x-scale}}{y-scale}\\
t_4 := \cos t\_0\\
\mathbf{if}\;a\_m \leq 1.7 \cdot 10^{-146}:\\
\;\;\;\;t\_3 \cdot t\_3 - \left(4 \cdot \frac{\frac{{\left(a\_m \cdot t\_2\right)}^{2} + {\left(b \cdot t\_4\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a\_m \cdot t\_4\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{y-scale}}{y-scale}\\
\mathbf{else}:\\
\;\;\;\;{a\_m}^{2} \cdot \left({b}^{2} \cdot \frac{-4}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\\
\end{array}
\end{array}
if a < 1.7e-146Initial program 43.0%
Taylor expanded in a around inf
Applied rewrites45.0%
Taylor expanded in a around inf
Applied rewrites54.5%
if 1.7e-146 < a Initial program 17.9%
Taylor expanded in b around 0
Applied rewrites40.4%
Taylor expanded in a around 0
Applied rewrites42.2%
Taylor expanded in angle around 0
Applied rewrites51.2%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle PI)))
(t_1 (* (/ angle 180.0) PI))
(t_2
(/
(/ (* -2.0 (* (pow a_m 2.0) (* (cos t_0) (sin t_0)))) x-scale)
y-scale)))
(if (<= a_m 1.7e-146)
(-
(* t_2 t_2)
(*
(* 4.0 (/ (/ (pow b 2.0) x-scale) x-scale))
(/
(/ (+ (pow (* a_m (cos t_1)) 2.0) (pow (* b (sin t_1)) 2.0)) y-scale)
y-scale)))
(*
(pow a_m 2.0)
(* (pow b 2.0) (/ -4.0 (* (pow x-scale 2.0) (pow y-scale 2.0))))))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
double t_1 = (angle / 180.0) * ((double) M_PI);
double t_2 = ((-2.0 * (pow(a_m, 2.0) * (cos(t_0) * sin(t_0)))) / x_45_scale) / y_45_scale;
double tmp;
if (a_m <= 1.7e-146) {
tmp = (t_2 * t_2) - ((4.0 * ((pow(b, 2.0) / x_45_scale) / x_45_scale)) * (((pow((a_m * cos(t_1)), 2.0) + pow((b * sin(t_1)), 2.0)) / y_45_scale) / y_45_scale));
} else {
tmp = pow(a_m, 2.0) * (pow(b, 2.0) * (-4.0 / (pow(x_45_scale, 2.0) * pow(y_45_scale, 2.0))));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.005555555555555556 * (angle * Math.PI);
double t_1 = (angle / 180.0) * Math.PI;
double t_2 = ((-2.0 * (Math.pow(a_m, 2.0) * (Math.cos(t_0) * Math.sin(t_0)))) / x_45_scale) / y_45_scale;
double tmp;
if (a_m <= 1.7e-146) {
tmp = (t_2 * t_2) - ((4.0 * ((Math.pow(b, 2.0) / x_45_scale) / x_45_scale)) * (((Math.pow((a_m * Math.cos(t_1)), 2.0) + Math.pow((b * Math.sin(t_1)), 2.0)) / y_45_scale) / y_45_scale));
} else {
tmp = Math.pow(a_m, 2.0) * (Math.pow(b, 2.0) * (-4.0 / (Math.pow(x_45_scale, 2.0) * Math.pow(y_45_scale, 2.0))));
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = 0.005555555555555556 * (angle * math.pi) t_1 = (angle / 180.0) * math.pi t_2 = ((-2.0 * (math.pow(a_m, 2.0) * (math.cos(t_0) * math.sin(t_0)))) / x_45_scale) / y_45_scale tmp = 0 if a_m <= 1.7e-146: tmp = (t_2 * t_2) - ((4.0 * ((math.pow(b, 2.0) / x_45_scale) / x_45_scale)) * (((math.pow((a_m * math.cos(t_1)), 2.0) + math.pow((b * math.sin(t_1)), 2.0)) / y_45_scale) / y_45_scale)) else: tmp = math.pow(a_m, 2.0) * (math.pow(b, 2.0) * (-4.0 / (math.pow(x_45_scale, 2.0) * math.pow(y_45_scale, 2.0)))) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(0.005555555555555556 * Float64(angle * pi)) t_1 = Float64(Float64(angle / 180.0) * pi) t_2 = Float64(Float64(Float64(-2.0 * Float64((a_m ^ 2.0) * Float64(cos(t_0) * sin(t_0)))) / x_45_scale) / y_45_scale) tmp = 0.0 if (a_m <= 1.7e-146) tmp = Float64(Float64(t_2 * t_2) - Float64(Float64(4.0 * Float64(Float64((b ^ 2.0) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a_m * cos(t_1)) ^ 2.0) + (Float64(b * sin(t_1)) ^ 2.0)) / y_45_scale) / y_45_scale))); else tmp = Float64((a_m ^ 2.0) * Float64((b ^ 2.0) * Float64(-4.0 / Float64((x_45_scale ^ 2.0) * (y_45_scale ^ 2.0))))); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = 0.005555555555555556 * (angle * pi); t_1 = (angle / 180.0) * pi; t_2 = ((-2.0 * ((a_m ^ 2.0) * (cos(t_0) * sin(t_0)))) / x_45_scale) / y_45_scale; tmp = 0.0; if (a_m <= 1.7e-146) tmp = (t_2 * t_2) - ((4.0 * (((b ^ 2.0) / x_45_scale) / x_45_scale)) * (((((a_m * cos(t_1)) ^ 2.0) + ((b * sin(t_1)) ^ 2.0)) / y_45_scale) / y_45_scale)); else tmp = (a_m ^ 2.0) * ((b ^ 2.0) * (-4.0 / ((x_45_scale ^ 2.0) * (y_45_scale ^ 2.0)))); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(-2.0 * N[(N[Power[a$95$m, 2.0], $MachinePrecision] * N[(N[Cos[t$95$0], $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, If[LessEqual[a$95$m, 1.7e-146], N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[Power[b, 2.0], $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a$95$m * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[a$95$m, 2.0], $MachinePrecision] * N[(N[Power[b, 2.0], $MachinePrecision] * N[(-4.0 / N[(N[Power[x$45$scale, 2.0], $MachinePrecision] * N[Power[y$45$scale, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
t_1 := \frac{angle}{180} \cdot \pi\\
t_2 := \frac{\frac{-2 \cdot \left({a\_m}^{2} \cdot \left(\cos t\_0 \cdot \sin t\_0\right)\right)}{x-scale}}{y-scale}\\
\mathbf{if}\;a\_m \leq 1.7 \cdot 10^{-146}:\\
\;\;\;\;t\_2 \cdot t\_2 - \left(4 \cdot \frac{\frac{{b}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a\_m \cdot \cos t\_1\right)}^{2} + {\left(b \cdot \sin t\_1\right)}^{2}}{y-scale}}{y-scale}\\
\mathbf{else}:\\
\;\;\;\;{a\_m}^{2} \cdot \left({b}^{2} \cdot \frac{-4}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\\
\end{array}
\end{array}
if a < 1.7e-146Initial program 43.0%
Taylor expanded in a around inf
Applied rewrites45.0%
Taylor expanded in a around inf
Applied rewrites54.5%
Taylor expanded in angle around 0
Applied rewrites54.5%
if 1.7e-146 < a Initial program 17.9%
Taylor expanded in b around 0
Applied rewrites40.4%
Taylor expanded in a around 0
Applied rewrites42.2%
Taylor expanded in angle around 0
Applied rewrites51.2%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI))
(t_1 (cos t_0))
(t_2
(/
(/ (* -0.011111111111111112 (* (pow a_m 2.0) (* angle PI))) x-scale)
y-scale))
(t_3 (sin t_0)))
(if (<= a_m 6.8e-147)
(-
(* t_2 t_2)
(*
(*
4.0
(/ (/ (+ (pow (* a_m t_3) 2.0) (pow (* b t_1) 2.0)) x-scale) x-scale))
(/ (/ (+ (pow (* a_m t_1) 2.0) (pow (* b t_3) 2.0)) y-scale) y-scale)))
(*
(pow a_m 2.0)
(* (pow b 2.0) (/ -4.0 (* (pow x-scale 2.0) (pow y-scale 2.0))))))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * ((double) M_PI);
double t_1 = cos(t_0);
double t_2 = ((-0.011111111111111112 * (pow(a_m, 2.0) * (angle * ((double) M_PI)))) / x_45_scale) / y_45_scale;
double t_3 = sin(t_0);
double tmp;
if (a_m <= 6.8e-147) {
tmp = (t_2 * t_2) - ((4.0 * (((pow((a_m * t_3), 2.0) + pow((b * t_1), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a_m * t_1), 2.0) + pow((b * t_3), 2.0)) / y_45_scale) / y_45_scale));
} else {
tmp = pow(a_m, 2.0) * (pow(b, 2.0) * (-4.0 / (pow(x_45_scale, 2.0) * pow(y_45_scale, 2.0))));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * Math.PI;
double t_1 = Math.cos(t_0);
double t_2 = ((-0.011111111111111112 * (Math.pow(a_m, 2.0) * (angle * Math.PI))) / x_45_scale) / y_45_scale;
double t_3 = Math.sin(t_0);
double tmp;
if (a_m <= 6.8e-147) {
tmp = (t_2 * t_2) - ((4.0 * (((Math.pow((a_m * t_3), 2.0) + Math.pow((b * t_1), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a_m * t_1), 2.0) + Math.pow((b * t_3), 2.0)) / y_45_scale) / y_45_scale));
} else {
tmp = Math.pow(a_m, 2.0) * (Math.pow(b, 2.0) * (-4.0 / (Math.pow(x_45_scale, 2.0) * Math.pow(y_45_scale, 2.0))));
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = (angle / 180.0) * math.pi t_1 = math.cos(t_0) t_2 = ((-0.011111111111111112 * (math.pow(a_m, 2.0) * (angle * math.pi))) / x_45_scale) / y_45_scale t_3 = math.sin(t_0) tmp = 0 if a_m <= 6.8e-147: tmp = (t_2 * t_2) - ((4.0 * (((math.pow((a_m * t_3), 2.0) + math.pow((b * t_1), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a_m * t_1), 2.0) + math.pow((b * t_3), 2.0)) / y_45_scale) / y_45_scale)) else: tmp = math.pow(a_m, 2.0) * (math.pow(b, 2.0) * (-4.0 / (math.pow(x_45_scale, 2.0) * math.pow(y_45_scale, 2.0)))) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(angle / 180.0) * pi) t_1 = cos(t_0) t_2 = Float64(Float64(Float64(-0.011111111111111112 * Float64((a_m ^ 2.0) * Float64(angle * pi))) / x_45_scale) / y_45_scale) t_3 = sin(t_0) tmp = 0.0 if (a_m <= 6.8e-147) tmp = Float64(Float64(t_2 * t_2) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a_m * t_3) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a_m * t_1) ^ 2.0) + (Float64(b * t_3) ^ 2.0)) / y_45_scale) / y_45_scale))); else tmp = Float64((a_m ^ 2.0) * Float64((b ^ 2.0) * Float64(-4.0 / Float64((x_45_scale ^ 2.0) * (y_45_scale ^ 2.0))))); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = (angle / 180.0) * pi; t_1 = cos(t_0); t_2 = ((-0.011111111111111112 * ((a_m ^ 2.0) * (angle * pi))) / x_45_scale) / y_45_scale; t_3 = sin(t_0); tmp = 0.0; if (a_m <= 6.8e-147) tmp = (t_2 * t_2) - ((4.0 * (((((a_m * t_3) ^ 2.0) + ((b * t_1) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a_m * t_1) ^ 2.0) + ((b * t_3) ^ 2.0)) / y_45_scale) / y_45_scale)); else tmp = (a_m ^ 2.0) * ((b ^ 2.0) * (-4.0 / ((x_45_scale ^ 2.0) * (y_45_scale ^ 2.0)))); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, 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[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(-0.011111111111111112 * N[(N[Power[a$95$m, 2.0], $MachinePrecision] * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, Block[{t$95$3 = N[Sin[t$95$0], $MachinePrecision]}, If[LessEqual[a$95$m, 6.8e-147], N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a$95$m * t$95$3), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$1), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a$95$m * t$95$1), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$3), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[a$95$m, 2.0], $MachinePrecision] * N[(N[Power[b, 2.0], $MachinePrecision] * N[(-4.0 / N[(N[Power[x$45$scale, 2.0], $MachinePrecision] * N[Power[y$45$scale, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := \cos t\_0\\
t_2 := \frac{\frac{-0.011111111111111112 \cdot \left({a\_m}^{2} \cdot \left(angle \cdot \pi\right)\right)}{x-scale}}{y-scale}\\
t_3 := \sin t\_0\\
\mathbf{if}\;a\_m \leq 6.8 \cdot 10^{-147}:\\
\;\;\;\;t\_2 \cdot t\_2 - \left(4 \cdot \frac{\frac{{\left(a\_m \cdot t\_3\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a\_m \cdot t\_1\right)}^{2} + {\left(b \cdot t\_3\right)}^{2}}{y-scale}}{y-scale}\\
\mathbf{else}:\\
\;\;\;\;{a\_m}^{2} \cdot \left({b}^{2} \cdot \frac{-4}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\\
\end{array}
\end{array}
if a < 6.79999999999999991e-147Initial program 43.1%
Taylor expanded in a around inf
Applied rewrites45.0%
Taylor expanded in a around inf
Applied rewrites54.5%
Taylor expanded in angle around 0
Applied rewrites54.5%
Taylor expanded in angle around 0
Applied rewrites53.8%
if 6.79999999999999991e-147 < a Initial program 17.9%
Taylor expanded in b around 0
Applied rewrites40.4%
Taylor expanded in a around 0
Applied rewrites42.2%
Taylor expanded in angle around 0
Applied rewrites51.3%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0
(/
(/ (* -0.011111111111111112 (* (pow a_m 2.0) (* angle PI))) x-scale)
y-scale))
(t_1 (* 0.005555555555555556 (* angle PI)))
(t_2 (sin t_1)))
(if (<= a_m 7e-147)
(-
(* t_0 t_0)
(*
(* 4.0 (/ (/ (* (pow a_m 2.0) (pow t_2 2.0)) x-scale) x-scale))
(/
(/ (+ (pow (* a_m (cos t_1)) 2.0) (pow (* b t_2) 2.0)) y-scale)
y-scale)))
(*
(pow a_m 2.0)
(* (pow b 2.0) (/ -4.0 (* (pow x-scale 2.0) (pow y-scale 2.0))))))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = ((-0.011111111111111112 * (pow(a_m, 2.0) * (angle * ((double) M_PI)))) / x_45_scale) / y_45_scale;
double t_1 = 0.005555555555555556 * (angle * ((double) M_PI));
double t_2 = sin(t_1);
double tmp;
if (a_m <= 7e-147) {
tmp = (t_0 * t_0) - ((4.0 * (((pow(a_m, 2.0) * pow(t_2, 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a_m * cos(t_1)), 2.0) + pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale));
} else {
tmp = pow(a_m, 2.0) * (pow(b, 2.0) * (-4.0 / (pow(x_45_scale, 2.0) * pow(y_45_scale, 2.0))));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = ((-0.011111111111111112 * (Math.pow(a_m, 2.0) * (angle * Math.PI))) / x_45_scale) / y_45_scale;
double t_1 = 0.005555555555555556 * (angle * Math.PI);
double t_2 = Math.sin(t_1);
double tmp;
if (a_m <= 7e-147) {
tmp = (t_0 * t_0) - ((4.0 * (((Math.pow(a_m, 2.0) * Math.pow(t_2, 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a_m * Math.cos(t_1)), 2.0) + Math.pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale));
} else {
tmp = Math.pow(a_m, 2.0) * (Math.pow(b, 2.0) * (-4.0 / (Math.pow(x_45_scale, 2.0) * Math.pow(y_45_scale, 2.0))));
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = ((-0.011111111111111112 * (math.pow(a_m, 2.0) * (angle * math.pi))) / x_45_scale) / y_45_scale t_1 = 0.005555555555555556 * (angle * math.pi) t_2 = math.sin(t_1) tmp = 0 if a_m <= 7e-147: tmp = (t_0 * t_0) - ((4.0 * (((math.pow(a_m, 2.0) * math.pow(t_2, 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a_m * math.cos(t_1)), 2.0) + math.pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale)) else: tmp = math.pow(a_m, 2.0) * (math.pow(b, 2.0) * (-4.0 / (math.pow(x_45_scale, 2.0) * math.pow(y_45_scale, 2.0)))) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(Float64(-0.011111111111111112 * Float64((a_m ^ 2.0) * Float64(angle * pi))) / x_45_scale) / y_45_scale) t_1 = Float64(0.005555555555555556 * Float64(angle * pi)) t_2 = sin(t_1) tmp = 0.0 if (a_m <= 7e-147) tmp = Float64(Float64(t_0 * t_0) - Float64(Float64(4.0 * Float64(Float64(Float64((a_m ^ 2.0) * (t_2 ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a_m * cos(t_1)) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / y_45_scale) / y_45_scale))); else tmp = Float64((a_m ^ 2.0) * Float64((b ^ 2.0) * Float64(-4.0 / Float64((x_45_scale ^ 2.0) * (y_45_scale ^ 2.0))))); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = ((-0.011111111111111112 * ((a_m ^ 2.0) * (angle * pi))) / x_45_scale) / y_45_scale; t_1 = 0.005555555555555556 * (angle * pi); t_2 = sin(t_1); tmp = 0.0; if (a_m <= 7e-147) tmp = (t_0 * t_0) - ((4.0 * ((((a_m ^ 2.0) * (t_2 ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a_m * cos(t_1)) ^ 2.0) + ((b * t_2) ^ 2.0)) / y_45_scale) / y_45_scale)); else tmp = (a_m ^ 2.0) * ((b ^ 2.0) * (-4.0 / ((x_45_scale ^ 2.0) * (y_45_scale ^ 2.0)))); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(N[(-0.011111111111111112 * N[(N[Power[a$95$m, 2.0], $MachinePrecision] * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, Block[{t$95$1 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$1], $MachinePrecision]}, If[LessEqual[a$95$m, 7e-147], N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[a$95$m, 2.0], $MachinePrecision] * N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a$95$m * N[Cos[t$95$1], $MachinePrecision]), $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], N[(N[Power[a$95$m, 2.0], $MachinePrecision] * N[(N[Power[b, 2.0], $MachinePrecision] * N[(-4.0 / N[(N[Power[x$45$scale, 2.0], $MachinePrecision] * N[Power[y$45$scale, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \frac{\frac{-0.011111111111111112 \cdot \left({a\_m}^{2} \cdot \left(angle \cdot \pi\right)\right)}{x-scale}}{y-scale}\\
t_1 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
t_2 := \sin t\_1\\
\mathbf{if}\;a\_m \leq 7 \cdot 10^{-147}:\\
\;\;\;\;t\_0 \cdot t\_0 - \left(4 \cdot \frac{\frac{{a\_m}^{2} \cdot {t\_2}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a\_m \cdot \cos t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{y-scale}}{y-scale}\\
\mathbf{else}:\\
\;\;\;\;{a\_m}^{2} \cdot \left({b}^{2} \cdot \frac{-4}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\\
\end{array}
\end{array}
if a < 7.00000000000000007e-147Initial program 43.1%
Taylor expanded in a around inf
Applied rewrites45.0%
Taylor expanded in a around inf
Applied rewrites54.5%
Taylor expanded in a around inf
Applied rewrites54.1%
Taylor expanded in angle around 0
Applied rewrites54.1%
Taylor expanded in angle around 0
Applied rewrites54.1%
Taylor expanded in angle around 0
Applied rewrites54.1%
Taylor expanded in angle around 0
Applied rewrites53.4%
if 7.00000000000000007e-147 < a Initial program 17.9%
Taylor expanded in b around 0
Applied rewrites40.4%
Taylor expanded in a around 0
Applied rewrites42.2%
Taylor expanded in angle around 0
Applied rewrites51.3%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI))
(t_1
(*
0.011111111111111112
(/ (* angle (* PI (* -1.0 (pow a_m 2.0)))) (* x-scale y-scale)))))
(if (<= a_m 6.8e-147)
(-
(* t_1 t_1)
(*
(* 4.0 (/ (/ (pow b 2.0) x-scale) x-scale))
(/
(/ (+ (pow (* a_m (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0)) y-scale)
y-scale)))
(*
(pow a_m 2.0)
(* (pow b 2.0) (/ -4.0 (* (pow x-scale 2.0) (pow y-scale 2.0))))))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * ((double) M_PI);
double t_1 = 0.011111111111111112 * ((angle * (((double) M_PI) * (-1.0 * pow(a_m, 2.0)))) / (x_45_scale * y_45_scale));
double tmp;
if (a_m <= 6.8e-147) {
tmp = (t_1 * t_1) - ((4.0 * ((pow(b, 2.0) / x_45_scale) / x_45_scale)) * (((pow((a_m * cos(t_0)), 2.0) + pow((b * sin(t_0)), 2.0)) / y_45_scale) / y_45_scale));
} else {
tmp = pow(a_m, 2.0) * (pow(b, 2.0) * (-4.0 / (pow(x_45_scale, 2.0) * pow(y_45_scale, 2.0))));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * Math.PI;
double t_1 = 0.011111111111111112 * ((angle * (Math.PI * (-1.0 * Math.pow(a_m, 2.0)))) / (x_45_scale * y_45_scale));
double tmp;
if (a_m <= 6.8e-147) {
tmp = (t_1 * t_1) - ((4.0 * ((Math.pow(b, 2.0) / x_45_scale) / x_45_scale)) * (((Math.pow((a_m * Math.cos(t_0)), 2.0) + Math.pow((b * Math.sin(t_0)), 2.0)) / y_45_scale) / y_45_scale));
} else {
tmp = Math.pow(a_m, 2.0) * (Math.pow(b, 2.0) * (-4.0 / (Math.pow(x_45_scale, 2.0) * Math.pow(y_45_scale, 2.0))));
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = (angle / 180.0) * math.pi t_1 = 0.011111111111111112 * ((angle * (math.pi * (-1.0 * math.pow(a_m, 2.0)))) / (x_45_scale * y_45_scale)) tmp = 0 if a_m <= 6.8e-147: tmp = (t_1 * t_1) - ((4.0 * ((math.pow(b, 2.0) / x_45_scale) / x_45_scale)) * (((math.pow((a_m * math.cos(t_0)), 2.0) + math.pow((b * math.sin(t_0)), 2.0)) / y_45_scale) / y_45_scale)) else: tmp = math.pow(a_m, 2.0) * (math.pow(b, 2.0) * (-4.0 / (math.pow(x_45_scale, 2.0) * math.pow(y_45_scale, 2.0)))) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(angle / 180.0) * pi) t_1 = Float64(0.011111111111111112 * Float64(Float64(angle * Float64(pi * Float64(-1.0 * (a_m ^ 2.0)))) / Float64(x_45_scale * y_45_scale))) tmp = 0.0 if (a_m <= 6.8e-147) tmp = Float64(Float64(t_1 * t_1) - Float64(Float64(4.0 * Float64(Float64((b ^ 2.0) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a_m * cos(t_0)) ^ 2.0) + (Float64(b * sin(t_0)) ^ 2.0)) / y_45_scale) / y_45_scale))); else tmp = Float64((a_m ^ 2.0) * Float64((b ^ 2.0) * Float64(-4.0 / Float64((x_45_scale ^ 2.0) * (y_45_scale ^ 2.0))))); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = (angle / 180.0) * pi; t_1 = 0.011111111111111112 * ((angle * (pi * (-1.0 * (a_m ^ 2.0)))) / (x_45_scale * y_45_scale)); tmp = 0.0; if (a_m <= 6.8e-147) tmp = (t_1 * t_1) - ((4.0 * (((b ^ 2.0) / x_45_scale) / x_45_scale)) * (((((a_m * cos(t_0)) ^ 2.0) + ((b * sin(t_0)) ^ 2.0)) / y_45_scale) / y_45_scale)); else tmp = (a_m ^ 2.0) * ((b ^ 2.0) * (-4.0 / ((x_45_scale ^ 2.0) * (y_45_scale ^ 2.0)))); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, 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[(0.011111111111111112 * N[(N[(angle * N[(Pi * N[(-1.0 * N[Power[a$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a$95$m, 6.8e-147], N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[Power[b, 2.0], $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a$95$m * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[a$95$m, 2.0], $MachinePrecision] * N[(N[Power[b, 2.0], $MachinePrecision] * N[(-4.0 / N[(N[Power[x$45$scale, 2.0], $MachinePrecision] * N[Power[y$45$scale, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := 0.011111111111111112 \cdot \frac{angle \cdot \left(\pi \cdot \left(-1 \cdot {a\_m}^{2}\right)\right)}{x-scale \cdot y-scale}\\
\mathbf{if}\;a\_m \leq 6.8 \cdot 10^{-147}:\\
\;\;\;\;t\_1 \cdot t\_1 - \left(4 \cdot \frac{\frac{{b}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a\_m \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}}{y-scale}}{y-scale}\\
\mathbf{else}:\\
\;\;\;\;{a\_m}^{2} \cdot \left({b}^{2} \cdot \frac{-4}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\\
\end{array}
\end{array}
if a < 6.79999999999999991e-147Initial program 43.1%
Taylor expanded in angle around 0
Applied rewrites43.0%
Taylor expanded in angle around 0
Applied rewrites37.9%
Taylor expanded in angle around 0
Applied rewrites37.9%
Taylor expanded in a around inf
Applied rewrites43.3%
Taylor expanded in a around inf
Applied rewrites48.5%
if 6.79999999999999991e-147 < a Initial program 17.9%
Taylor expanded in b around 0
Applied rewrites40.4%
Taylor expanded in a around 0
Applied rewrites42.2%
Taylor expanded in angle around 0
Applied rewrites51.3%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0
(*
0.011111111111111112
(/ (* angle (* (pow b 2.0) PI)) (* x-scale y-scale)))))
(if (<= b 1.35e-185)
(-
(* t_0 t_0)
(*
(* 4.0 (/ (/ (pow b 2.0) x-scale) x-scale))
(/ (/ (pow a_m 2.0) y-scale) y-scale)))
(*
(pow a_m 2.0)
(* (pow b 2.0) (/ -4.0 (* (pow x-scale 2.0) (pow y-scale 2.0))))))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.011111111111111112 * ((angle * (pow(b, 2.0) * ((double) M_PI))) / (x_45_scale * y_45_scale));
double tmp;
if (b <= 1.35e-185) {
tmp = (t_0 * t_0) - ((4.0 * ((pow(b, 2.0) / x_45_scale) / x_45_scale)) * ((pow(a_m, 2.0) / y_45_scale) / y_45_scale));
} else {
tmp = pow(a_m, 2.0) * (pow(b, 2.0) * (-4.0 / (pow(x_45_scale, 2.0) * pow(y_45_scale, 2.0))));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.011111111111111112 * ((angle * (Math.pow(b, 2.0) * Math.PI)) / (x_45_scale * y_45_scale));
double tmp;
if (b <= 1.35e-185) {
tmp = (t_0 * t_0) - ((4.0 * ((Math.pow(b, 2.0) / x_45_scale) / x_45_scale)) * ((Math.pow(a_m, 2.0) / y_45_scale) / y_45_scale));
} else {
tmp = Math.pow(a_m, 2.0) * (Math.pow(b, 2.0) * (-4.0 / (Math.pow(x_45_scale, 2.0) * Math.pow(y_45_scale, 2.0))));
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = 0.011111111111111112 * ((angle * (math.pow(b, 2.0) * math.pi)) / (x_45_scale * y_45_scale)) tmp = 0 if b <= 1.35e-185: tmp = (t_0 * t_0) - ((4.0 * ((math.pow(b, 2.0) / x_45_scale) / x_45_scale)) * ((math.pow(a_m, 2.0) / y_45_scale) / y_45_scale)) else: tmp = math.pow(a_m, 2.0) * (math.pow(b, 2.0) * (-4.0 / (math.pow(x_45_scale, 2.0) * math.pow(y_45_scale, 2.0)))) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(0.011111111111111112 * Float64(Float64(angle * Float64((b ^ 2.0) * pi)) / Float64(x_45_scale * y_45_scale))) tmp = 0.0 if (b <= 1.35e-185) tmp = Float64(Float64(t_0 * t_0) - Float64(Float64(4.0 * Float64(Float64((b ^ 2.0) / x_45_scale) / x_45_scale)) * Float64(Float64((a_m ^ 2.0) / y_45_scale) / y_45_scale))); else tmp = Float64((a_m ^ 2.0) * Float64((b ^ 2.0) * Float64(-4.0 / Float64((x_45_scale ^ 2.0) * (y_45_scale ^ 2.0))))); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = 0.011111111111111112 * ((angle * ((b ^ 2.0) * pi)) / (x_45_scale * y_45_scale)); tmp = 0.0; if (b <= 1.35e-185) tmp = (t_0 * t_0) - ((4.0 * (((b ^ 2.0) / x_45_scale) / x_45_scale)) * (((a_m ^ 2.0) / y_45_scale) / y_45_scale)); else tmp = (a_m ^ 2.0) * ((b ^ 2.0) * (-4.0 / ((x_45_scale ^ 2.0) * (y_45_scale ^ 2.0)))); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(0.011111111111111112 * N[(N[(angle * N[(N[Power[b, 2.0], $MachinePrecision] * Pi), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.35e-185], N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[Power[b, 2.0], $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[a$95$m, 2.0], $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[a$95$m, 2.0], $MachinePrecision] * N[(N[Power[b, 2.0], $MachinePrecision] * N[(-4.0 / N[(N[Power[x$45$scale, 2.0], $MachinePrecision] * N[Power[y$45$scale, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := 0.011111111111111112 \cdot \frac{angle \cdot \left({b}^{2} \cdot \pi\right)}{x-scale \cdot y-scale}\\
\mathbf{if}\;b \leq 1.35 \cdot 10^{-185}:\\
\;\;\;\;t\_0 \cdot t\_0 - \left(4 \cdot \frac{\frac{{b}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{a\_m}^{2}}{y-scale}}{y-scale}\\
\mathbf{else}:\\
\;\;\;\;{a\_m}^{2} \cdot \left({b}^{2} \cdot \frac{-4}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)\\
\end{array}
\end{array}
if b < 1.34999999999999994e-185Initial program 27.6%
Taylor expanded in angle around 0
Applied rewrites31.3%
Taylor expanded in angle around 0
Applied rewrites23.6%
Taylor expanded in angle around 0
Applied rewrites23.5%
Taylor expanded in angle around 0
Applied rewrites23.6%
Taylor expanded in a around 0
Applied rewrites35.6%
Taylor expanded in a around 0
Applied rewrites32.3%
if 1.34999999999999994e-185 < b Initial program 19.7%
Taylor expanded in b around 0
Applied rewrites39.5%
Taylor expanded in a around 0
Applied rewrites41.6%
Taylor expanded in angle around 0
Applied rewrites50.1%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* (pow a_m 2.0) (/ (* -4.0 (/ (pow b 2.0) (pow x-scale 2.0))) (pow y-scale 2.0))))
a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return pow(a_m, 2.0) * ((-4.0 * (pow(b, 2.0) / pow(x_45_scale, 2.0))) / pow(y_45_scale, 2.0));
}
a_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a_m, b, angle, x_45scale, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a_m
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = (a_m ** 2.0d0) * (((-4.0d0) * ((b ** 2.0d0) / (x_45scale ** 2.0d0))) / (y_45scale ** 2.0d0))
end function
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return Math.pow(a_m, 2.0) * ((-4.0 * (Math.pow(b, 2.0) / Math.pow(x_45_scale, 2.0))) / Math.pow(y_45_scale, 2.0));
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return math.pow(a_m, 2.0) * ((-4.0 * (math.pow(b, 2.0) / math.pow(x_45_scale, 2.0))) / math.pow(y_45_scale, 2.0))
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64((a_m ^ 2.0) * Float64(Float64(-4.0 * Float64((b ^ 2.0) / (x_45_scale ^ 2.0))) / (y_45_scale ^ 2.0))) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = (a_m ^ 2.0) * ((-4.0 * ((b ^ 2.0) / (x_45_scale ^ 2.0))) / (y_45_scale ^ 2.0)); end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[Power[a$95$m, 2.0], $MachinePrecision] * N[(N[(-4.0 * N[(N[Power[b, 2.0], $MachinePrecision] / N[Power[x$45$scale, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[y$45$scale, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
{a\_m}^{2} \cdot \frac{-4 \cdot \frac{{b}^{2}}{{x-scale}^{2}}}{{y-scale}^{2}}
\end{array}
Initial program 24.4%
Taylor expanded in b around 0
Applied rewrites40.0%
Taylor expanded in a around 0
Applied rewrites41.3%
Taylor expanded in y-scale around 0
Applied rewrites44.0%
Taylor expanded in angle around 0
Applied rewrites48.2%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* (pow a_m 2.0) (* (pow b 2.0) (/ -4.0 (* (pow x-scale 2.0) (pow y-scale 2.0))))))
a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return pow(a_m, 2.0) * (pow(b, 2.0) * (-4.0 / (pow(x_45_scale, 2.0) * pow(y_45_scale, 2.0))));
}
a_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a_m, b, angle, x_45scale, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a_m
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = (a_m ** 2.0d0) * ((b ** 2.0d0) * ((-4.0d0) / ((x_45scale ** 2.0d0) * (y_45scale ** 2.0d0))))
end function
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return Math.pow(a_m, 2.0) * (Math.pow(b, 2.0) * (-4.0 / (Math.pow(x_45_scale, 2.0) * Math.pow(y_45_scale, 2.0))));
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return math.pow(a_m, 2.0) * (math.pow(b, 2.0) * (-4.0 / (math.pow(x_45_scale, 2.0) * math.pow(y_45_scale, 2.0))))
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64((a_m ^ 2.0) * Float64((b ^ 2.0) * Float64(-4.0 / Float64((x_45_scale ^ 2.0) * (y_45_scale ^ 2.0))))) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = (a_m ^ 2.0) * ((b ^ 2.0) * (-4.0 / ((x_45_scale ^ 2.0) * (y_45_scale ^ 2.0)))); end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[Power[a$95$m, 2.0], $MachinePrecision] * N[(N[Power[b, 2.0], $MachinePrecision] * N[(-4.0 / N[(N[Power[x$45$scale, 2.0], $MachinePrecision] * N[Power[y$45$scale, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
{a\_m}^{2} \cdot \left({b}^{2} \cdot \frac{-4}{{x-scale}^{2} \cdot {y-scale}^{2}}\right)
\end{array}
Initial program 24.4%
Taylor expanded in b around 0
Applied rewrites40.0%
Taylor expanded in a around 0
Applied rewrites41.3%
Taylor expanded in angle around 0
Applied rewrites48.2%
herbie shell --seed 2025121
(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))))