
(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)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
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 11 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)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \mathsf{PI}\left(\right)\\
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 (/ (/ b x-scale) y-scale))
(t_1 (/ (* a_m b) (* y-scale x-scale))))
(if (<= a_m 1.6e+134)
(* (* t_1 t_1) -4.0)
(* (* (* (* t_0 a_m) t_0) a_m) -4.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 = (b / x_45_scale) / y_45_scale;
double t_1 = (a_m * b) / (y_45_scale * x_45_scale);
double tmp;
if (a_m <= 1.6e+134) {
tmp = (t_1 * t_1) * -4.0;
} else {
tmp = (((t_0 * a_m) * t_0) * a_m) * -4.0;
}
return tmp;
}
a_m = abs(a)
real(8) function code(a_m, b, angle, x_45scale, y_45scale)
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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b / x_45scale) / y_45scale
t_1 = (a_m * b) / (y_45scale * x_45scale)
if (a_m <= 1.6d+134) then
tmp = (t_1 * t_1) * (-4.0d0)
else
tmp = (((t_0 * a_m) * t_0) * a_m) * (-4.0d0)
end if
code = tmp
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) {
double t_0 = (b / x_45_scale) / y_45_scale;
double t_1 = (a_m * b) / (y_45_scale * x_45_scale);
double tmp;
if (a_m <= 1.6e+134) {
tmp = (t_1 * t_1) * -4.0;
} else {
tmp = (((t_0 * a_m) * t_0) * a_m) * -4.0;
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = (b / x_45_scale) / y_45_scale t_1 = (a_m * b) / (y_45_scale * x_45_scale) tmp = 0 if a_m <= 1.6e+134: tmp = (t_1 * t_1) * -4.0 else: tmp = (((t_0 * a_m) * t_0) * a_m) * -4.0 return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(b / x_45_scale) / y_45_scale) t_1 = Float64(Float64(a_m * b) / Float64(y_45_scale * x_45_scale)) tmp = 0.0 if (a_m <= 1.6e+134) tmp = Float64(Float64(t_1 * t_1) * -4.0); else tmp = Float64(Float64(Float64(Float64(t_0 * a_m) * t_0) * a_m) * -4.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 = (b / x_45_scale) / y_45_scale; t_1 = (a_m * b) / (y_45_scale * x_45_scale); tmp = 0.0; if (a_m <= 1.6e+134) tmp = (t_1 * t_1) * -4.0; else tmp = (((t_0 * a_m) * t_0) * a_m) * -4.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[(b / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, Block[{t$95$1 = N[(N[(a$95$m * b), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a$95$m, 1.6e+134], N[(N[(t$95$1 * t$95$1), $MachinePrecision] * -4.0), $MachinePrecision], N[(N[(N[(N[(t$95$0 * a$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] * a$95$m), $MachinePrecision] * -4.0), $MachinePrecision]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \frac{\frac{b}{x-scale}}{y-scale}\\
t_1 := \frac{a\_m \cdot b}{y-scale \cdot x-scale}\\
\mathbf{if}\;a\_m \leq 1.6 \cdot 10^{+134}:\\
\;\;\;\;\left(t\_1 \cdot t\_1\right) \cdot -4\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(t\_0 \cdot a\_m\right) \cdot t\_0\right) \cdot a\_m\right) \cdot -4\\
\end{array}
\end{array}
if a < 1.6e134Initial program 25.2%
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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6459.4
Applied rewrites59.4%
Applied rewrites78.2%
Applied rewrites94.7%
if 1.6e134 < 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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6450.8
Applied rewrites50.8%
Applied rewrites71.7%
Applied rewrites86.7%
Applied rewrites92.4%
Final simplification94.3%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0
(*
(/
(* (* a_m b) (* a_m b))
(* (* y-scale y-scale) (* x-scale x-scale)))
-4.0)))
(if (<= b 4.5e-154)
t_0
(if (<= b 4.25e+18)
(*
(/ (* b b) (* (* y-scale x-scale) (* y-scale x-scale)))
(* (* a_m a_m) -4.0))
(if (<= b 1.02e+192)
(*
(* (/ a_m (* (* x-scale x-scale) y-scale)) (/ (* -4.0 a_m) y-scale))
(* b b))
t_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 = (((a_m * b) * (a_m * b)) / ((y_45_scale * y_45_scale) * (x_45_scale * x_45_scale))) * -4.0;
double tmp;
if (b <= 4.5e-154) {
tmp = t_0;
} else if (b <= 4.25e+18) {
tmp = ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0);
} else if (b <= 1.02e+192) {
tmp = ((a_m / ((x_45_scale * x_45_scale) * y_45_scale)) * ((-4.0 * a_m) / y_45_scale)) * (b * b);
} else {
tmp = t_0;
}
return tmp;
}
a_m = abs(a)
real(8) function code(a_m, b, angle, x_45scale, y_45scale)
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
real(8) :: t_0
real(8) :: tmp
t_0 = (((a_m * b) * (a_m * b)) / ((y_45scale * y_45scale) * (x_45scale * x_45scale))) * (-4.0d0)
if (b <= 4.5d-154) then
tmp = t_0
else if (b <= 4.25d+18) then
tmp = ((b * b) / ((y_45scale * x_45scale) * (y_45scale * x_45scale))) * ((a_m * a_m) * (-4.0d0))
else if (b <= 1.02d+192) then
tmp = ((a_m / ((x_45scale * x_45scale) * y_45scale)) * (((-4.0d0) * a_m) / y_45scale)) * (b * b)
else
tmp = t_0
end if
code = tmp
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) {
double t_0 = (((a_m * b) * (a_m * b)) / ((y_45_scale * y_45_scale) * (x_45_scale * x_45_scale))) * -4.0;
double tmp;
if (b <= 4.5e-154) {
tmp = t_0;
} else if (b <= 4.25e+18) {
tmp = ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0);
} else if (b <= 1.02e+192) {
tmp = ((a_m / ((x_45_scale * x_45_scale) * y_45_scale)) * ((-4.0 * a_m) / y_45_scale)) * (b * b);
} else {
tmp = t_0;
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = (((a_m * b) * (a_m * b)) / ((y_45_scale * y_45_scale) * (x_45_scale * x_45_scale))) * -4.0 tmp = 0 if b <= 4.5e-154: tmp = t_0 elif b <= 4.25e+18: tmp = ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0) elif b <= 1.02e+192: tmp = ((a_m / ((x_45_scale * x_45_scale) * y_45_scale)) * ((-4.0 * a_m) / y_45_scale)) * (b * b) else: tmp = t_0 return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(Float64(Float64(a_m * b) * Float64(a_m * b)) / Float64(Float64(y_45_scale * y_45_scale) * Float64(x_45_scale * x_45_scale))) * -4.0) tmp = 0.0 if (b <= 4.5e-154) tmp = t_0; elseif (b <= 4.25e+18) tmp = Float64(Float64(Float64(b * b) / Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale))) * Float64(Float64(a_m * a_m) * -4.0)); elseif (b <= 1.02e+192) tmp = Float64(Float64(Float64(a_m / Float64(Float64(x_45_scale * x_45_scale) * y_45_scale)) * Float64(Float64(-4.0 * a_m) / y_45_scale)) * Float64(b * b)); else tmp = t_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 = (((a_m * b) * (a_m * b)) / ((y_45_scale * y_45_scale) * (x_45_scale * x_45_scale))) * -4.0; tmp = 0.0; if (b <= 4.5e-154) tmp = t_0; elseif (b <= 4.25e+18) tmp = ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0); elseif (b <= 1.02e+192) tmp = ((a_m / ((x_45_scale * x_45_scale) * y_45_scale)) * ((-4.0 * a_m) / y_45_scale)) * (b * b); else tmp = t_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[(N[(a$95$m * b), $MachinePrecision] * N[(a$95$m * b), $MachinePrecision]), $MachinePrecision] / N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]}, If[LessEqual[b, 4.5e-154], t$95$0, If[LessEqual[b, 4.25e+18], N[(N[(N[(b * b), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(a$95$m * a$95$m), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.02e+192], N[(N[(N[(a$95$m / N[(N[(x$45$scale * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(-4.0 * a$95$m), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \frac{\left(a\_m \cdot b\right) \cdot \left(a\_m \cdot b\right)}{\left(y-scale \cdot y-scale\right) \cdot \left(x-scale \cdot x-scale\right)} \cdot -4\\
\mathbf{if}\;b \leq 4.5 \cdot 10^{-154}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 4.25 \cdot 10^{+18}:\\
\;\;\;\;\frac{b \cdot b}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(\left(a\_m \cdot a\_m\right) \cdot -4\right)\\
\mathbf{elif}\;b \leq 1.02 \cdot 10^{+192}:\\
\;\;\;\;\left(\frac{a\_m}{\left(x-scale \cdot x-scale\right) \cdot y-scale} \cdot \frac{-4 \cdot a\_m}{y-scale}\right) \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < 4.4999999999999997e-154 or 1.01999999999999996e192 < b Initial program 22.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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6458.7
Applied rewrites58.7%
Applied rewrites77.0%
Applied rewrites93.4%
Applied rewrites64.5%
if 4.4999999999999997e-154 < b < 4.25e18Initial 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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6465.1
Applied rewrites65.1%
Taylor expanded in b around 0
Applied rewrites87.8%
if 4.25e18 < b < 1.01999999999999996e192Initial program 14.3%
Taylor expanded in b around 0
Applied rewrites41.3%
Taylor expanded in angle around 0
Applied rewrites63.1%
Applied rewrites80.4%
Final simplification69.5%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0
(*
(*
(/ (* a_m b) (* (* x-scale x-scale) y-scale))
(* (/ a_m y-scale) b))
-4.0))
(t_1 (/ b (* y-scale x-scale))))
(if (<= a_m 4.8e-148)
t_0
(if (<= a_m 6e+153) (* (* t_1 t_1) (* (* a_m a_m) -4.0)) t_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 = (((a_m * b) / ((x_45_scale * x_45_scale) * y_45_scale)) * ((a_m / y_45_scale) * b)) * -4.0;
double t_1 = b / (y_45_scale * x_45_scale);
double tmp;
if (a_m <= 4.8e-148) {
tmp = t_0;
} else if (a_m <= 6e+153) {
tmp = (t_1 * t_1) * ((a_m * a_m) * -4.0);
} else {
tmp = t_0;
}
return tmp;
}
a_m = abs(a)
real(8) function code(a_m, b, angle, x_45scale, y_45scale)
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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((a_m * b) / ((x_45scale * x_45scale) * y_45scale)) * ((a_m / y_45scale) * b)) * (-4.0d0)
t_1 = b / (y_45scale * x_45scale)
if (a_m <= 4.8d-148) then
tmp = t_0
else if (a_m <= 6d+153) then
tmp = (t_1 * t_1) * ((a_m * a_m) * (-4.0d0))
else
tmp = t_0
end if
code = tmp
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) {
double t_0 = (((a_m * b) / ((x_45_scale * x_45_scale) * y_45_scale)) * ((a_m / y_45_scale) * b)) * -4.0;
double t_1 = b / (y_45_scale * x_45_scale);
double tmp;
if (a_m <= 4.8e-148) {
tmp = t_0;
} else if (a_m <= 6e+153) {
tmp = (t_1 * t_1) * ((a_m * a_m) * -4.0);
} else {
tmp = t_0;
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = (((a_m * b) / ((x_45_scale * x_45_scale) * y_45_scale)) * ((a_m / y_45_scale) * b)) * -4.0 t_1 = b / (y_45_scale * x_45_scale) tmp = 0 if a_m <= 4.8e-148: tmp = t_0 elif a_m <= 6e+153: tmp = (t_1 * t_1) * ((a_m * a_m) * -4.0) else: tmp = t_0 return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(Float64(Float64(a_m * b) / Float64(Float64(x_45_scale * x_45_scale) * y_45_scale)) * Float64(Float64(a_m / y_45_scale) * b)) * -4.0) t_1 = Float64(b / Float64(y_45_scale * x_45_scale)) tmp = 0.0 if (a_m <= 4.8e-148) tmp = t_0; elseif (a_m <= 6e+153) tmp = Float64(Float64(t_1 * t_1) * Float64(Float64(a_m * a_m) * -4.0)); else tmp = t_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 = (((a_m * b) / ((x_45_scale * x_45_scale) * y_45_scale)) * ((a_m / y_45_scale) * b)) * -4.0; t_1 = b / (y_45_scale * x_45_scale); tmp = 0.0; if (a_m <= 4.8e-148) tmp = t_0; elseif (a_m <= 6e+153) tmp = (t_1 * t_1) * ((a_m * a_m) * -4.0); else tmp = t_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[(N[(a$95$m * b), $MachinePrecision] / N[(N[(x$45$scale * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(a$95$m / y$45$scale), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]}, Block[{t$95$1 = N[(b / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a$95$m, 4.8e-148], t$95$0, If[LessEqual[a$95$m, 6e+153], N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(N[(a$95$m * a$95$m), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \left(\frac{a\_m \cdot b}{\left(x-scale \cdot x-scale\right) \cdot y-scale} \cdot \left(\frac{a\_m}{y-scale} \cdot b\right)\right) \cdot -4\\
t_1 := \frac{b}{y-scale \cdot x-scale}\\
\mathbf{if}\;a\_m \leq 4.8 \cdot 10^{-148}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;a\_m \leq 6 \cdot 10^{+153}:\\
\;\;\;\;\left(t\_1 \cdot t\_1\right) \cdot \left(\left(a\_m \cdot a\_m\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if a < 4.8000000000000002e-148 or 6.00000000000000037e153 < a Initial program 22.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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
Applied rewrites77.0%
Applied rewrites92.3%
Applied rewrites77.8%
if 4.8000000000000002e-148 < a < 6.00000000000000037e153Initial program 16.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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6464.0
Applied rewrites64.0%
Applied rewrites97.8%
Final simplification82.1%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* (* (* -4.0 (/ b x-scale)) (/ a_m y-scale)) (* (/ (/ b x-scale) y-scale) a_m)))
a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return ((-4.0 * (b / x_45_scale)) * (a_m / y_45_scale)) * (((b / x_45_scale) / y_45_scale) * a_m);
}
a_m = abs(a)
real(8) function code(a_m, b, angle, x_45scale, y_45scale)
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 = (((-4.0d0) * (b / x_45scale)) * (a_m / y_45scale)) * (((b / x_45scale) / y_45scale) * a_m)
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 ((-4.0 * (b / x_45_scale)) * (a_m / y_45_scale)) * (((b / x_45_scale) / y_45_scale) * a_m);
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return ((-4.0 * (b / x_45_scale)) * (a_m / y_45_scale)) * (((b / x_45_scale) / y_45_scale) * a_m)
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(-4.0 * Float64(b / x_45_scale)) * Float64(a_m / y_45_scale)) * Float64(Float64(Float64(b / x_45_scale) / y_45_scale) * a_m)) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = ((-4.0 * (b / x_45_scale)) * (a_m / y_45_scale)) * (((b / x_45_scale) / y_45_scale) * a_m); end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(-4.0 * N[(b / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(a$95$m / y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(b / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision] * a$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
\left(\left(-4 \cdot \frac{b}{x-scale}\right) \cdot \frac{a\_m}{y-scale}\right) \cdot \left(\frac{\frac{b}{x-scale}}{y-scale} \cdot a\_m\right)
\end{array}
Initial program 21.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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6458.2
Applied rewrites58.2%
Applied rewrites77.3%
Applied rewrites93.5%
Applied rewrites93.8%
Final simplification93.8%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0
(*
(/
(* (* a_m b) (* a_m b))
(* (* y-scale y-scale) (* x-scale x-scale)))
-4.0)))
(if (<= b 4.5e-154)
t_0
(if (<= b 1.06e+192)
(*
(/ (* b b) (* (* y-scale x-scale) (* y-scale x-scale)))
(* (* a_m a_m) -4.0))
t_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 = (((a_m * b) * (a_m * b)) / ((y_45_scale * y_45_scale) * (x_45_scale * x_45_scale))) * -4.0;
double tmp;
if (b <= 4.5e-154) {
tmp = t_0;
} else if (b <= 1.06e+192) {
tmp = ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0);
} else {
tmp = t_0;
}
return tmp;
}
a_m = abs(a)
real(8) function code(a_m, b, angle, x_45scale, y_45scale)
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
real(8) :: t_0
real(8) :: tmp
t_0 = (((a_m * b) * (a_m * b)) / ((y_45scale * y_45scale) * (x_45scale * x_45scale))) * (-4.0d0)
if (b <= 4.5d-154) then
tmp = t_0
else if (b <= 1.06d+192) then
tmp = ((b * b) / ((y_45scale * x_45scale) * (y_45scale * x_45scale))) * ((a_m * a_m) * (-4.0d0))
else
tmp = t_0
end if
code = tmp
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) {
double t_0 = (((a_m * b) * (a_m * b)) / ((y_45_scale * y_45_scale) * (x_45_scale * x_45_scale))) * -4.0;
double tmp;
if (b <= 4.5e-154) {
tmp = t_0;
} else if (b <= 1.06e+192) {
tmp = ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0);
} else {
tmp = t_0;
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = (((a_m * b) * (a_m * b)) / ((y_45_scale * y_45_scale) * (x_45_scale * x_45_scale))) * -4.0 tmp = 0 if b <= 4.5e-154: tmp = t_0 elif b <= 1.06e+192: tmp = ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0) else: tmp = t_0 return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(Float64(Float64(a_m * b) * Float64(a_m * b)) / Float64(Float64(y_45_scale * y_45_scale) * Float64(x_45_scale * x_45_scale))) * -4.0) tmp = 0.0 if (b <= 4.5e-154) tmp = t_0; elseif (b <= 1.06e+192) tmp = Float64(Float64(Float64(b * b) / Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale))) * Float64(Float64(a_m * a_m) * -4.0)); else tmp = t_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 = (((a_m * b) * (a_m * b)) / ((y_45_scale * y_45_scale) * (x_45_scale * x_45_scale))) * -4.0; tmp = 0.0; if (b <= 4.5e-154) tmp = t_0; elseif (b <= 1.06e+192) tmp = ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0); else tmp = t_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[(N[(a$95$m * b), $MachinePrecision] * N[(a$95$m * b), $MachinePrecision]), $MachinePrecision] / N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]}, If[LessEqual[b, 4.5e-154], t$95$0, If[LessEqual[b, 1.06e+192], N[(N[(N[(b * b), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(a$95$m * a$95$m), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \frac{\left(a\_m \cdot b\right) \cdot \left(a\_m \cdot b\right)}{\left(y-scale \cdot y-scale\right) \cdot \left(x-scale \cdot x-scale\right)} \cdot -4\\
\mathbf{if}\;b \leq 4.5 \cdot 10^{-154}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 1.06 \cdot 10^{+192}:\\
\;\;\;\;\frac{b \cdot b}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(\left(a\_m \cdot a\_m\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < 4.4999999999999997e-154 or 1.06000000000000006e192 < b Initial program 22.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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6458.7
Applied rewrites58.7%
Applied rewrites77.0%
Applied rewrites93.4%
Applied rewrites64.5%
if 4.4999999999999997e-154 < b < 1.06000000000000006e192Initial program 19.8%
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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6456.6
Applied rewrites56.6%
Taylor expanded in b around 0
Applied rewrites71.7%
Final simplification66.4%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ b (* y-scale x-scale))))
(if (<= a_m 5.4e-163)
(*
(/ (* (* a_m b) (* a_m b)) (* (* y-scale y-scale) (* x-scale x-scale)))
-4.0)
(* (* t_0 t_0) (* (* a_m a_m) -4.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 = b / (y_45_scale * x_45_scale);
double tmp;
if (a_m <= 5.4e-163) {
tmp = (((a_m * b) * (a_m * b)) / ((y_45_scale * y_45_scale) * (x_45_scale * x_45_scale))) * -4.0;
} else {
tmp = (t_0 * t_0) * ((a_m * a_m) * -4.0);
}
return tmp;
}
a_m = abs(a)
real(8) function code(a_m, b, angle, x_45scale, y_45scale)
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
real(8) :: t_0
real(8) :: tmp
t_0 = b / (y_45scale * x_45scale)
if (a_m <= 5.4d-163) then
tmp = (((a_m * b) * (a_m * b)) / ((y_45scale * y_45scale) * (x_45scale * x_45scale))) * (-4.0d0)
else
tmp = (t_0 * t_0) * ((a_m * a_m) * (-4.0d0))
end if
code = tmp
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) {
double t_0 = b / (y_45_scale * x_45_scale);
double tmp;
if (a_m <= 5.4e-163) {
tmp = (((a_m * b) * (a_m * b)) / ((y_45_scale * y_45_scale) * (x_45_scale * x_45_scale))) * -4.0;
} else {
tmp = (t_0 * t_0) * ((a_m * a_m) * -4.0);
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = b / (y_45_scale * x_45_scale) tmp = 0 if a_m <= 5.4e-163: tmp = (((a_m * b) * (a_m * b)) / ((y_45_scale * y_45_scale) * (x_45_scale * x_45_scale))) * -4.0 else: tmp = (t_0 * t_0) * ((a_m * a_m) * -4.0) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(b / Float64(y_45_scale * x_45_scale)) tmp = 0.0 if (a_m <= 5.4e-163) tmp = Float64(Float64(Float64(Float64(a_m * b) * Float64(a_m * b)) / Float64(Float64(y_45_scale * y_45_scale) * Float64(x_45_scale * x_45_scale))) * -4.0); else tmp = Float64(Float64(t_0 * t_0) * Float64(Float64(a_m * a_m) * -4.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 = b / (y_45_scale * x_45_scale); tmp = 0.0; if (a_m <= 5.4e-163) tmp = (((a_m * b) * (a_m * b)) / ((y_45_scale * y_45_scale) * (x_45_scale * x_45_scale))) * -4.0; else tmp = (t_0 * t_0) * ((a_m * a_m) * -4.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[(b / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a$95$m, 5.4e-163], N[(N[(N[(N[(a$95$m * b), $MachinePrecision] * N[(a$95$m * b), $MachinePrecision]), $MachinePrecision] / N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision], N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(N[(a$95$m * a$95$m), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \frac{b}{y-scale \cdot x-scale}\\
\mathbf{if}\;a\_m \leq 5.4 \cdot 10^{-163}:\\
\;\;\;\;\frac{\left(a\_m \cdot b\right) \cdot \left(a\_m \cdot b\right)}{\left(y-scale \cdot y-scale\right) \cdot \left(x-scale \cdot x-scale\right)} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot t\_0\right) \cdot \left(\left(a\_m \cdot a\_m\right) \cdot -4\right)\\
\end{array}
\end{array}
if a < 5.40000000000000029e-163Initial program 27.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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6457.2
Applied rewrites57.2%
Applied rewrites77.9%
Applied rewrites93.7%
Applied rewrites64.8%
if 5.40000000000000029e-163 < a Initial program 11.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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6459.9
Applied rewrites59.9%
Applied rewrites81.7%
Final simplification70.8%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= y-scale 6.2e+195)
(*
(/ (* b b) (* (* y-scale x-scale) (* y-scale x-scale)))
(* (* a_m a_m) -4.0))
0.0))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (y_45_scale <= 6.2e+195) {
tmp = ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0);
} else {
tmp = 0.0;
}
return tmp;
}
a_m = abs(a)
real(8) function code(a_m, b, angle, x_45scale, y_45scale)
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
real(8) :: tmp
if (y_45scale <= 6.2d+195) then
tmp = ((b * b) / ((y_45scale * x_45scale) * (y_45scale * x_45scale))) * ((a_m * a_m) * (-4.0d0))
else
tmp = 0.0d0
end if
code = tmp
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) {
double tmp;
if (y_45_scale <= 6.2e+195) {
tmp = ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0);
} else {
tmp = 0.0;
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): tmp = 0 if y_45_scale <= 6.2e+195: tmp = ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0) else: tmp = 0.0 return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 0.0 if (y_45_scale <= 6.2e+195) tmp = Float64(Float64(Float64(b * b) / Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale))) * Float64(Float64(a_m * a_m) * -4.0)); else tmp = 0.0; end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 0.0; if (y_45_scale <= 6.2e+195) tmp = ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0); else tmp = 0.0; end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[y$45$scale, 6.2e+195], N[(N[(N[(b * b), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(a$95$m * a$95$m), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;y-scale \leq 6.2 \cdot 10^{+195}:\\
\;\;\;\;\frac{b \cdot b}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(\left(a\_m \cdot a\_m\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if y-scale < 6.2000000000000004e195Initial program 19.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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6459.5
Applied rewrites59.5%
Taylor expanded in b around 0
Applied rewrites59.5%
if 6.2000000000000004e195 < y-scale Initial program 38.4%
Applied rewrites30.8%
Taylor expanded in a around 0
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgt63.0
Applied rewrites63.0%
Final simplification59.8%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= y-scale 6.2e+195)
(*
(/ (* (* a_m a_m) -4.0) (* (* y-scale x-scale) (* y-scale x-scale)))
(* b b))
0.0))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (y_45_scale <= 6.2e+195) {
tmp = (((a_m * a_m) * -4.0) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * b);
} else {
tmp = 0.0;
}
return tmp;
}
a_m = abs(a)
real(8) function code(a_m, b, angle, x_45scale, y_45scale)
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
real(8) :: tmp
if (y_45scale <= 6.2d+195) then
tmp = (((a_m * a_m) * (-4.0d0)) / ((y_45scale * x_45scale) * (y_45scale * x_45scale))) * (b * b)
else
tmp = 0.0d0
end if
code = tmp
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) {
double tmp;
if (y_45_scale <= 6.2e+195) {
tmp = (((a_m * a_m) * -4.0) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * b);
} else {
tmp = 0.0;
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): tmp = 0 if y_45_scale <= 6.2e+195: tmp = (((a_m * a_m) * -4.0) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * b) else: tmp = 0.0 return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 0.0 if (y_45_scale <= 6.2e+195) tmp = Float64(Float64(Float64(Float64(a_m * a_m) * -4.0) / Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale))) * Float64(b * b)); else tmp = 0.0; end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 0.0; if (y_45_scale <= 6.2e+195) tmp = (((a_m * a_m) * -4.0) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * b); else tmp = 0.0; end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[y$45$scale, 6.2e+195], N[(N[(N[(N[(a$95$m * a$95$m), $MachinePrecision] * -4.0), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;y-scale \leq 6.2 \cdot 10^{+195}:\\
\;\;\;\;\frac{\left(a\_m \cdot a\_m\right) \cdot -4}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if y-scale < 6.2000000000000004e195Initial program 19.5%
Taylor expanded in b around 0
Applied rewrites42.2%
Taylor expanded in angle around 0
Applied rewrites58.5%
if 6.2000000000000004e195 < y-scale Initial program 38.4%
Applied rewrites30.8%
Taylor expanded in a around 0
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgt63.0
Applied rewrites63.0%
Final simplification59.0%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (let* ((t_0 (/ (* a_m b) (* y-scale x-scale)))) (* (* t_0 t_0) -4.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 = (a_m * b) / (y_45_scale * x_45_scale);
return (t_0 * t_0) * -4.0;
}
a_m = abs(a)
real(8) function code(a_m, b, angle, x_45scale, y_45scale)
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
real(8) :: t_0
t_0 = (a_m * b) / (y_45scale * x_45scale)
code = (t_0 * t_0) * (-4.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) {
double t_0 = (a_m * b) / (y_45_scale * x_45_scale);
return (t_0 * t_0) * -4.0;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = (a_m * b) / (y_45_scale * x_45_scale) return (t_0 * t_0) * -4.0
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(a_m * b) / Float64(y_45_scale * x_45_scale)) return Float64(Float64(t_0 * t_0) * -4.0) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = (a_m * b) / (y_45_scale * x_45_scale); tmp = (t_0 * t_0) * -4.0; 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[(a$95$m * b), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$0 * t$95$0), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \frac{a\_m \cdot b}{y-scale \cdot x-scale}\\
\left(t\_0 \cdot t\_0\right) \cdot -4
\end{array}
\end{array}
Initial program 21.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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6458.2
Applied rewrites58.2%
Applied rewrites77.3%
Applied rewrites93.5%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* (* (* (/ a_m (* y-scale x-scale)) b) (/ (* a_m b) (* y-scale x-scale))) -4.0))
a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return (((a_m / (y_45_scale * x_45_scale)) * b) * ((a_m * b) / (y_45_scale * x_45_scale))) * -4.0;
}
a_m = abs(a)
real(8) function code(a_m, b, angle, x_45scale, y_45scale)
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 / (y_45scale * x_45scale)) * b) * ((a_m * b) / (y_45scale * x_45scale))) * (-4.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 (((a_m / (y_45_scale * x_45_scale)) * b) * ((a_m * b) / (y_45_scale * x_45_scale))) * -4.0;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return (((a_m / (y_45_scale * x_45_scale)) * b) * ((a_m * b) / (y_45_scale * x_45_scale))) * -4.0
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(Float64(a_m / Float64(y_45_scale * x_45_scale)) * b) * Float64(Float64(a_m * b) / Float64(y_45_scale * x_45_scale))) * -4.0) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = (((a_m / (y_45_scale * x_45_scale)) * b) * ((a_m * b) / (y_45_scale * x_45_scale))) * -4.0; end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(N[(a$95$m / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision] * N[(N[(a$95$m * b), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
\left(\left(\frac{a\_m}{y-scale \cdot x-scale} \cdot b\right) \cdot \frac{a\_m \cdot b}{y-scale \cdot x-scale}\right) \cdot -4
\end{array}
Initial program 21.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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6458.2
Applied rewrites58.2%
Applied rewrites77.3%
Applied rewrites93.5%
Applied rewrites92.2%
Final simplification92.2%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 0.0)
a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return 0.0;
}
a_m = abs(a)
real(8) function code(a_m, b, angle, x_45scale, y_45scale)
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 = 0.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 0.0;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return 0.0
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return 0.0 end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 0.0; end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := 0.0
\begin{array}{l}
a_m = \left|a\right|
\\
0
\end{array}
Initial program 21.4%
Applied rewrites17.2%
Taylor expanded in a around 0
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgt31.1
Applied rewrites31.1%
herbie shell --seed 2024296
(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))))