
(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}
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(if (<= b_m 1.46e+115)
(*
(* b_m (* (* -4.0 a) (/ a (* x-scale y-scale))))
(/ b_m (* x-scale y-scale)))
(/
(* b_m (/ (* a (* -4.0 (* b_m a))) (* x-scale y-scale)))
(* x-scale y-scale))))b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (b_m <= 1.46e+115) {
tmp = (b_m * ((-4.0 * a) * (a / (x_45_scale * y_45_scale)))) * (b_m / (x_45_scale * y_45_scale));
} else {
tmp = (b_m * ((a * (-4.0 * (b_m * a))) / (x_45_scale * y_45_scale))) / (x_45_scale * y_45_scale);
}
return tmp;
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: tmp
if (b_m <= 1.46d+115) then
tmp = (b_m * (((-4.0d0) * a) * (a / (x_45scale * y_45scale)))) * (b_m / (x_45scale * y_45scale))
else
tmp = (b_m * ((a * ((-4.0d0) * (b_m * a))) / (x_45scale * y_45scale))) / (x_45scale * y_45scale)
end if
code = tmp
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (b_m <= 1.46e+115) {
tmp = (b_m * ((-4.0 * a) * (a / (x_45_scale * y_45_scale)))) * (b_m / (x_45_scale * y_45_scale));
} else {
tmp = (b_m * ((a * (-4.0 * (b_m * a))) / (x_45_scale * y_45_scale))) / (x_45_scale * y_45_scale);
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): tmp = 0 if b_m <= 1.46e+115: tmp = (b_m * ((-4.0 * a) * (a / (x_45_scale * y_45_scale)))) * (b_m / (x_45_scale * y_45_scale)) else: tmp = (b_m * ((a * (-4.0 * (b_m * a))) / (x_45_scale * y_45_scale))) / (x_45_scale * y_45_scale) return tmp
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 0.0 if (b_m <= 1.46e+115) tmp = Float64(Float64(b_m * Float64(Float64(-4.0 * a) * Float64(a / Float64(x_45_scale * y_45_scale)))) * Float64(b_m / Float64(x_45_scale * y_45_scale))); else tmp = Float64(Float64(b_m * Float64(Float64(a * Float64(-4.0 * Float64(b_m * a))) / Float64(x_45_scale * y_45_scale))) / Float64(x_45_scale * y_45_scale)); end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 0.0; if (b_m <= 1.46e+115) tmp = (b_m * ((-4.0 * a) * (a / (x_45_scale * y_45_scale)))) * (b_m / (x_45_scale * y_45_scale)); else tmp = (b_m * ((a * (-4.0 * (b_m * a))) / (x_45_scale * y_45_scale))) / (x_45_scale * y_45_scale); end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[b$95$m, 1.46e+115], N[(N[(b$95$m * N[(N[(-4.0 * a), $MachinePrecision] * N[(a / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b$95$m / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b$95$m * N[(N[(a * N[(-4.0 * N[(b$95$m * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 1.46 \cdot 10^{+115}:\\
\;\;\;\;\left(b\_m \cdot \left(\left(-4 \cdot a\right) \cdot \frac{a}{x-scale \cdot y-scale}\right)\right) \cdot \frac{b\_m}{x-scale \cdot y-scale}\\
\mathbf{else}:\\
\;\;\;\;\frac{b\_m \cdot \frac{a \cdot \left(-4 \cdot \left(b\_m \cdot a\right)\right)}{x-scale \cdot y-scale}}{x-scale \cdot y-scale}\\
\end{array}
\end{array}
if b < 1.46e115Initial program 32.9%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6456.3
Applied rewrites56.3%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6476.1
Applied rewrites76.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites78.5%
associate-*r*N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6487.8
Applied rewrites87.8%
if 1.46e115 < b Initial program 2.5%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6435.6
Applied rewrites35.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6472.8
Applied rewrites72.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites66.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-2negN/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites87.8%
Final simplification87.8%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0
(*
b_m
(*
a
(*
a
(/ (* b_m -4.0) (* (* x-scale y-scale) (* x-scale y-scale))))))))
(if (<= y-scale 2.9e-158)
t_0
(if (<= y-scale 5e+162)
(*
b_m
(*
a
(/ (/ (* -4.0 (* b_m a)) (* x-scale (* y-scale y-scale))) x-scale)))
t_0))))b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = b_m * (a * (a * ((b_m * -4.0) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale)))));
double tmp;
if (y_45_scale <= 2.9e-158) {
tmp = t_0;
} else if (y_45_scale <= 5e+162) {
tmp = b_m * (a * (((-4.0 * (b_m * a)) / (x_45_scale * (y_45_scale * y_45_scale))) / x_45_scale));
} else {
tmp = t_0;
}
return tmp;
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
real(8) :: tmp
t_0 = b_m * (a * (a * ((b_m * (-4.0d0)) / ((x_45scale * y_45scale) * (x_45scale * y_45scale)))))
if (y_45scale <= 2.9d-158) then
tmp = t_0
else if (y_45scale <= 5d+162) then
tmp = b_m * (a * ((((-4.0d0) * (b_m * a)) / (x_45scale * (y_45scale * y_45scale))) / x_45scale))
else
tmp = t_0
end if
code = tmp
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = b_m * (a * (a * ((b_m * -4.0) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale)))));
double tmp;
if (y_45_scale <= 2.9e-158) {
tmp = t_0;
} else if (y_45_scale <= 5e+162) {
tmp = b_m * (a * (((-4.0 * (b_m * a)) / (x_45_scale * (y_45_scale * y_45_scale))) / x_45_scale));
} else {
tmp = t_0;
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): t_0 = b_m * (a * (a * ((b_m * -4.0) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale))))) tmp = 0 if y_45_scale <= 2.9e-158: tmp = t_0 elif y_45_scale <= 5e+162: tmp = b_m * (a * (((-4.0 * (b_m * a)) / (x_45_scale * (y_45_scale * y_45_scale))) / x_45_scale)) else: tmp = t_0 return tmp
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(b_m * Float64(a * Float64(a * Float64(Float64(b_m * -4.0) / Float64(Float64(x_45_scale * y_45_scale) * Float64(x_45_scale * y_45_scale)))))) tmp = 0.0 if (y_45_scale <= 2.9e-158) tmp = t_0; elseif (y_45_scale <= 5e+162) tmp = Float64(b_m * Float64(a * Float64(Float64(Float64(-4.0 * Float64(b_m * a)) / Float64(x_45_scale * Float64(y_45_scale * y_45_scale))) / x_45_scale))); else tmp = t_0; end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale) t_0 = b_m * (a * (a * ((b_m * -4.0) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale))))); tmp = 0.0; if (y_45_scale <= 2.9e-158) tmp = t_0; elseif (y_45_scale <= 5e+162) tmp = b_m * (a * (((-4.0 * (b_m * a)) / (x_45_scale * (y_45_scale * y_45_scale))) / x_45_scale)); else tmp = t_0; end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision]
code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(b$95$m * N[(a * N[(a * N[(N[(b$95$m * -4.0), $MachinePrecision] / N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$45$scale, 2.9e-158], t$95$0, If[LessEqual[y$45$scale, 5e+162], N[(b$95$m * N[(a * N[(N[(N[(-4.0 * N[(b$95$m * a), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := b\_m \cdot \left(a \cdot \left(a \cdot \frac{b\_m \cdot -4}{\left(x-scale \cdot y-scale\right) \cdot \left(x-scale \cdot y-scale\right)}\right)\right)\\
\mathbf{if}\;y-scale \leq 2.9 \cdot 10^{-158}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y-scale \leq 5 \cdot 10^{+162}:\\
\;\;\;\;b\_m \cdot \left(a \cdot \frac{\frac{-4 \cdot \left(b\_m \cdot a\right)}{x-scale \cdot \left(y-scale \cdot y-scale\right)}}{x-scale}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y-scale < 2.8999999999999998e-158 or 4.9999999999999997e162 < y-scale Initial program 29.4%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6454.1
Applied rewrites54.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6461.9
Applied rewrites61.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6471.9
Applied rewrites71.9%
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f6482.1
Applied rewrites82.1%
if 2.8999999999999998e-158 < y-scale < 4.9999999999999997e162Initial program 24.6%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6450.2
Applied rewrites50.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6464.8
Applied rewrites64.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6473.7
Applied rewrites73.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6487.4
Applied rewrites87.4%
Final simplification83.6%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0
(*
b_m
(*
a
(*
a
(/ (* b_m -4.0) (* (* x-scale y-scale) (* x-scale y-scale))))))))
(if (<= x-scale 2.1e-134)
t_0
(if (<= x-scale 2e+105)
(*
(* b_m a)
(/ (* -4.0 (* b_m a)) (* y-scale (* y-scale (* x-scale x-scale)))))
t_0))))b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = b_m * (a * (a * ((b_m * -4.0) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale)))));
double tmp;
if (x_45_scale <= 2.1e-134) {
tmp = t_0;
} else if (x_45_scale <= 2e+105) {
tmp = (b_m * a) * ((-4.0 * (b_m * a)) / (y_45_scale * (y_45_scale * (x_45_scale * x_45_scale))));
} else {
tmp = t_0;
}
return tmp;
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
real(8) :: tmp
t_0 = b_m * (a * (a * ((b_m * (-4.0d0)) / ((x_45scale * y_45scale) * (x_45scale * y_45scale)))))
if (x_45scale <= 2.1d-134) then
tmp = t_0
else if (x_45scale <= 2d+105) then
tmp = (b_m * a) * (((-4.0d0) * (b_m * a)) / (y_45scale * (y_45scale * (x_45scale * x_45scale))))
else
tmp = t_0
end if
code = tmp
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = b_m * (a * (a * ((b_m * -4.0) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale)))));
double tmp;
if (x_45_scale <= 2.1e-134) {
tmp = t_0;
} else if (x_45_scale <= 2e+105) {
tmp = (b_m * a) * ((-4.0 * (b_m * a)) / (y_45_scale * (y_45_scale * (x_45_scale * x_45_scale))));
} else {
tmp = t_0;
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): t_0 = b_m * (a * (a * ((b_m * -4.0) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale))))) tmp = 0 if x_45_scale <= 2.1e-134: tmp = t_0 elif x_45_scale <= 2e+105: tmp = (b_m * a) * ((-4.0 * (b_m * a)) / (y_45_scale * (y_45_scale * (x_45_scale * x_45_scale)))) else: tmp = t_0 return tmp
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(b_m * Float64(a * Float64(a * Float64(Float64(b_m * -4.0) / Float64(Float64(x_45_scale * y_45_scale) * Float64(x_45_scale * y_45_scale)))))) tmp = 0.0 if (x_45_scale <= 2.1e-134) tmp = t_0; elseif (x_45_scale <= 2e+105) tmp = Float64(Float64(b_m * a) * Float64(Float64(-4.0 * Float64(b_m * a)) / Float64(y_45_scale * Float64(y_45_scale * Float64(x_45_scale * x_45_scale))))); else tmp = t_0; end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale) t_0 = b_m * (a * (a * ((b_m * -4.0) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale))))); tmp = 0.0; if (x_45_scale <= 2.1e-134) tmp = t_0; elseif (x_45_scale <= 2e+105) tmp = (b_m * a) * ((-4.0 * (b_m * a)) / (y_45_scale * (y_45_scale * (x_45_scale * x_45_scale)))); else tmp = t_0; end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision]
code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(b$95$m * N[(a * N[(a * N[(N[(b$95$m * -4.0), $MachinePrecision] / N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$45$scale, 2.1e-134], t$95$0, If[LessEqual[x$45$scale, 2e+105], N[(N[(b$95$m * a), $MachinePrecision] * N[(N[(-4.0 * N[(b$95$m * a), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * N[(y$45$scale * N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := b\_m \cdot \left(a \cdot \left(a \cdot \frac{b\_m \cdot -4}{\left(x-scale \cdot y-scale\right) \cdot \left(x-scale \cdot y-scale\right)}\right)\right)\\
\mathbf{if}\;x-scale \leq 2.1 \cdot 10^{-134}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x-scale \leq 2 \cdot 10^{+105}:\\
\;\;\;\;\left(b\_m \cdot a\right) \cdot \frac{-4 \cdot \left(b\_m \cdot a\right)}{y-scale \cdot \left(y-scale \cdot \left(x-scale \cdot x-scale\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x-scale < 2.0999999999999999e-134 or 1.9999999999999999e105 < x-scale Initial program 27.4%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6448.8
Applied rewrites48.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6457.9
Applied rewrites57.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6468.9
Applied rewrites68.9%
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f6476.6
Applied rewrites76.6%
if 2.0999999999999999e-134 < x-scale < 1.9999999999999999e105Initial program 30.4%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6466.7
Applied rewrites66.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6483.4
Applied rewrites83.4%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites83.9%
Applied rewrites96.6%
Final simplification81.3%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(if (<= b_m 5.2e+220)
(*
(* b_m (* (* -4.0 a) (/ a (* x-scale y-scale))))
(/ b_m (* x-scale y-scale)))
(*
(* b_m a)
(/ (* -4.0 (* b_m a)) (* y-scale (* y-scale (* x-scale x-scale)))))))b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (b_m <= 5.2e+220) {
tmp = (b_m * ((-4.0 * a) * (a / (x_45_scale * y_45_scale)))) * (b_m / (x_45_scale * y_45_scale));
} else {
tmp = (b_m * a) * ((-4.0 * (b_m * a)) / (y_45_scale * (y_45_scale * (x_45_scale * x_45_scale))));
}
return tmp;
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: tmp
if (b_m <= 5.2d+220) then
tmp = (b_m * (((-4.0d0) * a) * (a / (x_45scale * y_45scale)))) * (b_m / (x_45scale * y_45scale))
else
tmp = (b_m * a) * (((-4.0d0) * (b_m * a)) / (y_45scale * (y_45scale * (x_45scale * x_45scale))))
end if
code = tmp
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (b_m <= 5.2e+220) {
tmp = (b_m * ((-4.0 * a) * (a / (x_45_scale * y_45_scale)))) * (b_m / (x_45_scale * y_45_scale));
} else {
tmp = (b_m * a) * ((-4.0 * (b_m * a)) / (y_45_scale * (y_45_scale * (x_45_scale * x_45_scale))));
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): tmp = 0 if b_m <= 5.2e+220: tmp = (b_m * ((-4.0 * a) * (a / (x_45_scale * y_45_scale)))) * (b_m / (x_45_scale * y_45_scale)) else: tmp = (b_m * a) * ((-4.0 * (b_m * a)) / (y_45_scale * (y_45_scale * (x_45_scale * x_45_scale)))) return tmp
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 0.0 if (b_m <= 5.2e+220) tmp = Float64(Float64(b_m * Float64(Float64(-4.0 * a) * Float64(a / Float64(x_45_scale * y_45_scale)))) * Float64(b_m / Float64(x_45_scale * y_45_scale))); else tmp = Float64(Float64(b_m * a) * Float64(Float64(-4.0 * Float64(b_m * a)) / Float64(y_45_scale * Float64(y_45_scale * Float64(x_45_scale * x_45_scale))))); end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 0.0; if (b_m <= 5.2e+220) tmp = (b_m * ((-4.0 * a) * (a / (x_45_scale * y_45_scale)))) * (b_m / (x_45_scale * y_45_scale)); else tmp = (b_m * a) * ((-4.0 * (b_m * a)) / (y_45_scale * (y_45_scale * (x_45_scale * x_45_scale)))); end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[b$95$m, 5.2e+220], N[(N[(b$95$m * N[(N[(-4.0 * a), $MachinePrecision] * N[(a / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b$95$m / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b$95$m * a), $MachinePrecision] * N[(N[(-4.0 * N[(b$95$m * a), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * N[(y$45$scale * N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 5.2 \cdot 10^{+220}:\\
\;\;\;\;\left(b\_m \cdot \left(\left(-4 \cdot a\right) \cdot \frac{a}{x-scale \cdot y-scale}\right)\right) \cdot \frac{b\_m}{x-scale \cdot y-scale}\\
\mathbf{else}:\\
\;\;\;\;\left(b\_m \cdot a\right) \cdot \frac{-4 \cdot \left(b\_m \cdot a\right)}{y-scale \cdot \left(y-scale \cdot \left(x-scale \cdot x-scale\right)\right)}\\
\end{array}
\end{array}
if b < 5.19999999999999988e220Initial program 30.4%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6453.9
Applied rewrites53.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6476.6
Applied rewrites76.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites78.3%
associate-*r*N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6487.2
Applied rewrites87.2%
if 5.19999999999999988e220 < b Initial program 0.0%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6442.1
Applied rewrites42.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6463.5
Applied rewrites63.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites55.7%
Applied rewrites84.4%
Final simplification87.0%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* b_m (* a (* a (/ (* b_m -4.0) (* (* x-scale y-scale) (* x-scale y-scale)))))))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return b_m * (a * (a * ((b_m * -4.0) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale)))));
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = b_m * (a * (a * ((b_m * (-4.0d0)) / ((x_45scale * y_45scale) * (x_45scale * y_45scale)))))
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return b_m * (a * (a * ((b_m * -4.0) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale)))));
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): return b_m * (a * (a * ((b_m * -4.0) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale)))))
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) return Float64(b_m * Float64(a * Float64(a * Float64(Float64(b_m * -4.0) / Float64(Float64(x_45_scale * y_45_scale) * Float64(x_45_scale * y_45_scale)))))) end
b_m = abs(b); function tmp = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = b_m * (a * (a * ((b_m * -4.0) / ((x_45_scale * y_45_scale) * (x_45_scale * y_45_scale))))); end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := N[(b$95$m * N[(a * N[(a * N[(N[(b$95$m * -4.0), $MachinePrecision] / N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
b\_m \cdot \left(a \cdot \left(a \cdot \frac{b\_m \cdot -4}{\left(x-scale \cdot y-scale\right) \cdot \left(x-scale \cdot y-scale\right)}\right)\right)
\end{array}
Initial program 28.1%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6453.0
Applied rewrites53.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6462.7
Applied rewrites62.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6472.4
Applied rewrites72.4%
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
unswap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f6479.8
Applied rewrites79.8%
Final simplification79.8%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* b_m (* a (* a (/ (* b_m -4.0) (* x-scale (* y-scale (* x-scale y-scale))))))))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return b_m * (a * (a * ((b_m * -4.0) / (x_45_scale * (y_45_scale * (x_45_scale * y_45_scale))))));
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = b_m * (a * (a * ((b_m * (-4.0d0)) / (x_45scale * (y_45scale * (x_45scale * y_45scale))))))
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return b_m * (a * (a * ((b_m * -4.0) / (x_45_scale * (y_45_scale * (x_45_scale * y_45_scale))))));
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): return b_m * (a * (a * ((b_m * -4.0) / (x_45_scale * (y_45_scale * (x_45_scale * y_45_scale))))))
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) return Float64(b_m * Float64(a * Float64(a * Float64(Float64(b_m * -4.0) / Float64(x_45_scale * Float64(y_45_scale * Float64(x_45_scale * y_45_scale))))))) end
b_m = abs(b); function tmp = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = b_m * (a * (a * ((b_m * -4.0) / (x_45_scale * (y_45_scale * (x_45_scale * y_45_scale)))))); end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := N[(b$95$m * N[(a * N[(a * N[(N[(b$95$m * -4.0), $MachinePrecision] / N[(x$45$scale * N[(y$45$scale * N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
b\_m \cdot \left(a \cdot \left(a \cdot \frac{b\_m \cdot -4}{x-scale \cdot \left(y-scale \cdot \left(x-scale \cdot y-scale\right)\right)}\right)\right)
\end{array}
Initial program 28.1%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6453.0
Applied rewrites53.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6462.7
Applied rewrites62.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6472.4
Applied rewrites72.4%
associate-*r*N/A
lift-*.f64N/A
lower-*.f6476.3
Applied rewrites76.3%
Final simplification76.3%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* b_m (* a (* a (/ (* b_m -4.0) (* x-scale (* x-scale (* y-scale y-scale))))))))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return b_m * (a * (a * ((b_m * -4.0) / (x_45_scale * (x_45_scale * (y_45_scale * y_45_scale))))));
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = b_m * (a * (a * ((b_m * (-4.0d0)) / (x_45scale * (x_45scale * (y_45scale * y_45scale))))))
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return b_m * (a * (a * ((b_m * -4.0) / (x_45_scale * (x_45_scale * (y_45_scale * y_45_scale))))));
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): return b_m * (a * (a * ((b_m * -4.0) / (x_45_scale * (x_45_scale * (y_45_scale * y_45_scale))))))
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) return Float64(b_m * Float64(a * Float64(a * Float64(Float64(b_m * -4.0) / Float64(x_45_scale * Float64(x_45_scale * Float64(y_45_scale * y_45_scale))))))) end
b_m = abs(b); function tmp = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = b_m * (a * (a * ((b_m * -4.0) / (x_45_scale * (x_45_scale * (y_45_scale * y_45_scale)))))); end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := N[(b$95$m * N[(a * N[(a * N[(N[(b$95$m * -4.0), $MachinePrecision] / N[(x$45$scale * N[(x$45$scale * N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
b\_m \cdot \left(a \cdot \left(a \cdot \frac{b\_m \cdot -4}{x-scale \cdot \left(x-scale \cdot \left(y-scale \cdot y-scale\right)\right)}\right)\right)
\end{array}
Initial program 28.1%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6453.0
Applied rewrites53.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6462.7
Applied rewrites62.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6472.4
Applied rewrites72.4%
Final simplification72.4%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 0.0)
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return 0.0;
}
b_m = abs(b)
real(8) function code(a, b_m, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = 0.0d0
end function
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return 0.0;
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): return 0.0
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) return 0.0 end
b_m = abs(b); function tmp = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 0.0; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := 0.0
\begin{array}{l}
b_m = \left|b\right|
\\
0
\end{array}
Initial program 28.1%
Taylor expanded in angle around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
unpow2N/A
difference-of-squaresN/A
lower-*.f64N/A
lower-+.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f6428.7
Applied rewrites28.7%
Applied rewrites31.0%
Taylor expanded in b around inf
lower-*.f64N/A
lower-pow.f64N/A
sub-negN/A
lower-fma.f64N/A
Applied rewrites35.5%
Taylor expanded in angle around 0
associate-*r*N/A
associate-/l*N/A
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
div0N/A
mul0-rgt40.9
Applied rewrites40.9%
herbie shell --seed 2024216
(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))))