
(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 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI))
(t_1 (sin t_0))
(t_2 (cos t_0))
(t_3
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
y-scale)))
(-
(* t_3 t_3)
(*
(*
4.0
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * ((double) M_PI);
double t_1 = sin(t_0);
double t_2 = cos(t_0);
double t_3 = ((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
return (t_3 * t_3) - ((4.0 * (((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a * t_2), 2.0) + pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * Math.PI;
double t_1 = Math.sin(t_0);
double t_2 = Math.cos(t_0);
double t_3 = ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
return (t_3 * t_3) - ((4.0 * (((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (angle / 180.0) * math.pi t_1 = math.sin(t_0) t_2 = math.cos(t_0) t_3 = ((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale return (t_3 * t_3) - ((4.0 * (((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale))
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(angle / 180.0) * pi) t_1 = sin(t_0) t_2 = cos(t_0) t_3 = Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale) return Float64(Float64(t_3 * t_3) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale))) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (angle / 180.0) * pi; t_1 = sin(t_0); t_2 = cos(t_0); t_3 = ((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale; tmp = (t_3 * t_3) - ((4.0 * (((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale)); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a * t$95$1), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$2), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$1), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := \sin t\_0\\
t_2 := \cos t\_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\\
t\_3 \cdot t\_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale}
\end{array}
\end{array}
(FPCore (a b angle x-scale y-scale) :precision binary64 (let* ((t_0 (* (/ b (* y-scale x-scale)) a))) (* -4.0 (* t_0 t_0))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (b / (y_45_scale * x_45_scale)) * a;
return -4.0 * (t_0 * t_0);
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
t_0 = (b / (y_45scale * x_45scale)) * a
code = (-4.0d0) * (t_0 * t_0)
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (b / (y_45_scale * x_45_scale)) * a;
return -4.0 * (t_0 * t_0);
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (b / (y_45_scale * x_45_scale)) * a return -4.0 * (t_0 * t_0)
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(b / Float64(y_45_scale * x_45_scale)) * a) return Float64(-4.0 * Float64(t_0 * t_0)) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (b / (y_45_scale * x_45_scale)) * a; tmp = -4.0 * (t_0 * t_0); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(b / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]}, N[(-4.0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{y-scale \cdot x-scale} \cdot a\\
-4 \cdot \left(t\_0 \cdot t\_0\right)
\end{array}
\end{array}
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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.1
Applied rewrites51.1%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
unpow2N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6457.5
Applied rewrites57.5%
Applied rewrites93.4%
Final simplification93.4%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ b (* y-scale x-scale))))
(if (<= a 3.8e-164)
(*
(* (/ (* a b) (* (* y-scale y-scale) x-scale)) (/ (* -4.0 a) x-scale))
b)
(if (<= a 6.8e+153)
(* (* t_0 t_0) (* (* a a) -4.0))
(*
(/ 1.0 (* (* (* y-scale x-scale) y-scale) x-scale))
(* (* (* -4.0 b) a) (* a b)))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = b / (y_45_scale * x_45_scale);
double tmp;
if (a <= 3.8e-164) {
tmp = (((a * b) / ((y_45_scale * y_45_scale) * x_45_scale)) * ((-4.0 * a) / x_45_scale)) * b;
} else if (a <= 6.8e+153) {
tmp = (t_0 * t_0) * ((a * a) * -4.0);
} else {
tmp = (1.0 / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (((-4.0 * b) * a) * (a * b));
}
return tmp;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
real(8) :: tmp
t_0 = b / (y_45scale * x_45scale)
if (a <= 3.8d-164) then
tmp = (((a * b) / ((y_45scale * y_45scale) * x_45scale)) * (((-4.0d0) * a) / x_45scale)) * b
else if (a <= 6.8d+153) then
tmp = (t_0 * t_0) * ((a * a) * (-4.0d0))
else
tmp = (1.0d0 / (((y_45scale * x_45scale) * y_45scale) * x_45scale)) * ((((-4.0d0) * b) * a) * (a * b))
end if
code = tmp
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = b / (y_45_scale * x_45_scale);
double tmp;
if (a <= 3.8e-164) {
tmp = (((a * b) / ((y_45_scale * y_45_scale) * x_45_scale)) * ((-4.0 * a) / x_45_scale)) * b;
} else if (a <= 6.8e+153) {
tmp = (t_0 * t_0) * ((a * a) * -4.0);
} else {
tmp = (1.0 / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (((-4.0 * b) * a) * (a * b));
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = b / (y_45_scale * x_45_scale) tmp = 0 if a <= 3.8e-164: tmp = (((a * b) / ((y_45_scale * y_45_scale) * x_45_scale)) * ((-4.0 * a) / x_45_scale)) * b elif a <= 6.8e+153: tmp = (t_0 * t_0) * ((a * a) * -4.0) else: tmp = (1.0 / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (((-4.0 * b) * a) * (a * b)) return tmp
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(b / Float64(y_45_scale * x_45_scale)) tmp = 0.0 if (a <= 3.8e-164) tmp = Float64(Float64(Float64(Float64(a * b) / Float64(Float64(y_45_scale * y_45_scale) * x_45_scale)) * Float64(Float64(-4.0 * a) / x_45_scale)) * b); elseif (a <= 6.8e+153) tmp = Float64(Float64(t_0 * t_0) * Float64(Float64(a * a) * -4.0)); else tmp = Float64(Float64(1.0 / Float64(Float64(Float64(y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * Float64(Float64(Float64(-4.0 * b) * a) * Float64(a * b))); end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) t_0 = b / (y_45_scale * x_45_scale); tmp = 0.0; if (a <= 3.8e-164) tmp = (((a * b) / ((y_45_scale * y_45_scale) * x_45_scale)) * ((-4.0 * a) / x_45_scale)) * b; elseif (a <= 6.8e+153) tmp = (t_0 * t_0) * ((a * a) * -4.0); else tmp = (1.0 / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (((-4.0 * b) * a) * (a * b)); end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(b / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 3.8e-164], N[(N[(N[(N[(a * b), $MachinePrecision] / N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(-4.0 * a), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[a, 6.8e+153], N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-4.0 * b), $MachinePrecision] * a), $MachinePrecision] * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{y-scale \cdot x-scale}\\
\mathbf{if}\;a \leq 3.8 \cdot 10^{-164}:\\
\;\;\;\;\left(\frac{a \cdot b}{\left(y-scale \cdot y-scale\right) \cdot x-scale} \cdot \frac{-4 \cdot a}{x-scale}\right) \cdot b\\
\mathbf{elif}\;a \leq 6.8 \cdot 10^{+153}:\\
\;\;\;\;\left(t\_0 \cdot t\_0\right) \cdot \left(\left(a \cdot a\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(\left(y-scale \cdot x-scale\right) \cdot y-scale\right) \cdot x-scale} \cdot \left(\left(\left(-4 \cdot b\right) \cdot a\right) \cdot \left(a \cdot b\right)\right)\\
\end{array}
\end{array}
if a < 3.79999999999999989e-164Initial program 33.3%
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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6449.8
Applied rewrites49.8%
Applied rewrites71.5%
Applied rewrites62.4%
Applied rewrites76.4%
if 3.79999999999999989e-164 < a < 6.7999999999999995e153Initial program 25.3%
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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6465.9
Applied rewrites65.9%
Applied rewrites92.8%
if 6.7999999999999995e153 < a 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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6429.2
Applied rewrites29.2%
Applied rewrites32.8%
Applied rewrites32.9%
Applied rewrites64.8%
Final simplification78.9%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* (* y-scale x-scale) y-scale) x-scale)))
(if (<= y-scale 2.5e-98)
(* (* (* (/ b t_0) b) (* -4.0 a)) a)
(if (<= y-scale 6.8e+146)
(*
(* (/ (* a b) (* (* y-scale y-scale) x-scale)) (/ (* -4.0 a) x-scale))
b)
(* (/ 1.0 t_0) (* (* (* -4.0 b) a) (* a b)))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = ((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale;
double tmp;
if (y_45_scale <= 2.5e-98) {
tmp = (((b / t_0) * b) * (-4.0 * a)) * a;
} else if (y_45_scale <= 6.8e+146) {
tmp = (((a * b) / ((y_45_scale * y_45_scale) * x_45_scale)) * ((-4.0 * a) / x_45_scale)) * b;
} else {
tmp = (1.0 / t_0) * (((-4.0 * b) * a) * (a * b));
}
return tmp;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
real(8) :: tmp
t_0 = ((y_45scale * x_45scale) * y_45scale) * x_45scale
if (y_45scale <= 2.5d-98) then
tmp = (((b / t_0) * b) * ((-4.0d0) * a)) * a
else if (y_45scale <= 6.8d+146) then
tmp = (((a * b) / ((y_45scale * y_45scale) * x_45scale)) * (((-4.0d0) * a) / x_45scale)) * b
else
tmp = (1.0d0 / t_0) * ((((-4.0d0) * b) * a) * (a * b))
end if
code = tmp
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = ((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale;
double tmp;
if (y_45_scale <= 2.5e-98) {
tmp = (((b / t_0) * b) * (-4.0 * a)) * a;
} else if (y_45_scale <= 6.8e+146) {
tmp = (((a * b) / ((y_45_scale * y_45_scale) * x_45_scale)) * ((-4.0 * a) / x_45_scale)) * b;
} else {
tmp = (1.0 / t_0) * (((-4.0 * b) * a) * (a * b));
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = ((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale tmp = 0 if y_45_scale <= 2.5e-98: tmp = (((b / t_0) * b) * (-4.0 * a)) * a elif y_45_scale <= 6.8e+146: tmp = (((a * b) / ((y_45_scale * y_45_scale) * x_45_scale)) * ((-4.0 * a) / x_45_scale)) * b else: tmp = (1.0 / t_0) * (((-4.0 * b) * a) * (a * b)) return tmp
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(Float64(y_45_scale * x_45_scale) * y_45_scale) * x_45_scale) tmp = 0.0 if (y_45_scale <= 2.5e-98) tmp = Float64(Float64(Float64(Float64(b / t_0) * b) * Float64(-4.0 * a)) * a); elseif (y_45_scale <= 6.8e+146) tmp = Float64(Float64(Float64(Float64(a * b) / Float64(Float64(y_45_scale * y_45_scale) * x_45_scale)) * Float64(Float64(-4.0 * a) / x_45_scale)) * b); else tmp = Float64(Float64(1.0 / t_0) * Float64(Float64(Float64(-4.0 * b) * a) * Float64(a * b))); end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) t_0 = ((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale; tmp = 0.0; if (y_45_scale <= 2.5e-98) tmp = (((b / t_0) * b) * (-4.0 * a)) * a; elseif (y_45_scale <= 6.8e+146) tmp = (((a * b) / ((y_45_scale * y_45_scale) * x_45_scale)) * ((-4.0 * a) / x_45_scale)) * b; else tmp = (1.0 / t_0) * (((-4.0 * b) * a) * (a * b)); end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]}, If[LessEqual[y$45$scale, 2.5e-98], N[(N[(N[(N[(b / t$95$0), $MachinePrecision] * b), $MachinePrecision] * N[(-4.0 * a), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[y$45$scale, 6.8e+146], N[(N[(N[(N[(a * b), $MachinePrecision] / N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(-4.0 * a), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(N[(N[(-4.0 * b), $MachinePrecision] * a), $MachinePrecision] * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(y-scale \cdot x-scale\right) \cdot y-scale\right) \cdot x-scale\\
\mathbf{if}\;y-scale \leq 2.5 \cdot 10^{-98}:\\
\;\;\;\;\left(\left(\frac{b}{t\_0} \cdot b\right) \cdot \left(-4 \cdot a\right)\right) \cdot a\\
\mathbf{elif}\;y-scale \leq 6.8 \cdot 10^{+146}:\\
\;\;\;\;\left(\frac{a \cdot b}{\left(y-scale \cdot y-scale\right) \cdot x-scale} \cdot \frac{-4 \cdot a}{x-scale}\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_0} \cdot \left(\left(\left(-4 \cdot b\right) \cdot a\right) \cdot \left(a \cdot b\right)\right)\\
\end{array}
\end{array}
if y-scale < 2.50000000000000009e-98Initial program 24.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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6447.1
Applied rewrites47.1%
Applied rewrites65.3%
Applied rewrites74.5%
if 2.50000000000000009e-98 < y-scale < 6.79999999999999981e146Initial program 31.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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6468.5
Applied rewrites68.5%
Applied rewrites79.5%
Applied rewrites74.5%
Applied rewrites93.3%
if 6.79999999999999981e146 < y-scale Initial program 36.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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.9
Applied rewrites37.9%
Applied rewrites53.0%
Applied rewrites68.2%
Applied rewrites73.3%
Final simplification79.0%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0
(*
(/ 1.0 (* (* (* y-scale x-scale) y-scale) x-scale))
(* (* (* -4.0 b) a) (* a b)))))
(if (<= a 5.5e-146)
t_0
(if (<= a 5e+151)
(*
(/ (* (* (* -4.0 a) a) b) (* (* y-scale x-scale) (* y-scale x-scale)))
b)
t_0))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (1.0 / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (((-4.0 * b) * a) * (a * b));
double tmp;
if (a <= 5.5e-146) {
tmp = t_0;
} else if (a <= 5e+151) {
tmp = ((((-4.0 * a) * a) * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * b;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 / (((y_45scale * x_45scale) * y_45scale) * x_45scale)) * ((((-4.0d0) * b) * a) * (a * b))
if (a <= 5.5d-146) then
tmp = t_0
else if (a <= 5d+151) then
tmp = (((((-4.0d0) * a) * a) * b) / ((y_45scale * x_45scale) * (y_45scale * x_45scale))) * b
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (1.0 / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (((-4.0 * b) * a) * (a * b));
double tmp;
if (a <= 5.5e-146) {
tmp = t_0;
} else if (a <= 5e+151) {
tmp = ((((-4.0 * a) * a) * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * b;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (1.0 / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (((-4.0 * b) * a) * (a * b)) tmp = 0 if a <= 5.5e-146: tmp = t_0 elif a <= 5e+151: tmp = ((((-4.0 * a) * a) * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * b else: tmp = t_0 return tmp
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(1.0 / Float64(Float64(Float64(y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * Float64(Float64(Float64(-4.0 * b) * a) * Float64(a * b))) tmp = 0.0 if (a <= 5.5e-146) tmp = t_0; elseif (a <= 5e+151) tmp = Float64(Float64(Float64(Float64(Float64(-4.0 * a) * a) * b) / Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale))) * b); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (1.0 / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (((-4.0 * b) * a) * (a * b)); tmp = 0.0; if (a <= 5.5e-146) tmp = t_0; elseif (a <= 5e+151) tmp = ((((-4.0 * a) * a) * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * b; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(1.0 / N[(N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-4.0 * b), $MachinePrecision] * a), $MachinePrecision] * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, 5.5e-146], t$95$0, If[LessEqual[a, 5e+151], N[(N[(N[(N[(N[(-4.0 * a), $MachinePrecision] * a), $MachinePrecision] * b), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\left(\left(y-scale \cdot x-scale\right) \cdot y-scale\right) \cdot x-scale} \cdot \left(\left(\left(-4 \cdot b\right) \cdot a\right) \cdot \left(a \cdot b\right)\right)\\
\mathbf{if}\;a \leq 5.5 \cdot 10^{-146}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 5 \cdot 10^{+151}:\\
\;\;\;\;\frac{\left(\left(-4 \cdot a\right) \cdot a\right) \cdot b}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < 5.49999999999999998e-146 or 5.0000000000000002e151 < a Initial program 27.7%
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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6446.6
Applied rewrites46.6%
Applied rewrites54.4%
Applied rewrites58.7%
Applied rewrites75.9%
if 5.49999999999999998e-146 < a < 5.0000000000000002e151Initial program 26.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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6466.5
Applied rewrites66.5%
Applied rewrites94.0%
Applied rewrites71.6%
Applied rewrites88.5%
Final simplification78.8%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0
(*
(*
(* (/ b (* (* (* y-scale x-scale) y-scale) x-scale)) b)
(* -4.0 a))
a)))
(if (<= y-scale 2.5e-98)
t_0
(if (<= y-scale 4.15e+152)
(*
(* (/ (* a b) (* (* (* y-scale y-scale) x-scale) x-scale)) (* -4.0 a))
b)
t_0))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (((b / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * b) * (-4.0 * a)) * a;
double tmp;
if (y_45_scale <= 2.5e-98) {
tmp = t_0;
} else if (y_45_scale <= 4.15e+152) {
tmp = (((a * b) / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * (-4.0 * a)) * b;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
real(8) :: tmp
t_0 = (((b / (((y_45scale * x_45scale) * y_45scale) * x_45scale)) * b) * ((-4.0d0) * a)) * a
if (y_45scale <= 2.5d-98) then
tmp = t_0
else if (y_45scale <= 4.15d+152) then
tmp = (((a * b) / (((y_45scale * y_45scale) * x_45scale) * x_45scale)) * ((-4.0d0) * a)) * b
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (((b / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * b) * (-4.0 * a)) * a;
double tmp;
if (y_45_scale <= 2.5e-98) {
tmp = t_0;
} else if (y_45_scale <= 4.15e+152) {
tmp = (((a * b) / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * (-4.0 * a)) * b;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (((b / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * b) * (-4.0 * a)) * a tmp = 0 if y_45_scale <= 2.5e-98: tmp = t_0 elif y_45_scale <= 4.15e+152: tmp = (((a * b) / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * (-4.0 * a)) * b else: tmp = t_0 return tmp
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(Float64(Float64(b / Float64(Float64(Float64(y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * b) * Float64(-4.0 * a)) * a) tmp = 0.0 if (y_45_scale <= 2.5e-98) tmp = t_0; elseif (y_45_scale <= 4.15e+152) tmp = Float64(Float64(Float64(Float64(a * b) / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * Float64(-4.0 * a)) * b); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (((b / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * b) * (-4.0 * a)) * a; tmp = 0.0; if (y_45_scale <= 2.5e-98) tmp = t_0; elseif (y_45_scale <= 4.15e+152) tmp = (((a * b) / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * (-4.0 * a)) * b; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(N[(N[(b / N[(N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] * N[(-4.0 * a), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[y$45$scale, 2.5e-98], t$95$0, If[LessEqual[y$45$scale, 4.15e+152], N[(N[(N[(N[(a * b), $MachinePrecision] / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(-4.0 * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(\frac{b}{\left(\left(y-scale \cdot x-scale\right) \cdot y-scale\right) \cdot x-scale} \cdot b\right) \cdot \left(-4 \cdot a\right)\right) \cdot a\\
\mathbf{if}\;y-scale \leq 2.5 \cdot 10^{-98}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y-scale \leq 4.15 \cdot 10^{+152}:\\
\;\;\;\;\left(\frac{a \cdot b}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\right) \cdot x-scale} \cdot \left(-4 \cdot a\right)\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y-scale < 2.50000000000000009e-98 or 4.1500000000000001e152 < y-scale Initial program 26.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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6445.4
Applied rewrites45.4%
Applied rewrites64.0%
Applied rewrites73.9%
if 2.50000000000000009e-98 < y-scale < 4.1500000000000001e152Initial program 31.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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6467.9
Applied rewrites67.9%
Applied rewrites80.1%
Applied rewrites75.2%
Applied rewrites88.8%
Final simplification77.7%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0
(*
(*
(/ (* a b) (* (* (* y-scale y-scale) x-scale) x-scale))
(* -4.0 a))
b)))
(if (<= a 3.8e-164)
t_0
(if (<= a 4e+159)
(*
(/ (* (* (* -4.0 a) a) b) (* (* y-scale x-scale) (* y-scale x-scale)))
b)
t_0))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (((a * b) / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * (-4.0 * a)) * b;
double tmp;
if (a <= 3.8e-164) {
tmp = t_0;
} else if (a <= 4e+159) {
tmp = ((((-4.0 * a) * a) * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * b;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
real(8) :: tmp
t_0 = (((a * b) / (((y_45scale * y_45scale) * x_45scale) * x_45scale)) * ((-4.0d0) * a)) * b
if (a <= 3.8d-164) then
tmp = t_0
else if (a <= 4d+159) then
tmp = (((((-4.0d0) * a) * a) * b) / ((y_45scale * x_45scale) * (y_45scale * x_45scale))) * b
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (((a * b) / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * (-4.0 * a)) * b;
double tmp;
if (a <= 3.8e-164) {
tmp = t_0;
} else if (a <= 4e+159) {
tmp = ((((-4.0 * a) * a) * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * b;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (((a * b) / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * (-4.0 * a)) * b tmp = 0 if a <= 3.8e-164: tmp = t_0 elif a <= 4e+159: tmp = ((((-4.0 * a) * a) * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * b else: tmp = t_0 return tmp
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(Float64(Float64(a * b) / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * Float64(-4.0 * a)) * b) tmp = 0.0 if (a <= 3.8e-164) tmp = t_0; elseif (a <= 4e+159) tmp = Float64(Float64(Float64(Float64(Float64(-4.0 * a) * a) * b) / Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale))) * b); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (((a * b) / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * (-4.0 * a)) * b; tmp = 0.0; if (a <= 3.8e-164) tmp = t_0; elseif (a <= 4e+159) tmp = ((((-4.0 * a) * a) * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * b; else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(N[(N[(a * b), $MachinePrecision] / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(-4.0 * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[a, 3.8e-164], t$95$0, If[LessEqual[a, 4e+159], N[(N[(N[(N[(N[(-4.0 * a), $MachinePrecision] * a), $MachinePrecision] * b), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\frac{a \cdot b}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\right) \cdot x-scale} \cdot \left(-4 \cdot a\right)\right) \cdot b\\
\mathbf{if}\;a \leq 3.8 \cdot 10^{-164}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a \leq 4 \cdot 10^{+159}:\\
\;\;\;\;\frac{\left(\left(-4 \cdot a\right) \cdot a\right) \cdot b}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < 3.79999999999999989e-164 or 3.9999999999999997e159 < a Initial program 28.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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6446.5
Applied rewrites46.5%
Applied rewrites66.5%
Applied rewrites57.7%
Applied rewrites71.8%
if 3.79999999999999989e-164 < a < 3.9999999999999997e159Initial program 25.3%
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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6465.9
Applied rewrites65.9%
Applied rewrites92.8%
Applied rewrites70.9%
Applied rewrites87.7%
Final simplification75.6%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* (* (* (/ a (* y-scale x-scale)) b) (* (/ b (* y-scale x-scale)) a)) -4.0))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (((a / (y_45_scale * x_45_scale)) * b) * ((b / (y_45_scale * x_45_scale)) * a)) * -4.0;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = (((a / (y_45scale * x_45scale)) * b) * ((b / (y_45scale * x_45scale)) * a)) * (-4.0d0)
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (((a / (y_45_scale * x_45_scale)) * b) * ((b / (y_45_scale * x_45_scale)) * a)) * -4.0;
}
def code(a, b, angle, x_45_scale, y_45_scale): return (((a / (y_45_scale * x_45_scale)) * b) * ((b / (y_45_scale * x_45_scale)) * a)) * -4.0
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(Float64(a / Float64(y_45_scale * x_45_scale)) * b) * Float64(Float64(b / Float64(y_45_scale * x_45_scale)) * a)) * -4.0) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = (((a / (y_45_scale * x_45_scale)) * b) * ((b / (y_45_scale * x_45_scale)) * a)) * -4.0; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(N[(a / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] * N[(N[(b / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{a}{y-scale \cdot x-scale} \cdot b\right) \cdot \left(\frac{b}{y-scale \cdot x-scale} \cdot a\right)\right) \cdot -4
\end{array}
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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.1
Applied rewrites51.1%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
unpow2N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6457.5
Applied rewrites57.5%
Applied rewrites93.4%
Applied rewrites92.6%
Final simplification92.6%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* (* (/ (* a b) (* (* (* y-scale y-scale) x-scale) x-scale)) (* -4.0 a)) b))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (((a * b) / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * (-4.0 * a)) * b;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = (((a * b) / (((y_45scale * y_45scale) * x_45scale) * x_45scale)) * ((-4.0d0) * a)) * b
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (((a * b) / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * (-4.0 * a)) * b;
}
def code(a, b, angle, x_45_scale, y_45_scale): return (((a * b) / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * (-4.0 * a)) * b
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(Float64(a * b) / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * Float64(-4.0 * a)) * b) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = (((a * b) / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale)) * (-4.0 * a)) * b; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(N[(a * b), $MachinePrecision] / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(-4.0 * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{a \cdot b}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\right) \cdot x-scale} \cdot \left(-4 \cdot a\right)\right) \cdot b
\end{array}
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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.1
Applied rewrites51.1%
Applied rewrites72.7%
Applied rewrites60.8%
Applied rewrites72.0%
Final simplification72.0%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* (/ (* (* (* a b) a) -4.0) (* (* (* x-scale x-scale) y-scale) y-scale)) b))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return ((((a * b) * a) * -4.0) / (((x_45_scale * x_45_scale) * y_45_scale) * y_45_scale)) * b;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = ((((a * b) * a) * (-4.0d0)) / (((x_45scale * x_45scale) * y_45scale) * y_45scale)) * b
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return ((((a * b) * a) * -4.0) / (((x_45_scale * x_45_scale) * y_45_scale) * y_45_scale)) * b;
}
def code(a, b, angle, x_45_scale, y_45_scale): return ((((a * b) * a) * -4.0) / (((x_45_scale * x_45_scale) * y_45_scale) * y_45_scale)) * b
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(Float64(Float64(a * b) * a) * -4.0) / Float64(Float64(Float64(x_45_scale * x_45_scale) * y_45_scale) * y_45_scale)) * b) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = ((((a * b) * a) * -4.0) / (((x_45_scale * x_45_scale) * y_45_scale) * y_45_scale)) * b; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(N[(N[(a * b), $MachinePrecision] * a), $MachinePrecision] * -4.0), $MachinePrecision] / N[(N[(N[(x$45$scale * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(a \cdot b\right) \cdot a\right) \cdot -4}{\left(\left(x-scale \cdot x-scale\right) \cdot y-scale\right) \cdot y-scale} \cdot b
\end{array}
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
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.1
Applied rewrites51.1%
Applied rewrites72.7%
Applied rewrites60.8%
Taylor expanded in b around 0
Applied rewrites66.6%
Final simplification66.6%
herbie shell --seed 2024240
(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))))