
(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}
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ b (* y-scale x-scale)) a))
(t_1 (* (PI) (/ angle 180.0)))
(t_2 (sin t_1))
(t_3 (cos t_1))
(t_4
(/
(/ (* t_3 (* t_2 (* (- (pow b 2.0) (pow a 2.0)) 2.0))) x-scale)
y-scale)))
(if (<=
(-
(* t_4 t_4)
(*
(/ (/ (+ (pow (* t_2 b) 2.0) (pow (* t_3 a) 2.0)) y-scale) y-scale)
(*
(/ (/ (+ (pow (* t_3 b) 2.0) (pow (* t_2 a) 2.0)) x-scale) x-scale)
4.0)))
2e+186)
(* (* -4.0 t_0) t_0)
(* (pow (/ (/ (* a b) x-scale) y-scale) 2.0) -4.0))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{y-scale \cdot x-scale} \cdot a\\
t_1 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
t_2 := \sin t\_1\\
t_3 := \cos t\_1\\
t_4 := \frac{\frac{t\_3 \cdot \left(t\_2 \cdot \left(\left({b}^{2} - {a}^{2}\right) \cdot 2\right)\right)}{x-scale}}{y-scale}\\
\mathbf{if}\;t\_4 \cdot t\_4 - \frac{\frac{{\left(t\_2 \cdot b\right)}^{2} + {\left(t\_3 \cdot a\right)}^{2}}{y-scale}}{y-scale} \cdot \left(\frac{\frac{{\left(t\_3 \cdot b\right)}^{2} + {\left(t\_2 \cdot a\right)}^{2}}{x-scale}}{x-scale} \cdot 4\right) \leq 2 \cdot 10^{+186}:\\
\;\;\;\;\left(-4 \cdot t\_0\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{\frac{a \cdot b}{x-scale}}{y-scale}\right)}^{2} \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))) < 1.99999999999999996e186Initial program 59.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-*.f6470.4
Applied rewrites70.4%
Applied rewrites89.4%
Applied rewrites97.7%
Applied rewrites97.7%
if 1.99999999999999996e186 < (-.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-*.f6448.1
Applied rewrites48.1%
Applied rewrites72.3%
Applied rewrites89.1%
Applied rewrites93.3%
Final simplification95.1%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* (pow (/ (* a b) (* y-scale x-scale)) 2.0) -4.0))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return pow(((a * b) / (y_45_scale * x_45_scale)), 2.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
code = (((a * b) / (y_45scale * x_45scale)) ** 2.0d0) * (-4.0d0)
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return Math.pow(((a * b) / (y_45_scale * x_45_scale)), 2.0) * -4.0;
}
def code(a, b, angle, x_45_scale, y_45_scale): return math.pow(((a * b) / (y_45_scale * x_45_scale)), 2.0) * -4.0
function code(a, b, angle, x_45_scale, y_45_scale) return Float64((Float64(Float64(a * b) / Float64(y_45_scale * x_45_scale)) ^ 2.0) * -4.0) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = (((a * b) / (y_45_scale * x_45_scale)) ^ 2.0) * -4.0; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[Power[N[(N[(a * b), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -4.0), $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{a \cdot b}{y-scale \cdot x-scale}\right)}^{2} \cdot -4
\end{array}
Initial program 24.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.0
Applied rewrites57.0%
Applied rewrites79.2%
Applied rewrites92.6%
Applied rewrites93.2%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ b (* y-scale x-scale))) (t_1 (* t_0 t_0)))
(if (<= b 1.65e-166)
(* t_1 (* (* -4.0 a) a))
(if (<= b 1.4e+138)
(*
(* b b)
(* (/ a (* y-scale x-scale)) (/ (* -4.0 a) (* y-scale x-scale))))
(* (* (* a a) -4.0) t_1)))))
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 t_1 = t_0 * t_0;
double tmp;
if (b <= 1.65e-166) {
tmp = t_1 * ((-4.0 * a) * a);
} else if (b <= 1.4e+138) {
tmp = (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale)));
} else {
tmp = ((a * a) * -4.0) * t_1;
}
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 = b / (y_45scale * x_45scale)
t_1 = t_0 * t_0
if (b <= 1.65d-166) then
tmp = t_1 * (((-4.0d0) * a) * a)
else if (b <= 1.4d+138) then
tmp = (b * b) * ((a / (y_45scale * x_45scale)) * (((-4.0d0) * a) / (y_45scale * x_45scale)))
else
tmp = ((a * a) * (-4.0d0)) * t_1
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 t_1 = t_0 * t_0;
double tmp;
if (b <= 1.65e-166) {
tmp = t_1 * ((-4.0 * a) * a);
} else if (b <= 1.4e+138) {
tmp = (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale)));
} else {
tmp = ((a * a) * -4.0) * t_1;
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = b / (y_45_scale * x_45_scale) t_1 = t_0 * t_0 tmp = 0 if b <= 1.65e-166: tmp = t_1 * ((-4.0 * a) * a) elif b <= 1.4e+138: tmp = (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale))) else: tmp = ((a * a) * -4.0) * t_1 return tmp
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(b / Float64(y_45_scale * x_45_scale)) t_1 = Float64(t_0 * t_0) tmp = 0.0 if (b <= 1.65e-166) tmp = Float64(t_1 * Float64(Float64(-4.0 * a) * a)); elseif (b <= 1.4e+138) tmp = Float64(Float64(b * b) * Float64(Float64(a / Float64(y_45_scale * x_45_scale)) * Float64(Float64(-4.0 * a) / Float64(y_45_scale * x_45_scale)))); else tmp = Float64(Float64(Float64(a * a) * -4.0) * t_1); 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); t_1 = t_0 * t_0; tmp = 0.0; if (b <= 1.65e-166) tmp = t_1 * ((-4.0 * a) * a); elseif (b <= 1.4e+138) tmp = (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale))); else tmp = ((a * a) * -4.0) * t_1; 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]}, Block[{t$95$1 = N[(t$95$0 * t$95$0), $MachinePrecision]}, If[LessEqual[b, 1.65e-166], N[(t$95$1 * N[(N[(-4.0 * a), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.4e+138], N[(N[(b * b), $MachinePrecision] * N[(N[(a / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(-4.0 * a), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * a), $MachinePrecision] * -4.0), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{y-scale \cdot x-scale}\\
t_1 := t\_0 \cdot t\_0\\
\mathbf{if}\;b \leq 1.65 \cdot 10^{-166}:\\
\;\;\;\;t\_1 \cdot \left(\left(-4 \cdot a\right) \cdot a\right)\\
\mathbf{elif}\;b \leq 1.4 \cdot 10^{+138}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(\frac{a}{y-scale \cdot x-scale} \cdot \frac{-4 \cdot a}{y-scale \cdot x-scale}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(a \cdot a\right) \cdot -4\right) \cdot t\_1\\
\end{array}
\end{array}
if b < 1.65000000000000009e-166Initial program 30.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-*.f6454.9
Applied rewrites54.9%
Applied rewrites77.0%
Applied rewrites77.1%
if 1.65000000000000009e-166 < b < 1.4e138Initial program 22.9%
Taylor expanded in b around 0
Applied rewrites59.4%
Taylor expanded in angle around 0
Applied rewrites77.4%
Applied rewrites92.0%
if 1.4e138 < b Initial program 0.0%
Taylor expanded in angle around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6460.0
Applied rewrites60.0%
Applied rewrites86.6%
Final simplification82.0%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ b (* y-scale x-scale))) (t_1 (* (* (* a a) -4.0) (* t_0 t_0))))
(if (<= b 1.65e-166)
t_1
(if (<= b 1.4e+138)
(*
(* b b)
(* (/ a (* y-scale x-scale)) (/ (* -4.0 a) (* y-scale x-scale))))
t_1))))
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 t_1 = ((a * a) * -4.0) * (t_0 * t_0);
double tmp;
if (b <= 1.65e-166) {
tmp = t_1;
} else if (b <= 1.4e+138) {
tmp = (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale)));
} else {
tmp = t_1;
}
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 = b / (y_45scale * x_45scale)
t_1 = ((a * a) * (-4.0d0)) * (t_0 * t_0)
if (b <= 1.65d-166) then
tmp = t_1
else if (b <= 1.4d+138) then
tmp = (b * b) * ((a / (y_45scale * x_45scale)) * (((-4.0d0) * a) / (y_45scale * x_45scale)))
else
tmp = t_1
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 t_1 = ((a * a) * -4.0) * (t_0 * t_0);
double tmp;
if (b <= 1.65e-166) {
tmp = t_1;
} else if (b <= 1.4e+138) {
tmp = (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale)));
} else {
tmp = t_1;
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = b / (y_45_scale * x_45_scale) t_1 = ((a * a) * -4.0) * (t_0 * t_0) tmp = 0 if b <= 1.65e-166: tmp = t_1 elif b <= 1.4e+138: tmp = (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale))) else: tmp = t_1 return tmp
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(b / Float64(y_45_scale * x_45_scale)) t_1 = Float64(Float64(Float64(a * a) * -4.0) * Float64(t_0 * t_0)) tmp = 0.0 if (b <= 1.65e-166) tmp = t_1; elseif (b <= 1.4e+138) tmp = Float64(Float64(b * b) * Float64(Float64(a / Float64(y_45_scale * x_45_scale)) * Float64(Float64(-4.0 * a) / Float64(y_45_scale * x_45_scale)))); else tmp = t_1; 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); t_1 = ((a * a) * -4.0) * (t_0 * t_0); tmp = 0.0; if (b <= 1.65e-166) tmp = t_1; elseif (b <= 1.4e+138) tmp = (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale))); else tmp = t_1; 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]}, Block[{t$95$1 = N[(N[(N[(a * a), $MachinePrecision] * -4.0), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 1.65e-166], t$95$1, If[LessEqual[b, 1.4e+138], N[(N[(b * b), $MachinePrecision] * N[(N[(a / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(-4.0 * a), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{y-scale \cdot x-scale}\\
t_1 := \left(\left(a \cdot a\right) \cdot -4\right) \cdot \left(t\_0 \cdot t\_0\right)\\
\mathbf{if}\;b \leq 1.65 \cdot 10^{-166}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 1.4 \cdot 10^{+138}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(\frac{a}{y-scale \cdot x-scale} \cdot \frac{-4 \cdot a}{y-scale \cdot x-scale}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < 1.65000000000000009e-166 or 1.4e138 < b Initial program 24.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.9
Applied rewrites55.9%
Applied rewrites78.9%
if 1.65000000000000009e-166 < b < 1.4e138Initial program 22.9%
Taylor expanded in b around 0
Applied rewrites59.4%
Taylor expanded in angle around 0
Applied rewrites77.4%
Applied rewrites92.0%
Final simplification82.0%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0
(*
(* b b)
(* (/ a (* y-scale x-scale)) (/ (* -4.0 a) (* y-scale x-scale))))))
(if (<= b 4.8e+155)
t_0
(if (<= b 1.8e+273)
(*
(* (/ b (* (* x-scale x-scale) y-scale)) (/ b y-scale))
(* (* a a) -4.0))
t_0))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale)));
double tmp;
if (b <= 4.8e+155) {
tmp = t_0;
} else if (b <= 1.8e+273) {
tmp = ((b / ((x_45_scale * x_45_scale) * y_45_scale)) * (b / y_45_scale)) * ((a * a) * -4.0);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) * ((a / (y_45scale * x_45scale)) * (((-4.0d0) * a) / (y_45scale * x_45scale)))
if (b <= 4.8d+155) then
tmp = t_0
else if (b <= 1.8d+273) then
tmp = ((b / ((x_45scale * x_45scale) * y_45scale)) * (b / y_45scale)) * ((a * a) * (-4.0d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale)));
double tmp;
if (b <= 4.8e+155) {
tmp = t_0;
} else if (b <= 1.8e+273) {
tmp = ((b / ((x_45_scale * x_45_scale) * y_45_scale)) * (b / y_45_scale)) * ((a * a) * -4.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale))) tmp = 0 if b <= 4.8e+155: tmp = t_0 elif b <= 1.8e+273: tmp = ((b / ((x_45_scale * x_45_scale) * y_45_scale)) * (b / y_45_scale)) * ((a * a) * -4.0) else: tmp = t_0 return tmp
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(b * b) * Float64(Float64(a / Float64(y_45_scale * x_45_scale)) * Float64(Float64(-4.0 * a) / Float64(y_45_scale * x_45_scale)))) tmp = 0.0 if (b <= 4.8e+155) tmp = t_0; elseif (b <= 1.8e+273) tmp = Float64(Float64(Float64(b / Float64(Float64(x_45_scale * x_45_scale) * y_45_scale)) * Float64(b / y_45_scale)) * Float64(Float64(a * a) * -4.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale))); tmp = 0.0; if (b <= 4.8e+155) tmp = t_0; elseif (b <= 1.8e+273) tmp = ((b / ((x_45_scale * x_45_scale) * y_45_scale)) * (b / y_45_scale)) * ((a * a) * -4.0); else tmp = t_0; end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(b * b), $MachinePrecision] * N[(N[(a / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(-4.0 * a), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 4.8e+155], t$95$0, If[LessEqual[b, 1.8e+273], N[(N[(N[(b / N[(N[(x$45$scale * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(b / y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(b \cdot b\right) \cdot \left(\frac{a}{y-scale \cdot x-scale} \cdot \frac{-4 \cdot a}{y-scale \cdot x-scale}\right)\\
\mathbf{if}\;b \leq 4.8 \cdot 10^{+155}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 1.8 \cdot 10^{+273}:\\
\;\;\;\;\left(\frac{b}{\left(x-scale \cdot x-scale\right) \cdot y-scale} \cdot \frac{b}{y-scale}\right) \cdot \left(\left(a \cdot a\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if b < 4.80000000000000042e155 or 1.80000000000000012e273 < b Initial program 26.9%
Taylor expanded in b around 0
Applied rewrites50.9%
Taylor expanded in angle around 0
Applied rewrites63.7%
Applied rewrites78.4%
if 4.80000000000000042e155 < b < 1.80000000000000012e273Initial 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-*.f6464.8
Applied rewrites64.8%
Applied rewrites92.8%
Applied rewrites75.6%
Final simplification78.1%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* a a) -4.0))
(t_1 (* (* y-scale x-scale) (* y-scale x-scale))))
(if (<= x-scale 1.06e-159)
(* (/ t_0 t_1) (* b b))
(if (<= x-scale 1.85e+148)
(*
(* (/ a (* (* x-scale x-scale) y-scale)) (/ (* -4.0 a) y-scale))
(* b b))
(* (/ (* b b) t_1) t_0)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (a * a) * -4.0;
double t_1 = (y_45_scale * x_45_scale) * (y_45_scale * x_45_scale);
double tmp;
if (x_45_scale <= 1.06e-159) {
tmp = (t_0 / t_1) * (b * b);
} else if (x_45_scale <= 1.85e+148) {
tmp = ((a / ((x_45_scale * x_45_scale) * y_45_scale)) * ((-4.0 * a) / y_45_scale)) * (b * b);
} else {
tmp = ((b * b) / t_1) * 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) :: t_1
real(8) :: tmp
t_0 = (a * a) * (-4.0d0)
t_1 = (y_45scale * x_45scale) * (y_45scale * x_45scale)
if (x_45scale <= 1.06d-159) then
tmp = (t_0 / t_1) * (b * b)
else if (x_45scale <= 1.85d+148) then
tmp = ((a / ((x_45scale * x_45scale) * y_45scale)) * (((-4.0d0) * a) / y_45scale)) * (b * b)
else
tmp = ((b * b) / t_1) * t_0
end if
code = tmp
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (a * a) * -4.0;
double t_1 = (y_45_scale * x_45_scale) * (y_45_scale * x_45_scale);
double tmp;
if (x_45_scale <= 1.06e-159) {
tmp = (t_0 / t_1) * (b * b);
} else if (x_45_scale <= 1.85e+148) {
tmp = ((a / ((x_45_scale * x_45_scale) * y_45_scale)) * ((-4.0 * a) / y_45_scale)) * (b * b);
} else {
tmp = ((b * b) / t_1) * t_0;
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (a * a) * -4.0 t_1 = (y_45_scale * x_45_scale) * (y_45_scale * x_45_scale) tmp = 0 if x_45_scale <= 1.06e-159: tmp = (t_0 / t_1) * (b * b) elif x_45_scale <= 1.85e+148: tmp = ((a / ((x_45_scale * x_45_scale) * y_45_scale)) * ((-4.0 * a) / y_45_scale)) * (b * b) else: tmp = ((b * b) / t_1) * t_0 return tmp
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(a * a) * -4.0) t_1 = Float64(Float64(y_45_scale * x_45_scale) * Float64(y_45_scale * x_45_scale)) tmp = 0.0 if (x_45_scale <= 1.06e-159) tmp = Float64(Float64(t_0 / t_1) * Float64(b * b)); elseif (x_45_scale <= 1.85e+148) tmp = Float64(Float64(Float64(a / Float64(Float64(x_45_scale * x_45_scale) * y_45_scale)) * Float64(Float64(-4.0 * a) / y_45_scale)) * Float64(b * b)); else tmp = Float64(Float64(Float64(b * b) / t_1) * t_0); end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (a * a) * -4.0; t_1 = (y_45_scale * x_45_scale) * (y_45_scale * x_45_scale); tmp = 0.0; if (x_45_scale <= 1.06e-159) tmp = (t_0 / t_1) * (b * b); elseif (x_45_scale <= 1.85e+148) tmp = ((a / ((x_45_scale * x_45_scale) * y_45_scale)) * ((-4.0 * a) / y_45_scale)) * (b * b); else tmp = ((b * b) / t_1) * t_0; end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(a * a), $MachinePrecision] * -4.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$45$scale, 1.06e-159], N[(N[(t$95$0 / t$95$1), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$45$scale, 1.85e+148], N[(N[(N[(a / N[(N[(x$45$scale * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(-4.0 * a), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b * b), $MachinePrecision] / t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(a \cdot a\right) \cdot -4\\
t_1 := \left(y-scale \cdot x-scale\right) \cdot \left(y-scale \cdot x-scale\right)\\
\mathbf{if}\;x-scale \leq 1.06 \cdot 10^{-159}:\\
\;\;\;\;\frac{t\_0}{t\_1} \cdot \left(b \cdot b\right)\\
\mathbf{elif}\;x-scale \leq 1.85 \cdot 10^{+148}:\\
\;\;\;\;\left(\frac{a}{\left(x-scale \cdot x-scale\right) \cdot y-scale} \cdot \frac{-4 \cdot a}{y-scale}\right) \cdot \left(b \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{b \cdot b}{t\_1} \cdot t\_0\\
\end{array}
\end{array}
if x-scale < 1.06e-159Initial program 19.0%
Taylor expanded in b around 0
Applied rewrites43.6%
Taylor expanded in angle around 0
Applied rewrites56.7%
if 1.06e-159 < x-scale < 1.8500000000000001e148Initial program 25.9%
Taylor expanded in b around 0
Applied rewrites56.8%
Taylor expanded in angle around 0
Applied rewrites65.3%
Applied rewrites75.5%
if 1.8500000000000001e148 < x-scale Initial program 44.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.8
Applied rewrites58.8%
Taylor expanded in b around 0
Applied rewrites68.0%
Final simplification62.6%
(FPCore (a b angle x-scale y-scale) :precision binary64 (let* ((t_0 (* (/ b (* y-scale x-scale)) a))) (* (* -4.0 t_0) t_0)))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (b / (y_45_scale * x_45_scale)) * a;
return (-4.0 * t_0) * t_0;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
t_0 = (b / (y_45scale * x_45scale)) * a
code = ((-4.0d0) * t_0) * t_0
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (b / (y_45_scale * x_45_scale)) * a;
return (-4.0 * t_0) * t_0;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (b / (y_45_scale * x_45_scale)) * a return (-4.0 * t_0) * t_0
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(b / Float64(y_45_scale * x_45_scale)) * a) return Float64(Float64(-4.0 * t_0) * t_0) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (b / (y_45_scale * x_45_scale)) * a; tmp = (-4.0 * t_0) * t_0; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(b / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]}, N[(N[(-4.0 * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{y-scale \cdot x-scale} \cdot a\\
\left(-4 \cdot t\_0\right) \cdot t\_0
\end{array}
\end{array}
Initial program 24.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.0
Applied rewrites57.0%
Applied rewrites79.2%
Applied rewrites92.6%
Applied rewrites92.6%
Final simplification92.6%
(FPCore (a b angle x-scale y-scale) :precision binary64 (let* ((t_0 (/ b (* y-scale x-scale)))) (* (* (* (* t_0 a) t_0) a) -4.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);
return (((t_0 * a) * t_0) * a) * -4.0;
}
real(8) function code(a, b, angle, x_45scale, y_45scale)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
t_0 = b / (y_45scale * x_45scale)
code = (((t_0 * a) * t_0) * a) * (-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 = b / (y_45_scale * x_45_scale);
return (((t_0 * a) * t_0) * a) * -4.0;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = b / (y_45_scale * x_45_scale) return (((t_0 * a) * t_0) * a) * -4.0
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(b / Float64(y_45_scale * x_45_scale)) return Float64(Float64(Float64(Float64(t_0 * a) * t_0) * a) * -4.0) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = b / (y_45_scale * x_45_scale); tmp = (((t_0 * a) * t_0) * a) * -4.0; 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]}, N[(N[(N[(N[(t$95$0 * a), $MachinePrecision] * t$95$0), $MachinePrecision] * a), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{b}{y-scale \cdot x-scale}\\
\left(\left(\left(t\_0 \cdot a\right) \cdot t\_0\right) \cdot a\right) \cdot -4
\end{array}
\end{array}
Initial program 24.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.0
Applied rewrites57.0%
Applied rewrites79.2%
Applied rewrites92.6%
Applied rewrites90.4%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* (* b b) (* (/ a (* y-scale x-scale)) (/ (* -4.0 a) (* y-scale x-scale)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (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 = (b * b) * ((a / (y_45scale * x_45scale)) * (((-4.0d0) * a) / (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 (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale)));
}
def code(a, b, angle, x_45_scale, y_45_scale): return (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale)))
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(b * b) * Float64(Float64(a / Float64(y_45_scale * x_45_scale)) * Float64(Float64(-4.0 * a) / Float64(y_45_scale * x_45_scale)))) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = (b * b) * ((a / (y_45_scale * x_45_scale)) * ((-4.0 * a) / (y_45_scale * x_45_scale))); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(b * b), $MachinePrecision] * N[(N[(a / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(-4.0 * a), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(b \cdot b\right) \cdot \left(\frac{a}{y-scale \cdot x-scale} \cdot \frac{-4 \cdot a}{y-scale \cdot x-scale}\right)
\end{array}
Initial program 24.0%
Taylor expanded in b around 0
Applied rewrites48.1%
Taylor expanded in angle around 0
Applied rewrites60.2%
Applied rewrites73.8%
Final simplification73.8%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* (/ (* (* a a) -4.0) (* (* 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 (((a * a) * -4.0) / ((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 = (((a * a) * (-4.0d0)) / ((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 (((a * a) * -4.0) / ((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 (((a * a) * -4.0) / ((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(Float64(a * a) * -4.0) / 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 = (((a * a) * -4.0) / ((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[(N[(a * a), $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]
\begin{array}{l}
\\
\frac{\left(a \cdot a\right) \cdot -4}{\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 24.0%
Taylor expanded in b around 0
Applied rewrites48.1%
Taylor expanded in angle around 0
Applied rewrites60.2%
Final simplification60.2%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* (/ (* (* a a) -4.0) (* (* (* y-scale x-scale) x-scale) y-scale)) (* b b)))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (((a * a) * -4.0) / (((y_45_scale * x_45_scale) * x_45_scale) * y_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 = (((a * a) * (-4.0d0)) / (((y_45scale * x_45scale) * x_45scale) * y_45scale)) * (b * b)
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (((a * a) * -4.0) / (((y_45_scale * x_45_scale) * x_45_scale) * y_45_scale)) * (b * b);
}
def code(a, b, angle, x_45_scale, y_45_scale): return (((a * a) * -4.0) / (((y_45_scale * x_45_scale) * x_45_scale) * y_45_scale)) * (b * b)
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(Float64(a * a) * -4.0) / Float64(Float64(Float64(y_45_scale * x_45_scale) * x_45_scale) * y_45_scale)) * Float64(b * b)) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = (((a * a) * -4.0) / (((y_45_scale * x_45_scale) * x_45_scale) * y_45_scale)) * (b * b); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(N[(a * a), $MachinePrecision] * -4.0), $MachinePrecision] / N[(N[(N[(y$45$scale * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(a \cdot a\right) \cdot -4}{\left(\left(y-scale \cdot x-scale\right) \cdot x-scale\right) \cdot y-scale} \cdot \left(b \cdot b\right)
\end{array}
Initial program 24.0%
Taylor expanded in b around 0
Applied rewrites48.1%
Taylor expanded in angle around 0
Applied rewrites60.2%
Applied rewrites53.3%
Taylor expanded in x-scale around 0
Applied rewrites59.0%
Final simplification59.0%
herbie shell --seed 2024254
(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))))