
(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 10 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 y-scale) x-scale) a_m))
(t_1 (/ (* b a_m) (* y-scale x-scale))))
(if (<= a_m 8e-147) (* -4.0 (* t_1 t_1)) (* (* 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 = ((b / y_45_scale) / x_45_scale) * a_m;
double t_1 = (b * a_m) / (y_45_scale * x_45_scale);
double tmp;
if (a_m <= 8e-147) {
tmp = -4.0 * (t_1 * t_1);
} else {
tmp = (t_0 * t_0) * -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 / y_45scale) / x_45scale) * a_m
t_1 = (b * a_m) / (y_45scale * x_45scale)
if (a_m <= 8d-147) then
tmp = (-4.0d0) * (t_1 * t_1)
else
tmp = (t_0 * t_0) * (-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) * a_m;
double t_1 = (b * a_m) / (y_45_scale * x_45_scale);
double tmp;
if (a_m <= 8e-147) {
tmp = -4.0 * (t_1 * t_1);
} else {
tmp = (t_0 * t_0) * -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) * a_m t_1 = (b * a_m) / (y_45_scale * x_45_scale) tmp = 0 if a_m <= 8e-147: tmp = -4.0 * (t_1 * t_1) else: tmp = (t_0 * t_0) * -4.0 return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(Float64(b / y_45_scale) / x_45_scale) * a_m) t_1 = Float64(Float64(b * a_m) / Float64(y_45_scale * x_45_scale)) tmp = 0.0 if (a_m <= 8e-147) tmp = Float64(-4.0 * Float64(t_1 * t_1)); else tmp = Float64(Float64(t_0 * t_0) * -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) * a_m; t_1 = (b * a_m) / (y_45_scale * x_45_scale); tmp = 0.0; if (a_m <= 8e-147) tmp = -4.0 * (t_1 * t_1); else tmp = (t_0 * t_0) * -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[(N[(b / y$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision] * a$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b * a$95$m), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a$95$m, 8e-147], N[(-4.0 * N[(t$95$1 * t$95$1), $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{\frac{b}{y-scale}}{x-scale} \cdot a\_m\\
t_1 := \frac{b \cdot a\_m}{y-scale \cdot x-scale}\\
\mathbf{if}\;a\_m \leq 8 \cdot 10^{-147}:\\
\;\;\;\;-4 \cdot \left(t\_1 \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot t\_0\right) \cdot -4\\
\end{array}
\end{array}
if a < 7.9999999999999998e-147Initial 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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6442.3
Applied rewrites42.3%
Applied rewrites74.1%
Applied rewrites95.0%
if 7.9999999999999998e-147 < a Initial program 17.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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6461.7
Applied rewrites61.7%
Applied rewrites72.8%
Applied rewrites96.1%
Final simplification95.4%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0
(*
(*
(/ (* b a_m) (* (* y-scale x-scale) (* y-scale x-scale)))
(* b a_m))
-4.0)))
(if (<= x-scale 3.55e-147)
t_0
(if (<= x-scale 2e+129)
(*
(* (/ (* b a_m) (* (* x-scale x-scale) y-scale)) (/ (* b a_m) y-scale))
-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 = (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -4.0;
double tmp;
if (x_45_scale <= 3.55e-147) {
tmp = t_0;
} else if (x_45_scale <= 2e+129) {
tmp = (((b * a_m) / ((x_45_scale * x_45_scale) * y_45_scale)) * ((b * a_m) / y_45_scale)) * -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 = (((b * a_m) / ((y_45scale * x_45scale) * (y_45scale * x_45scale))) * (b * a_m)) * (-4.0d0)
if (x_45scale <= 3.55d-147) then
tmp = t_0
else if (x_45scale <= 2d+129) then
tmp = (((b * a_m) / ((x_45scale * x_45scale) * y_45scale)) * ((b * a_m) / y_45scale)) * (-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 = (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -4.0;
double tmp;
if (x_45_scale <= 3.55e-147) {
tmp = t_0;
} else if (x_45_scale <= 2e+129) {
tmp = (((b * a_m) / ((x_45_scale * x_45_scale) * y_45_scale)) * ((b * a_m) / y_45_scale)) * -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 = (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -4.0 tmp = 0 if x_45_scale <= 3.55e-147: tmp = t_0 elif x_45_scale <= 2e+129: tmp = (((b * a_m) / ((x_45_scale * x_45_scale) * y_45_scale)) * ((b * a_m) / y_45_scale)) * -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(b * a_m) / Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale))) * Float64(b * a_m)) * -4.0) tmp = 0.0 if (x_45_scale <= 3.55e-147) tmp = t_0; elseif (x_45_scale <= 2e+129) tmp = Float64(Float64(Float64(Float64(b * a_m) / Float64(Float64(x_45_scale * x_45_scale) * y_45_scale)) * Float64(Float64(b * a_m) / y_45_scale)) * -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 = (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -4.0; tmp = 0.0; if (x_45_scale <= 3.55e-147) tmp = t_0; elseif (x_45_scale <= 2e+129) tmp = (((b * a_m) / ((x_45_scale * x_45_scale) * y_45_scale)) * ((b * a_m) / y_45_scale)) * -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[(b * a$95$m), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * a$95$m), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]}, If[LessEqual[x$45$scale, 3.55e-147], t$95$0, If[LessEqual[x$45$scale, 2e+129], N[(N[(N[(N[(b * a$95$m), $MachinePrecision] / N[(N[(x$45$scale * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(b * a$95$m), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \left(\frac{b \cdot a\_m}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(b \cdot a\_m\right)\right) \cdot -4\\
\mathbf{if}\;x-scale \leq 3.55 \cdot 10^{-147}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x-scale \leq 2 \cdot 10^{+129}:\\
\;\;\;\;\left(\frac{b \cdot a\_m}{\left(x-scale \cdot x-scale\right) \cdot y-scale} \cdot \frac{b \cdot a\_m}{y-scale}\right) \cdot -4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x-scale < 3.55000000000000008e-147 or 2e129 < x-scale Initial program 22.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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6446.6
Applied rewrites46.6%
Applied rewrites71.0%
Applied rewrites78.3%
Applied rewrites78.3%
if 3.55000000000000008e-147 < x-scale < 2e129Initial program 23.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.4
Applied rewrites58.4%
Applied rewrites82.2%
Applied rewrites95.9%
Final simplification82.5%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0
(*
(*
(/ (* b a_m) (* (* y-scale x-scale) (* y-scale x-scale)))
(* b a_m))
-4.0)))
(if (<= y-scale 4.2e-132)
t_0
(if (<= y-scale 3.1e+154)
(*
(* (/ (* b a_m) x-scale) (* (/ a_m (* (* y-scale y-scale) x-scale)) b))
-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 = (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -4.0;
double tmp;
if (y_45_scale <= 4.2e-132) {
tmp = t_0;
} else if (y_45_scale <= 3.1e+154) {
tmp = (((b * a_m) / x_45_scale) * ((a_m / ((y_45_scale * y_45_scale) * x_45_scale)) * b)) * -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 = (((b * a_m) / ((y_45scale * x_45scale) * (y_45scale * x_45scale))) * (b * a_m)) * (-4.0d0)
if (y_45scale <= 4.2d-132) then
tmp = t_0
else if (y_45scale <= 3.1d+154) then
tmp = (((b * a_m) / x_45scale) * ((a_m / ((y_45scale * y_45scale) * x_45scale)) * b)) * (-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 = (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -4.0;
double tmp;
if (y_45_scale <= 4.2e-132) {
tmp = t_0;
} else if (y_45_scale <= 3.1e+154) {
tmp = (((b * a_m) / x_45_scale) * ((a_m / ((y_45_scale * y_45_scale) * x_45_scale)) * b)) * -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 = (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -4.0 tmp = 0 if y_45_scale <= 4.2e-132: tmp = t_0 elif y_45_scale <= 3.1e+154: tmp = (((b * a_m) / x_45_scale) * ((a_m / ((y_45_scale * y_45_scale) * x_45_scale)) * b)) * -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(b * a_m) / Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale))) * Float64(b * a_m)) * -4.0) tmp = 0.0 if (y_45_scale <= 4.2e-132) tmp = t_0; elseif (y_45_scale <= 3.1e+154) tmp = Float64(Float64(Float64(Float64(b * a_m) / x_45_scale) * Float64(Float64(a_m / Float64(Float64(y_45_scale * y_45_scale) * x_45_scale)) * b)) * -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 = (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -4.0; tmp = 0.0; if (y_45_scale <= 4.2e-132) tmp = t_0; elseif (y_45_scale <= 3.1e+154) tmp = (((b * a_m) / x_45_scale) * ((a_m / ((y_45_scale * y_45_scale) * x_45_scale)) * b)) * -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[(b * a$95$m), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * a$95$m), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]}, If[LessEqual[y$45$scale, 4.2e-132], t$95$0, If[LessEqual[y$45$scale, 3.1e+154], N[(N[(N[(N[(b * a$95$m), $MachinePrecision] / x$45$scale), $MachinePrecision] * N[(N[(a$95$m / N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \left(\frac{b \cdot a\_m}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(b \cdot a\_m\right)\right) \cdot -4\\
\mathbf{if}\;y-scale \leq 4.2 \cdot 10^{-132}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y-scale \leq 3.1 \cdot 10^{+154}:\\
\;\;\;\;\left(\frac{b \cdot a\_m}{x-scale} \cdot \left(\frac{a\_m}{\left(y-scale \cdot y-scale\right) \cdot x-scale} \cdot b\right)\right) \cdot -4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y-scale < 4.2000000000000002e-132 or 3.1000000000000001e154 < y-scale Initial program 23.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-*.f6449.6
Applied rewrites49.6%
Applied rewrites73.4%
Applied rewrites80.2%
Applied rewrites80.2%
if 4.2000000000000002e-132 < y-scale < 3.1000000000000001e154Initial program 19.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-*.f6448.5
Applied rewrites48.5%
Applied rewrites74.3%
Applied rewrites89.9%
Applied rewrites86.8%
Final simplification81.7%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ b (* y-scale x-scale)))
(t_1
(*
(*
(/ (* b a_m) (* (* y-scale x-scale) (* y-scale x-scale)))
(* b a_m))
-4.0)))
(if (<= a_m 2.9e-154)
t_1
(if (<= a_m 1.6e+83) (* (* t_0 t_0) (* (* a_m a_m) -4.0)) t_1))))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 t_1 = (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -4.0;
double tmp;
if (a_m <= 2.9e-154) {
tmp = t_1;
} else if (a_m <= 1.6e+83) {
tmp = (t_0 * t_0) * ((a_m * a_m) * -4.0);
} else {
tmp = t_1;
}
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 / (y_45scale * x_45scale)
t_1 = (((b * a_m) / ((y_45scale * x_45scale) * (y_45scale * x_45scale))) * (b * a_m)) * (-4.0d0)
if (a_m <= 2.9d-154) then
tmp = t_1
else if (a_m <= 1.6d+83) then
tmp = (t_0 * t_0) * ((a_m * a_m) * (-4.0d0))
else
tmp = t_1
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 t_1 = (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -4.0;
double tmp;
if (a_m <= 2.9e-154) {
tmp = t_1;
} else if (a_m <= 1.6e+83) {
tmp = (t_0 * t_0) * ((a_m * a_m) * -4.0);
} else {
tmp = t_1;
}
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) t_1 = (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -4.0 tmp = 0 if a_m <= 2.9e-154: tmp = t_1 elif a_m <= 1.6e+83: tmp = (t_0 * t_0) * ((a_m * a_m) * -4.0) else: tmp = t_1 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)) t_1 = Float64(Float64(Float64(Float64(b * a_m) / Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale))) * Float64(b * a_m)) * -4.0) tmp = 0.0 if (a_m <= 2.9e-154) tmp = t_1; elseif (a_m <= 1.6e+83) tmp = Float64(Float64(t_0 * t_0) * Float64(Float64(a_m * a_m) * -4.0)); else tmp = t_1; 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); t_1 = (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -4.0; tmp = 0.0; if (a_m <= 2.9e-154) tmp = t_1; elseif (a_m <= 1.6e+83) tmp = (t_0 * t_0) * ((a_m * a_m) * -4.0); else tmp = t_1; 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]}, Block[{t$95$1 = N[(N[(N[(N[(b * a$95$m), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * a$95$m), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]}, If[LessEqual[a$95$m, 2.9e-154], t$95$1, If[LessEqual[a$95$m, 1.6e+83], N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(N[(a$95$m * a$95$m), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \frac{b}{y-scale \cdot x-scale}\\
t_1 := \left(\frac{b \cdot a\_m}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(b \cdot a\_m\right)\right) \cdot -4\\
\mathbf{if}\;a\_m \leq 2.9 \cdot 10^{-154}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a\_m \leq 1.6 \cdot 10^{+83}:\\
\;\;\;\;\left(t\_0 \cdot t\_0\right) \cdot \left(\left(a\_m \cdot a\_m\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < 2.9e-154 or 1.5999999999999999e83 < a Initial program 21.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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6445.2
Applied rewrites45.2%
Applied rewrites74.2%
Applied rewrites79.9%
Applied rewrites79.9%
if 2.9e-154 < a < 1.5999999999999999e83Initial program 23.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-*.f6464.7
Applied rewrites64.7%
Applied rewrites90.4%
Final simplification82.2%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= y-scale 3.5e-226)
(*
(* (/ (* b a_m) (* (* (* y-scale x-scale) x-scale) y-scale)) (* b a_m))
-4.0)
(*
(* (/ (* b a_m) (* (* (* y-scale x-scale) y-scale) x-scale)) (* b 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 tmp;
if (y_45_scale <= 3.5e-226) {
tmp = (((b * a_m) / (((y_45_scale * x_45_scale) * x_45_scale) * y_45_scale)) * (b * a_m)) * -4.0;
} else {
tmp = (((b * a_m) / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (b * 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) :: tmp
if (y_45scale <= 3.5d-226) then
tmp = (((b * a_m) / (((y_45scale * x_45scale) * x_45scale) * y_45scale)) * (b * a_m)) * (-4.0d0)
else
tmp = (((b * a_m) / (((y_45scale * x_45scale) * y_45scale) * x_45scale)) * (b * 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 tmp;
if (y_45_scale <= 3.5e-226) {
tmp = (((b * a_m) / (((y_45_scale * x_45_scale) * x_45_scale) * y_45_scale)) * (b * a_m)) * -4.0;
} else {
tmp = (((b * a_m) / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (b * a_m)) * -4.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 <= 3.5e-226: tmp = (((b * a_m) / (((y_45_scale * x_45_scale) * x_45_scale) * y_45_scale)) * (b * a_m)) * -4.0 else: tmp = (((b * a_m) / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (b * a_m)) * -4.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 <= 3.5e-226) tmp = Float64(Float64(Float64(Float64(b * a_m) / Float64(Float64(Float64(y_45_scale * x_45_scale) * x_45_scale) * y_45_scale)) * Float64(b * a_m)) * -4.0); else tmp = Float64(Float64(Float64(Float64(b * a_m) / Float64(Float64(Float64(y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * Float64(b * 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) tmp = 0.0; if (y_45_scale <= 3.5e-226) tmp = (((b * a_m) / (((y_45_scale * x_45_scale) * x_45_scale) * y_45_scale)) * (b * a_m)) * -4.0; else tmp = (((b * a_m) / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (b * 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_] := If[LessEqual[y$45$scale, 3.5e-226], N[(N[(N[(N[(b * a$95$m), $MachinePrecision] / N[(N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(b * a$95$m), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision], N[(N[(N[(N[(b * a$95$m), $MachinePrecision] / N[(N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(b * a$95$m), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;y-scale \leq 3.5 \cdot 10^{-226}:\\
\;\;\;\;\left(\frac{b \cdot a\_m}{\left(\left(y-scale \cdot x-scale\right) \cdot x-scale\right) \cdot y-scale} \cdot \left(b \cdot a\_m\right)\right) \cdot -4\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{b \cdot a\_m}{\left(\left(y-scale \cdot x-scale\right) \cdot y-scale\right) \cdot x-scale} \cdot \left(b \cdot a\_m\right)\right) \cdot -4\\
\end{array}
\end{array}
if y-scale < 3.5e-226Initial program 20.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-*.f6455.3
Applied rewrites55.3%
Applied rewrites75.4%
Applied rewrites82.4%
Applied rewrites79.8%
if 3.5e-226 < y-scale Initial program 24.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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6441.7
Applied rewrites41.7%
Applied rewrites71.3%
Applied rewrites75.3%
Taylor expanded in x-scale around 0
Applied rewrites73.7%
Final simplification77.2%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (let* ((t_0 (/ (* b a_m) (* y-scale x-scale)))) (* -4.0 (* t_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 = (b * a_m) / (y_45_scale * x_45_scale);
return -4.0 * (t_0 * t_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 = (b * a_m) / (y_45scale * x_45scale)
code = (-4.0d0) * (t_0 * t_0)
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 * a_m) / (y_45_scale * x_45_scale);
return -4.0 * (t_0 * t_0);
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = (b * a_m) / (y_45_scale * x_45_scale) return -4.0 * (t_0 * t_0)
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(b * a_m) / Float64(y_45_scale * x_45_scale)) return Float64(-4.0 * Float64(t_0 * t_0)) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = (b * a_m) / (y_45_scale * x_45_scale); tmp = -4.0 * (t_0 * t_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[(b * a$95$m), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, N[(-4.0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \frac{b \cdot a\_m}{y-scale \cdot x-scale}\\
-4 \cdot \left(t\_0 \cdot t\_0\right)
\end{array}
\end{array}
Initial program 22.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-*.f6449.4
Applied rewrites49.4%
Applied rewrites73.6%
Applied rewrites93.8%
Final simplification93.8%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* (* (* (/ a_m (* y-scale x-scale)) b) (/ (* b a_m) (* 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) * ((b * a_m) / (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) * ((b * a_m) / (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) * ((b * a_m) / (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) * ((b * a_m) / (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(b * a_m) / 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) * ((b * a_m) / (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[(b * a$95$m), $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{b \cdot a\_m}{y-scale \cdot x-scale}\right) \cdot -4
\end{array}
Initial program 22.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-*.f6449.4
Applied rewrites49.4%
Applied rewrites73.6%
Applied rewrites93.8%
Applied rewrites91.5%
Final simplification91.5%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* (* (/ (* b a_m) (* (* y-scale x-scale) (* y-scale x-scale))) (* b 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) {
return (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -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 = (((b * a_m) / ((y_45scale * x_45scale) * (y_45scale * x_45scale))) * (b * a_m)) * (-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 (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -4.0;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -4.0
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(Float64(b * a_m) / Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale))) * Float64(b * a_m)) * -4.0) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = (((b * a_m) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * a_m)) * -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[(b * a$95$m), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * a$95$m), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
\left(\frac{b \cdot a\_m}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(b \cdot a\_m\right)\right) \cdot -4
\end{array}
Initial program 22.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-*.f6449.4
Applied rewrites49.4%
Applied rewrites73.6%
Applied rewrites79.3%
Applied rewrites79.3%
Final simplification79.3%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* (* (/ (* b a_m) (* (* (* y-scale x-scale) y-scale) x-scale)) (* b 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) {
return (((b * a_m) / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (b * a_m)) * -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 = (((b * a_m) / (((y_45scale * x_45scale) * y_45scale) * x_45scale)) * (b * a_m)) * (-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 (((b * a_m) / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (b * a_m)) * -4.0;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return (((b * a_m) / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (b * a_m)) * -4.0
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(Float64(b * a_m) / Float64(Float64(Float64(y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * Float64(b * a_m)) * -4.0) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = (((b * a_m) / (((y_45_scale * x_45_scale) * y_45_scale) * x_45_scale)) * (b * a_m)) * -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[(b * a$95$m), $MachinePrecision] / N[(N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(b * a$95$m), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
\left(\frac{b \cdot a\_m}{\left(\left(y-scale \cdot x-scale\right) \cdot y-scale\right) \cdot x-scale} \cdot \left(b \cdot a\_m\right)\right) \cdot -4
\end{array}
Initial program 22.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-*.f6449.4
Applied rewrites49.4%
Applied rewrites73.6%
Applied rewrites79.3%
Taylor expanded in x-scale around 0
Applied rewrites76.4%
Final simplification76.4%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* (/ (* b b) (* (* y-scale x-scale) (* y-scale x-scale))) (* (* 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) {
return ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -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 = ((b * b) / ((y_45scale * x_45scale) * (y_45scale * x_45scale))) * ((a_m * a_m) * (-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 ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0);
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0)
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return 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)) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * ((a_m * a_m) * -4.0); end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := 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]
\begin{array}{l}
a_m = \left|a\right|
\\
\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)
\end{array}
Initial program 22.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-*.f6449.4
Applied rewrites49.4%
Taylor expanded in b around 0
Applied rewrites53.8%
Final simplification53.8%
herbie shell --seed 2024288
(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))))