
(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}
(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_4 (/ (* a b) (* y-scale x-scale))))
(if (<=
(-
(* 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)))
1e+165)
(*
(* (/ (/ b x-scale) y-scale) a)
(* (/ a y-scale) (* (/ b x-scale) -4.0)))
(* (* t_4 t_4) -4.0))))\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_4 := \frac{a \cdot b}{y-scale \cdot x-scale}\\
\mathbf{if}\;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} \leq 10^{+165}:\\
\;\;\;\;\left(\frac{\frac{b}{x-scale}}{y-scale} \cdot a\right) \cdot \left(\frac{a}{y-scale} \cdot \left(\frac{b}{x-scale} \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_4 \cdot t\_4\right) \cdot -4\\
\end{array}
\end{array}
if (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 #s(literal 4 binary64) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) y-scale) y-scale))) < 9.99999999999999899e164Initial program 68.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-*.f6466.2
Applied rewrites66.2%
Applied rewrites76.9%
Applied rewrites93.7%
Applied rewrites99.6%
if 9.99999999999999899e164 < (-.f64 (*.f64 (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale) (/.f64 (/.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) (-.f64 (pow.f64 b #s(literal 2 binary64)) (pow.f64 a #s(literal 2 binary64)))) (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) x-scale) y-scale)) (*.f64 (*.f64 #s(literal 4 binary64) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) x-scale) x-scale)) (/.f64 (/.f64 (+.f64 (pow.f64 (*.f64 a (cos.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64)) (pow.f64 (*.f64 b (sin.f64 (*.f64 (/.f64 angle #s(literal 180 binary64)) (PI.f64)))) #s(literal 2 binary64))) y-scale) y-scale))) 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-*.f6446.2
Applied rewrites46.2%
Applied rewrites71.1%
Applied rewrites94.3%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(if (or (<= x-scale 1.35e-162) (not (<= x-scale 3.5e+120)))
(* (* (* b (/ a (* (* y-scale y-scale) x-scale))) (* (/ a x-scale) b)) -4.0)
(*
(* (/ (* a b) y-scale) (/ (* a b) (* (* x-scale x-scale) y-scale)))
-4.0)))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if ((x_45_scale <= 1.35e-162) || !(x_45_scale <= 3.5e+120)) {
tmp = ((b * (a / ((y_45_scale * y_45_scale) * x_45_scale))) * ((a / x_45_scale) * b)) * -4.0;
} else {
tmp = (((a * b) / y_45_scale) * ((a * b) / ((x_45_scale * x_45_scale) * y_45_scale))) * -4.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) :: tmp
if ((x_45scale <= 1.35d-162) .or. (.not. (x_45scale <= 3.5d+120))) then
tmp = ((b * (a / ((y_45scale * y_45scale) * x_45scale))) * ((a / x_45scale) * b)) * (-4.0d0)
else
tmp = (((a * b) / y_45scale) * ((a * b) / ((x_45scale * x_45scale) * y_45scale))) * (-4.0d0)
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 tmp;
if ((x_45_scale <= 1.35e-162) || !(x_45_scale <= 3.5e+120)) {
tmp = ((b * (a / ((y_45_scale * y_45_scale) * x_45_scale))) * ((a / x_45_scale) * b)) * -4.0;
} else {
tmp = (((a * b) / y_45_scale) * ((a * b) / ((x_45_scale * x_45_scale) * y_45_scale))) * -4.0;
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): tmp = 0 if (x_45_scale <= 1.35e-162) or not (x_45_scale <= 3.5e+120): tmp = ((b * (a / ((y_45_scale * y_45_scale) * x_45_scale))) * ((a / x_45_scale) * b)) * -4.0 else: tmp = (((a * b) / y_45_scale) * ((a * b) / ((x_45_scale * x_45_scale) * y_45_scale))) * -4.0 return tmp
function code(a, b, angle, x_45_scale, y_45_scale) tmp = 0.0 if ((x_45_scale <= 1.35e-162) || !(x_45_scale <= 3.5e+120)) tmp = Float64(Float64(Float64(b * Float64(a / Float64(Float64(y_45_scale * y_45_scale) * x_45_scale))) * Float64(Float64(a / x_45_scale) * b)) * -4.0); else tmp = Float64(Float64(Float64(Float64(a * b) / y_45_scale) * Float64(Float64(a * b) / Float64(Float64(x_45_scale * x_45_scale) * y_45_scale))) * -4.0); end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) tmp = 0.0; if ((x_45_scale <= 1.35e-162) || ~((x_45_scale <= 3.5e+120))) tmp = ((b * (a / ((y_45_scale * y_45_scale) * x_45_scale))) * ((a / x_45_scale) * b)) * -4.0; else tmp = (((a * b) / y_45_scale) * ((a * b) / ((x_45_scale * x_45_scale) * y_45_scale))) * -4.0; end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := If[Or[LessEqual[x$45$scale, 1.35e-162], N[Not[LessEqual[x$45$scale, 3.5e+120]], $MachinePrecision]], N[(N[(N[(b * N[(a / N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(a / x$45$scale), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision], N[(N[(N[(N[(a * b), $MachinePrecision] / y$45$scale), $MachinePrecision] * N[(N[(a * b), $MachinePrecision] / N[(N[(x$45$scale * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x-scale \leq 1.35 \cdot 10^{-162} \lor \neg \left(x-scale \leq 3.5 \cdot 10^{+120}\right):\\
\;\;\;\;\left(\left(b \cdot \frac{a}{\left(y-scale \cdot y-scale\right) \cdot x-scale}\right) \cdot \left(\frac{a}{x-scale} \cdot b\right)\right) \cdot -4\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{a \cdot b}{y-scale} \cdot \frac{a \cdot b}{\left(x-scale \cdot x-scale\right) \cdot y-scale}\right) \cdot -4\\
\end{array}
\end{array}
if x-scale < 1.34999999999999992e-162 or 3.50000000000000007e120 < 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-*.f6450.1
Applied rewrites50.1%
Applied rewrites73.2%
Applied rewrites77.4%
Applied rewrites76.5%
if 1.34999999999999992e-162 < x-scale < 3.50000000000000007e120Initial program 22.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-*.f6463.6
Applied rewrites63.6%
Applied rewrites72.0%
Applied rewrites91.8%
Final simplification79.4%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ b (* y-scale x-scale))))
(if (or (<= a 2.8e-216) (not (<= a 1.2e+122)))
(*
(* (/ (* -4.0 a) (* y-scale x-scale)) (/ a (* y-scale x-scale)))
(* b b))
(* (* -4.0 (* a a)) (* 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);
double tmp;
if ((a <= 2.8e-216) || !(a <= 1.2e+122)) {
tmp = (((-4.0 * a) / (y_45_scale * x_45_scale)) * (a / (y_45_scale * x_45_scale))) * (b * b);
} else {
tmp = (-4.0 * (a * a)) * (t_0 * 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)
if ((a <= 2.8d-216) .or. (.not. (a <= 1.2d+122))) then
tmp = ((((-4.0d0) * a) / (y_45scale * x_45scale)) * (a / (y_45scale * x_45scale))) * (b * b)
else
tmp = ((-4.0d0) * (a * a)) * (t_0 * 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);
double tmp;
if ((a <= 2.8e-216) || !(a <= 1.2e+122)) {
tmp = (((-4.0 * a) / (y_45_scale * x_45_scale)) * (a / (y_45_scale * x_45_scale))) * (b * b);
} else {
tmp = (-4.0 * (a * a)) * (t_0 * t_0);
}
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 <= 2.8e-216) or not (a <= 1.2e+122): tmp = (((-4.0 * a) / (y_45_scale * x_45_scale)) * (a / (y_45_scale * x_45_scale))) * (b * b) else: tmp = (-4.0 * (a * a)) * (t_0 * t_0) 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 <= 2.8e-216) || !(a <= 1.2e+122)) tmp = Float64(Float64(Float64(Float64(-4.0 * a) / Float64(y_45_scale * x_45_scale)) * Float64(a / Float64(y_45_scale * x_45_scale))) * Float64(b * b)); else tmp = Float64(Float64(-4.0 * Float64(a * a)) * Float64(t_0 * 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); tmp = 0.0; if ((a <= 2.8e-216) || ~((a <= 1.2e+122))) tmp = (((-4.0 * a) / (y_45_scale * x_45_scale)) * (a / (y_45_scale * x_45_scale))) * (b * b); else tmp = (-4.0 * (a * a)) * (t_0 * t_0); 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[Or[LessEqual[a, 2.8e-216], N[Not[LessEqual[a, 1.2e+122]], $MachinePrecision]], N[(N[(N[(N[(-4.0 * a), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(a / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{y-scale \cdot x-scale}\\
\mathbf{if}\;a \leq 2.8 \cdot 10^{-216} \lor \neg \left(a \leq 1.2 \cdot 10^{+122}\right):\\
\;\;\;\;\left(\frac{-4 \cdot a}{y-scale \cdot x-scale} \cdot \frac{a}{y-scale \cdot x-scale}\right) \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(t\_0 \cdot t\_0\right)\\
\end{array}
\end{array}
if a < 2.8e-216 or 1.2000000000000001e122 < a Initial program 18.6%
Taylor expanded in b around 0
Applied rewrites41.0%
Taylor expanded in angle around 0
Applied rewrites53.5%
Applied rewrites73.8%
if 2.8e-216 < a < 1.2000000000000001e122Initial 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
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6463.4
Applied rewrites63.4%
Applied rewrites89.0%
Final simplification77.6%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ b (* y-scale x-scale))))
(if (<= b 4.5e-160)
(*
(* (* b (/ a (* (* y-scale y-scale) x-scale))) (* (/ a x-scale) b))
-4.0)
(if (<= b 1.1e+53)
(*
(* (/ (* -4.0 a) (* y-scale x-scale)) (/ a (* y-scale x-scale)))
(* b b))
(* (* -4.0 (* a a)) (* 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);
double tmp;
if (b <= 4.5e-160) {
tmp = ((b * (a / ((y_45_scale * y_45_scale) * x_45_scale))) * ((a / x_45_scale) * b)) * -4.0;
} else if (b <= 1.1e+53) {
tmp = (((-4.0 * a) / (y_45_scale * x_45_scale)) * (a / (y_45_scale * x_45_scale))) * (b * b);
} else {
tmp = (-4.0 * (a * a)) * (t_0 * 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)
if (b <= 4.5d-160) then
tmp = ((b * (a / ((y_45scale * y_45scale) * x_45scale))) * ((a / x_45scale) * b)) * (-4.0d0)
else if (b <= 1.1d+53) then
tmp = ((((-4.0d0) * a) / (y_45scale * x_45scale)) * (a / (y_45scale * x_45scale))) * (b * b)
else
tmp = ((-4.0d0) * (a * a)) * (t_0 * 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);
double tmp;
if (b <= 4.5e-160) {
tmp = ((b * (a / ((y_45_scale * y_45_scale) * x_45_scale))) * ((a / x_45_scale) * b)) * -4.0;
} else if (b <= 1.1e+53) {
tmp = (((-4.0 * a) / (y_45_scale * x_45_scale)) * (a / (y_45_scale * x_45_scale))) * (b * b);
} else {
tmp = (-4.0 * (a * a)) * (t_0 * t_0);
}
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 b <= 4.5e-160: tmp = ((b * (a / ((y_45_scale * y_45_scale) * x_45_scale))) * ((a / x_45_scale) * b)) * -4.0 elif b <= 1.1e+53: tmp = (((-4.0 * a) / (y_45_scale * x_45_scale)) * (a / (y_45_scale * x_45_scale))) * (b * b) else: tmp = (-4.0 * (a * a)) * (t_0 * t_0) 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 (b <= 4.5e-160) tmp = Float64(Float64(Float64(b * Float64(a / Float64(Float64(y_45_scale * y_45_scale) * x_45_scale))) * Float64(Float64(a / x_45_scale) * b)) * -4.0); elseif (b <= 1.1e+53) tmp = Float64(Float64(Float64(Float64(-4.0 * a) / Float64(y_45_scale * x_45_scale)) * Float64(a / Float64(y_45_scale * x_45_scale))) * Float64(b * b)); else tmp = Float64(Float64(-4.0 * Float64(a * a)) * Float64(t_0 * 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); tmp = 0.0; if (b <= 4.5e-160) tmp = ((b * (a / ((y_45_scale * y_45_scale) * x_45_scale))) * ((a / x_45_scale) * b)) * -4.0; elseif (b <= 1.1e+53) tmp = (((-4.0 * a) / (y_45_scale * x_45_scale)) * (a / (y_45_scale * x_45_scale))) * (b * b); else tmp = (-4.0 * (a * a)) * (t_0 * t_0); 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[b, 4.5e-160], N[(N[(N[(b * N[(a / N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(a / x$45$scale), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision], If[LessEqual[b, 1.1e+53], N[(N[(N[(N[(-4.0 * a), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(a / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{y-scale \cdot x-scale}\\
\mathbf{if}\;b \leq 4.5 \cdot 10^{-160}:\\
\;\;\;\;\left(\left(b \cdot \frac{a}{\left(y-scale \cdot y-scale\right) \cdot x-scale}\right) \cdot \left(\frac{a}{x-scale} \cdot b\right)\right) \cdot -4\\
\mathbf{elif}\;b \leq 1.1 \cdot 10^{+53}:\\
\;\;\;\;\left(\frac{-4 \cdot a}{y-scale \cdot x-scale} \cdot \frac{a}{y-scale \cdot x-scale}\right) \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \left(t\_0 \cdot t\_0\right)\\
\end{array}
\end{array}
if b < 4.50000000000000026e-160Initial program 21.6%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
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.8
Applied rewrites46.8%
Applied rewrites69.0%
Applied rewrites73.6%
Applied rewrites72.8%
if 4.50000000000000026e-160 < b < 1.09999999999999999e53Initial program 39.0%
Taylor expanded in b around 0
Applied rewrites67.5%
Taylor expanded in angle around 0
Applied rewrites76.6%
Applied rewrites89.6%
if 1.09999999999999999e53 < b Initial program 10.6%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
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 rewrites78.1%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* y-scale x-scale) (* y-scale x-scale)))
(t_1 (* -4.0 (* a a))))
(if (<= y-scale 3e-107)
(* t_1 (/ (* b b) t_0))
(if (<= y-scale 1.05e+116)
(/
(* (* (* b (* -4.0 a)) a) b)
(* (* x-scale x-scale) (* y-scale y-scale)))
(* (/ t_1 t_0) (* b 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 t_1 = -4.0 * (a * a);
double tmp;
if (y_45_scale <= 3e-107) {
tmp = t_1 * ((b * b) / t_0);
} else if (y_45_scale <= 1.05e+116) {
tmp = (((b * (-4.0 * a)) * a) * b) / ((x_45_scale * x_45_scale) * (y_45_scale * y_45_scale));
} else {
tmp = (t_1 / t_0) * (b * 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) :: t_1
real(8) :: tmp
t_0 = (y_45scale * x_45scale) * (y_45scale * x_45scale)
t_1 = (-4.0d0) * (a * a)
if (y_45scale <= 3d-107) then
tmp = t_1 * ((b * b) / t_0)
else if (y_45scale <= 1.05d+116) then
tmp = (((b * ((-4.0d0) * a)) * a) * b) / ((x_45scale * x_45scale) * (y_45scale * y_45scale))
else
tmp = (t_1 / t_0) * (b * 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 t_1 = -4.0 * (a * a);
double tmp;
if (y_45_scale <= 3e-107) {
tmp = t_1 * ((b * b) / t_0);
} else if (y_45_scale <= 1.05e+116) {
tmp = (((b * (-4.0 * a)) * a) * b) / ((x_45_scale * x_45_scale) * (y_45_scale * y_45_scale));
} else {
tmp = (t_1 / t_0) * (b * 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) t_1 = -4.0 * (a * a) tmp = 0 if y_45_scale <= 3e-107: tmp = t_1 * ((b * b) / t_0) elif y_45_scale <= 1.05e+116: tmp = (((b * (-4.0 * a)) * a) * b) / ((x_45_scale * x_45_scale) * (y_45_scale * y_45_scale)) else: tmp = (t_1 / t_0) * (b * b) return tmp
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale)) t_1 = Float64(-4.0 * Float64(a * a)) tmp = 0.0 if (y_45_scale <= 3e-107) tmp = Float64(t_1 * Float64(Float64(b * b) / t_0)); elseif (y_45_scale <= 1.05e+116) tmp = Float64(Float64(Float64(Float64(b * Float64(-4.0 * a)) * a) * b) / Float64(Float64(x_45_scale * x_45_scale) * Float64(y_45_scale * y_45_scale))); else tmp = Float64(Float64(t_1 / t_0) * Float64(b * 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); t_1 = -4.0 * (a * a); tmp = 0.0; if (y_45_scale <= 3e-107) tmp = t_1 * ((b * b) / t_0); elseif (y_45_scale <= 1.05e+116) tmp = (((b * (-4.0 * a)) * a) * b) / ((x_45_scale * x_45_scale) * (y_45_scale * y_45_scale)); else tmp = (t_1 / t_0) * (b * b); end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$45$scale, 3e-107], N[(t$95$1 * N[(N[(b * b), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$45$scale, 1.05e+116], N[(N[(N[(N[(b * N[(-4.0 * a), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision] * b), $MachinePrecision] / N[(N[(x$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / t$95$0), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)\\
t_1 := -4 \cdot \left(a \cdot a\right)\\
\mathbf{if}\;y-scale \leq 3 \cdot 10^{-107}:\\
\;\;\;\;t\_1 \cdot \frac{b \cdot b}{t\_0}\\
\mathbf{elif}\;y-scale \leq 1.05 \cdot 10^{+116}:\\
\;\;\;\;\frac{\left(\left(b \cdot \left(-4 \cdot a\right)\right) \cdot a\right) \cdot b}{\left(x-scale \cdot x-scale\right) \cdot \left(y-scale \cdot y-scale\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{t\_0} \cdot \left(b \cdot b\right)\\
\end{array}
\end{array}
if y-scale < 2.9999999999999997e-107Initial program 17.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-*.f6452.0
Applied rewrites52.0%
Taylor expanded in b around 0
Applied rewrites57.5%
if 2.9999999999999997e-107 < y-scale < 1.0500000000000001e116Initial program 28.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.8
Applied rewrites64.8%
Applied rewrites68.3%
Applied rewrites64.6%
if 1.0500000000000001e116 < y-scale Initial program 35.4%
Taylor expanded in b around 0
Applied rewrites46.5%
Taylor expanded in angle around 0
Applied rewrites54.8%
Final simplification58.6%
(FPCore (a b angle x-scale y-scale) :precision binary64 (let* ((t_0 (/ (* a b) (* y-scale x-scale)))) (* (* t_0 t_0) -4.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 * x_45_scale);
return (t_0 * t_0) * -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
real(8) :: t_0
t_0 = (a * b) / (y_45scale * x_45scale)
code = (t_0 * t_0) * (-4.0d0)
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 * x_45_scale);
return (t_0 * t_0) * -4.0;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (a * b) / (y_45_scale * x_45_scale) return (t_0 * t_0) * -4.0
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(a * b) / Float64(y_45_scale * x_45_scale)) return Float64(Float64(t_0 * t_0) * -4.0) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (a * b) / (y_45_scale * x_45_scale); tmp = (t_0 * t_0) * -4.0; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(a * 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}
\\
\begin{array}{l}
t_0 := \frac{a \cdot b}{y-scale \cdot x-scale}\\
\left(t\_0 \cdot t\_0\right) \cdot -4
\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-*.f6452.7
Applied rewrites52.7%
Applied rewrites73.0%
Applied rewrites94.1%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* (* (/ (* a b) (* y-scale x-scale)) (* b (/ a (* y-scale x-scale)))) -4.0))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (((a * b) / (y_45_scale * x_45_scale)) * (b * (a / (y_45_scale * x_45_scale)))) * -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 * b) / (y_45scale * x_45scale)) * (b * (a / (y_45scale * x_45scale)))) * (-4.0d0)
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 * x_45_scale)) * (b * (a / (y_45_scale * x_45_scale)))) * -4.0;
}
def code(a, b, angle, x_45_scale, y_45_scale): return (((a * b) / (y_45_scale * x_45_scale)) * (b * (a / (y_45_scale * x_45_scale)))) * -4.0
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(Float64(a * b) / Float64(y_45_scale * x_45_scale)) * Float64(b * Float64(a / Float64(y_45_scale * x_45_scale)))) * -4.0) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = (((a * b) / (y_45_scale * x_45_scale)) * (b * (a / (y_45_scale * x_45_scale)))) * -4.0; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(N[(a * b), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(b * N[(a / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{a \cdot b}{y-scale \cdot x-scale} \cdot \left(b \cdot \frac{a}{y-scale \cdot x-scale}\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-*.f6452.7
Applied rewrites52.7%
Applied rewrites73.0%
Applied rewrites94.1%
Applied rewrites92.4%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* (* (/ (* -4.0 a) (* y-scale x-scale)) (/ a (* y-scale x-scale))) (* b b)))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (((-4.0 * a) / (y_45_scale * x_45_scale)) * (a / (y_45_scale * x_45_scale))) * (b * 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 = ((((-4.0d0) * a) / (y_45scale * x_45scale)) * (a / (y_45scale * x_45scale))) * (b * b)
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (((-4.0 * a) / (y_45_scale * x_45_scale)) * (a / (y_45_scale * x_45_scale))) * (b * b);
}
def code(a, b, angle, x_45_scale, y_45_scale): return (((-4.0 * a) / (y_45_scale * x_45_scale)) * (a / (y_45_scale * x_45_scale))) * (b * b)
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(Float64(-4.0 * a) / Float64(y_45_scale * x_45_scale)) * Float64(a / Float64(y_45_scale * x_45_scale))) * Float64(b * b)) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = (((-4.0 * a) / (y_45_scale * x_45_scale)) * (a / (y_45_scale * x_45_scale))) * (b * b); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(N[(-4.0 * a), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(a / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{-4 \cdot a}{y-scale \cdot x-scale} \cdot \frac{a}{y-scale \cdot x-scale}\right) \cdot \left(b \cdot b\right)
\end{array}
Initial program 22.3%
Taylor expanded in b around 0
Applied rewrites44.5%
Taylor expanded in angle around 0
Applied rewrites56.9%
Applied rewrites73.3%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* (* -4.0 (* a a)) (/ (* b b) (* (* y-scale x-scale) (* y-scale x-scale)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (-4.0 * (a * a)) * ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale)));
}
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 = ((-4.0d0) * (a * a)) * ((b * b) / ((y_45scale * x_45scale) * (y_45scale * x_45scale)))
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (-4.0 * (a * a)) * ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale)));
}
def code(a, b, angle, x_45_scale, y_45_scale): return (-4.0 * (a * a)) * ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale)))
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(-4.0 * Float64(a * a)) * Float64(Float64(b * b) / Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale)))) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = (-4.0 * (a * a)) * ((b * b) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(-4.0 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] / N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-4 \cdot \left(a \cdot a\right)\right) \cdot \frac{b \cdot b}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\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-*.f6452.7
Applied rewrites52.7%
Taylor expanded in b around 0
Applied rewrites57.3%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* (/ (* -4.0 (* a a)) (* (* y-scale x-scale) (* y-scale x-scale))) (* b b)))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return ((-4.0 * (a * a)) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * 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 = (((-4.0d0) * (a * a)) / ((y_45scale * x_45scale) * (y_45scale * x_45scale))) * (b * b)
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return ((-4.0 * (a * a)) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * b);
}
def code(a, b, angle, x_45_scale, y_45_scale): return ((-4.0 * (a * a)) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * b)
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(-4.0 * Float64(a * a)) / Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale))) * Float64(b * b)) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = ((-4.0 * (a * a)) / ((y_45_scale * x_45_scale) * (y_45_scale * x_45_scale))) * (b * b); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(-4.0 * N[(a * a), $MachinePrecision]), $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]
\begin{array}{l}
\\
\frac{-4 \cdot \left(a \cdot a\right)}{\left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)} \cdot \left(b \cdot b\right)
\end{array}
Initial program 22.3%
Taylor expanded in b around 0
Applied rewrites44.5%
Taylor expanded in angle around 0
Applied rewrites56.9%
herbie shell --seed 2024298
(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))))