
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI))
(t_1 (sin t_0))
(t_2 (cos t_0))
(t_3
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
y-scale)))
(-
(* t_3 t_3)
(*
(*
4.0
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * ((double) M_PI);
double t_1 = sin(t_0);
double t_2 = cos(t_0);
double t_3 = ((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
return (t_3 * t_3) - ((4.0 * (((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a * t_2), 2.0) + pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * Math.PI;
double t_1 = Math.sin(t_0);
double t_2 = Math.cos(t_0);
double t_3 = ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
return (t_3 * t_3) - ((4.0 * (((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (angle / 180.0) * math.pi t_1 = math.sin(t_0) t_2 = math.cos(t_0) t_3 = ((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale return (t_3 * t_3) - ((4.0 * (((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale))
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(angle / 180.0) * pi) t_1 = sin(t_0) t_2 = cos(t_0) t_3 = Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale) return Float64(Float64(t_3 * t_3) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale))) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (angle / 180.0) * pi; t_1 = sin(t_0); t_2 = cos(t_0); t_3 = ((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale; tmp = (t_3 * t_3) - ((4.0 * (((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale)); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a * t$95$1), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$2), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$1), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := \sin t_0\\
t_2 := \cos t_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_1\right) \cdot t_2}{x-scale}}{y-scale}\\
t_3 \cdot t_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t_1\right)}^{2} + {\left(b \cdot t_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t_2\right)}^{2} + {\left(b \cdot t_1\right)}^{2}}{y-scale}}{y-scale}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI))
(t_1 (sin t_0))
(t_2 (cos t_0))
(t_3
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
y-scale)))
(-
(* t_3 t_3)
(*
(*
4.0
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * ((double) M_PI);
double t_1 = sin(t_0);
double t_2 = cos(t_0);
double t_3 = ((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
return (t_3 * t_3) - ((4.0 * (((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((pow((a * t_2), 2.0) + pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (angle / 180.0) * Math.PI;
double t_1 = Math.sin(t_0);
double t_2 = Math.cos(t_0);
double t_3 = ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale;
return (t_3 * t_3) - ((4.0 * (((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale));
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (angle / 180.0) * math.pi t_1 = math.sin(t_0) t_2 = math.cos(t_0) t_3 = ((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale return (t_3 * t_3) - ((4.0 * (((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale)) * (((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale))
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(angle / 180.0) * pi) t_1 = sin(t_0) t_2 = cos(t_0) t_3 = Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale) return Float64(Float64(t_3 * t_3) - Float64(Float64(4.0 * Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale))) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (angle / 180.0) * pi; t_1 = sin(t_0); t_2 = cos(t_0); t_3 = ((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale; tmp = (t_3 * t_3) - ((4.0 * (((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale)) * (((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale)); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(N[(4.0 * N[(N[(N[(N[Power[N[(a * t$95$1), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$2), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Power[N[(a * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * t$95$1), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := \sin t_0\\
t_2 := \cos t_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t_1\right) \cdot t_2}{x-scale}}{y-scale}\\
t_3 \cdot t_3 - \left(4 \cdot \frac{\frac{{\left(a \cdot t_1\right)}^{2} + {\left(b \cdot t_2\right)}^{2}}{x-scale}}{x-scale}\right) \cdot \frac{\frac{{\left(a \cdot t_2\right)}^{2} + {\left(b \cdot t_1\right)}^{2}}{y-scale}}{y-scale}
\end{array}
\end{array}
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ (/ b y-scale) (/ y-scale b))) (t_1 (* a (/ a x-scale))))
(if (<= y-scale -4.2e+160)
(* -4.0 (* t_1 (/ t_0 x-scale)))
(if (<= y-scale -8.2e-70)
(*
-4.0
(/ (/ (* (* b a) (* b a)) (* y-scale y-scale)) (* x-scale x-scale)))
(if (<= y-scale 4.9e-116)
(* -4.0 (/ (* t_1 t_0) x-scale))
(if (<= y-scale 1.35e+154)
(/
(* -4.0 (* (/ a x-scale) (* b (* b (/ a x-scale)))))
(* y-scale y-scale))
(*
-4.0
(*
(/ (* (/ b y-scale) (/ b y-scale)) x-scale)
(/ a (/ x-scale a))))))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (b / y_45_scale) / (y_45_scale / b);
double t_1 = a * (a / x_45_scale);
double tmp;
if (y_45_scale <= -4.2e+160) {
tmp = -4.0 * (t_1 * (t_0 / x_45_scale));
} else if (y_45_scale <= -8.2e-70) {
tmp = -4.0 * ((((b * a) * (b * a)) / (y_45_scale * y_45_scale)) / (x_45_scale * x_45_scale));
} else if (y_45_scale <= 4.9e-116) {
tmp = -4.0 * ((t_1 * t_0) / x_45_scale);
} else if (y_45_scale <= 1.35e+154) {
tmp = (-4.0 * ((a / x_45_scale) * (b * (b * (a / x_45_scale))))) / (y_45_scale * y_45_scale);
} else {
tmp = -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a)));
}
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) / (y_45scale / b)
t_1 = a * (a / x_45scale)
if (y_45scale <= (-4.2d+160)) then
tmp = (-4.0d0) * (t_1 * (t_0 / x_45scale))
else if (y_45scale <= (-8.2d-70)) then
tmp = (-4.0d0) * ((((b * a) * (b * a)) / (y_45scale * y_45scale)) / (x_45scale * x_45scale))
else if (y_45scale <= 4.9d-116) then
tmp = (-4.0d0) * ((t_1 * t_0) / x_45scale)
else if (y_45scale <= 1.35d+154) then
tmp = ((-4.0d0) * ((a / x_45scale) * (b * (b * (a / x_45scale))))) / (y_45scale * y_45scale)
else
tmp = (-4.0d0) * ((((b / y_45scale) * (b / y_45scale)) / x_45scale) * (a / (x_45scale / a)))
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) / (y_45_scale / b);
double t_1 = a * (a / x_45_scale);
double tmp;
if (y_45_scale <= -4.2e+160) {
tmp = -4.0 * (t_1 * (t_0 / x_45_scale));
} else if (y_45_scale <= -8.2e-70) {
tmp = -4.0 * ((((b * a) * (b * a)) / (y_45_scale * y_45_scale)) / (x_45_scale * x_45_scale));
} else if (y_45_scale <= 4.9e-116) {
tmp = -4.0 * ((t_1 * t_0) / x_45_scale);
} else if (y_45_scale <= 1.35e+154) {
tmp = (-4.0 * ((a / x_45_scale) * (b * (b * (a / x_45_scale))))) / (y_45_scale * y_45_scale);
} else {
tmp = -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a)));
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (b / y_45_scale) / (y_45_scale / b) t_1 = a * (a / x_45_scale) tmp = 0 if y_45_scale <= -4.2e+160: tmp = -4.0 * (t_1 * (t_0 / x_45_scale)) elif y_45_scale <= -8.2e-70: tmp = -4.0 * ((((b * a) * (b * a)) / (y_45_scale * y_45_scale)) / (x_45_scale * x_45_scale)) elif y_45_scale <= 4.9e-116: tmp = -4.0 * ((t_1 * t_0) / x_45_scale) elif y_45_scale <= 1.35e+154: tmp = (-4.0 * ((a / x_45_scale) * (b * (b * (a / x_45_scale))))) / (y_45_scale * y_45_scale) else: tmp = -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a))) return tmp
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(b / y_45_scale) / Float64(y_45_scale / b)) t_1 = Float64(a * Float64(a / x_45_scale)) tmp = 0.0 if (y_45_scale <= -4.2e+160) tmp = Float64(-4.0 * Float64(t_1 * Float64(t_0 / x_45_scale))); elseif (y_45_scale <= -8.2e-70) tmp = Float64(-4.0 * Float64(Float64(Float64(Float64(b * a) * Float64(b * a)) / Float64(y_45_scale * y_45_scale)) / Float64(x_45_scale * x_45_scale))); elseif (y_45_scale <= 4.9e-116) tmp = Float64(-4.0 * Float64(Float64(t_1 * t_0) / x_45_scale)); elseif (y_45_scale <= 1.35e+154) tmp = Float64(Float64(-4.0 * Float64(Float64(a / x_45_scale) * Float64(b * Float64(b * Float64(a / x_45_scale))))) / Float64(y_45_scale * y_45_scale)); else tmp = Float64(-4.0 * Float64(Float64(Float64(Float64(b / y_45_scale) * Float64(b / y_45_scale)) / x_45_scale) * Float64(a / Float64(x_45_scale / a)))); end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (b / y_45_scale) / (y_45_scale / b); t_1 = a * (a / x_45_scale); tmp = 0.0; if (y_45_scale <= -4.2e+160) tmp = -4.0 * (t_1 * (t_0 / x_45_scale)); elseif (y_45_scale <= -8.2e-70) tmp = -4.0 * ((((b * a) * (b * a)) / (y_45_scale * y_45_scale)) / (x_45_scale * x_45_scale)); elseif (y_45_scale <= 4.9e-116) tmp = -4.0 * ((t_1 * t_0) / x_45_scale); elseif (y_45_scale <= 1.35e+154) tmp = (-4.0 * ((a / x_45_scale) * (b * (b * (a / x_45_scale))))) / (y_45_scale * y_45_scale); else tmp = -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a))); end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(b / y$45$scale), $MachinePrecision] / N[(y$45$scale / b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(a * N[(a / x$45$scale), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$45$scale, -4.2e+160], N[(-4.0 * N[(t$95$1 * N[(t$95$0 / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$45$scale, -8.2e-70], N[(-4.0 * N[(N[(N[(N[(b * a), $MachinePrecision] * N[(b * a), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$45$scale, 4.9e-116], N[(-4.0 * N[(N[(t$95$1 * t$95$0), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$45$scale, 1.35e+154], N[(N[(-4.0 * N[(N[(a / x$45$scale), $MachinePrecision] * N[(b * N[(b * N[(a / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(N[(N[(N[(b / y$45$scale), $MachinePrecision] * N[(b / y$45$scale), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] * N[(a / N[(x$45$scale / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{b}{y-scale}}{\frac{y-scale}{b}}\\
t_1 := a \cdot \frac{a}{x-scale}\\
\mathbf{if}\;y-scale \leq -4.2 \cdot 10^{+160}:\\
\;\;\;\;-4 \cdot \left(t_1 \cdot \frac{t_0}{x-scale}\right)\\
\mathbf{elif}\;y-scale \leq -8.2 \cdot 10^{-70}:\\
\;\;\;\;-4 \cdot \frac{\frac{\left(b \cdot a\right) \cdot \left(b \cdot a\right)}{y-scale \cdot y-scale}}{x-scale \cdot x-scale}\\
\mathbf{elif}\;y-scale \leq 4.9 \cdot 10^{-116}:\\
\;\;\;\;-4 \cdot \frac{t_1 \cdot t_0}{x-scale}\\
\mathbf{elif}\;y-scale \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{-4 \cdot \left(\frac{a}{x-scale} \cdot \left(b \cdot \left(b \cdot \frac{a}{x-scale}\right)\right)\right)}{y-scale \cdot y-scale}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(\frac{\frac{b}{y-scale} \cdot \frac{b}{y-scale}}{x-scale} \cdot \frac{a}{\frac{x-scale}{a}}\right)\\
\end{array}
\end{array}
if y-scale < -4.19999999999999993e160Initial program 53.8%
Taylor expanded in angle around 0 42.9%
*-commutative42.9%
times-frac43.0%
unpow243.0%
unpow243.0%
unpow243.0%
unpow243.0%
Simplified43.0%
associate-*l/43.0%
times-frac78.8%
Applied egg-rr78.8%
unpow278.8%
times-frac89.2%
unpow289.2%
associate-*r/96.3%
Simplified96.3%
associate-*r/85.9%
Applied egg-rr85.9%
*-un-lft-identity85.9%
associate-/l*96.4%
Applied egg-rr96.4%
if -4.19999999999999993e160 < y-scale < -8.19999999999999955e-70Initial program 28.1%
Taylor expanded in angle around 0 64.6%
associate-*r/64.6%
times-frac62.3%
unpow262.3%
unpow262.3%
unpow262.3%
unpow262.3%
Simplified62.3%
associate-*l/62.3%
associate-*l*71.2%
Applied egg-rr71.2%
Taylor expanded in a around 0 62.3%
unpow262.3%
associate-*r*71.2%
unpow271.2%
unpow271.2%
times-frac71.1%
unpow271.1%
*-commutative71.1%
associate-/l*72.8%
unpow272.8%
Simplified72.8%
Taylor expanded in a around 0 64.6%
*-commutative64.6%
associate-/r*65.6%
*-commutative65.6%
unpow265.6%
unpow265.6%
unswap-sqr89.2%
unpow289.2%
unpow289.2%
Simplified89.2%
if -8.19999999999999955e-70 < y-scale < 4.89999999999999977e-116Initial program 17.8%
Taylor expanded in angle around 0 39.3%
*-commutative39.3%
times-frac42.6%
unpow242.6%
unpow242.6%
unpow242.6%
unpow242.6%
Simplified42.6%
associate-*l/41.6%
times-frac63.6%
Applied egg-rr63.6%
unpow263.6%
times-frac71.3%
unpow271.3%
associate-*r/75.6%
Simplified75.6%
associate-*r/73.8%
Applied egg-rr73.8%
associate-*r/75.9%
associate-/l*78.8%
Applied egg-rr78.8%
if 4.89999999999999977e-116 < y-scale < 1.35000000000000003e154Initial program 19.7%
Taylor expanded in angle around 0 56.0%
associate-*r/56.0%
times-frac56.1%
unpow256.1%
unpow256.1%
unpow256.1%
unpow256.1%
Simplified56.1%
associate-*l/56.1%
associate-*l*60.1%
Applied egg-rr60.1%
Taylor expanded in a around 0 56.1%
unpow256.1%
associate-*r*60.1%
unpow260.1%
unpow260.1%
times-frac65.8%
unpow265.8%
*-commutative65.8%
associate-/l*67.5%
unpow267.5%
Simplified67.5%
Taylor expanded in b around 0 65.8%
associate-*l/67.5%
unpow267.5%
associate-*r*83.3%
Simplified83.3%
if 1.35000000000000003e154 < y-scale Initial program 60.2%
Taylor expanded in angle around 0 48.3%
*-commutative48.3%
times-frac52.1%
unpow252.1%
unpow252.1%
unpow252.1%
unpow252.1%
Simplified52.1%
associate-*l/52.3%
times-frac64.6%
Applied egg-rr64.6%
unpow264.6%
times-frac76.5%
unpow276.5%
associate-*r/85.4%
Simplified85.4%
Taylor expanded in a around 0 76.5%
unpow276.5%
associate-/l*85.4%
Simplified85.4%
Final simplification84.7%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(if (<= b 6.2e-112)
(* -4.0 (* (pow (/ b y-scale) 2.0) (* (/ a x-scale) (/ a x-scale))))
(if (<= b 4.1e-13)
(*
-4.0
(/ (* a (* a (* b b))) (* x-scale (* y-scale (* y-scale x-scale)))))
(*
-4.0
(* a (* (/ a x-scale) (/ (* (/ b y-scale) (/ b y-scale)) x-scale)))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (b <= 6.2e-112) {
tmp = -4.0 * (pow((b / y_45_scale), 2.0) * ((a / x_45_scale) * (a / x_45_scale)));
} else if (b <= 4.1e-13) {
tmp = -4.0 * ((a * (a * (b * b))) / (x_45_scale * (y_45_scale * (y_45_scale * x_45_scale))));
} else {
tmp = -4.0 * (a * ((a / x_45_scale) * (((b / y_45_scale) * (b / y_45_scale)) / x_45_scale)));
}
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 (b <= 6.2d-112) then
tmp = (-4.0d0) * (((b / y_45scale) ** 2.0d0) * ((a / x_45scale) * (a / x_45scale)))
else if (b <= 4.1d-13) then
tmp = (-4.0d0) * ((a * (a * (b * b))) / (x_45scale * (y_45scale * (y_45scale * x_45scale))))
else
tmp = (-4.0d0) * (a * ((a / x_45scale) * (((b / y_45scale) * (b / y_45scale)) / x_45scale)))
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 (b <= 6.2e-112) {
tmp = -4.0 * (Math.pow((b / y_45_scale), 2.0) * ((a / x_45_scale) * (a / x_45_scale)));
} else if (b <= 4.1e-13) {
tmp = -4.0 * ((a * (a * (b * b))) / (x_45_scale * (y_45_scale * (y_45_scale * x_45_scale))));
} else {
tmp = -4.0 * (a * ((a / x_45_scale) * (((b / y_45_scale) * (b / y_45_scale)) / x_45_scale)));
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): tmp = 0 if b <= 6.2e-112: tmp = -4.0 * (math.pow((b / y_45_scale), 2.0) * ((a / x_45_scale) * (a / x_45_scale))) elif b <= 4.1e-13: tmp = -4.0 * ((a * (a * (b * b))) / (x_45_scale * (y_45_scale * (y_45_scale * x_45_scale)))) else: tmp = -4.0 * (a * ((a / x_45_scale) * (((b / y_45_scale) * (b / y_45_scale)) / x_45_scale))) return tmp
function code(a, b, angle, x_45_scale, y_45_scale) tmp = 0.0 if (b <= 6.2e-112) tmp = Float64(-4.0 * Float64((Float64(b / y_45_scale) ^ 2.0) * Float64(Float64(a / x_45_scale) * Float64(a / x_45_scale)))); elseif (b <= 4.1e-13) tmp = Float64(-4.0 * Float64(Float64(a * Float64(a * Float64(b * b))) / Float64(x_45_scale * Float64(y_45_scale * Float64(y_45_scale * x_45_scale))))); else tmp = Float64(-4.0 * Float64(a * Float64(Float64(a / x_45_scale) * Float64(Float64(Float64(b / y_45_scale) * Float64(b / y_45_scale)) / x_45_scale)))); end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) tmp = 0.0; if (b <= 6.2e-112) tmp = -4.0 * (((b / y_45_scale) ^ 2.0) * ((a / x_45_scale) * (a / x_45_scale))); elseif (b <= 4.1e-13) tmp = -4.0 * ((a * (a * (b * b))) / (x_45_scale * (y_45_scale * (y_45_scale * x_45_scale)))); else tmp = -4.0 * (a * ((a / x_45_scale) * (((b / y_45_scale) * (b / y_45_scale)) / x_45_scale))); end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[b, 6.2e-112], N[(-4.0 * N[(N[Power[N[(b / y$45$scale), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(a / x$45$scale), $MachinePrecision] * N[(a / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.1e-13], N[(-4.0 * N[(N[(a * N[(a * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * N[(y$45$scale * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(a * N[(N[(a / x$45$scale), $MachinePrecision] * N[(N[(N[(b / y$45$scale), $MachinePrecision] * N[(b / y$45$scale), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 6.2 \cdot 10^{-112}:\\
\;\;\;\;-4 \cdot \left({\left(\frac{b}{y-scale}\right)}^{2} \cdot \left(\frac{a}{x-scale} \cdot \frac{a}{x-scale}\right)\right)\\
\mathbf{elif}\;b \leq 4.1 \cdot 10^{-13}:\\
\;\;\;\;-4 \cdot \frac{a \cdot \left(a \cdot \left(b \cdot b\right)\right)}{x-scale \cdot \left(y-scale \cdot \left(y-scale \cdot x-scale\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(a \cdot \left(\frac{a}{x-scale} \cdot \frac{\frac{b}{y-scale} \cdot \frac{b}{y-scale}}{x-scale}\right)\right)\\
\end{array}
\end{array}
if b < 6.1999999999999995e-112Initial program 34.2%
Taylor expanded in angle around 0 45.8%
*-commutative45.8%
times-frac47.8%
unpow247.8%
unpow247.8%
unpow247.8%
unpow247.8%
Simplified47.8%
associate-*l/47.9%
times-frac63.7%
Applied egg-rr63.7%
unpow263.7%
times-frac69.6%
unpow269.6%
associate-*r/76.3%
Simplified76.3%
Taylor expanded in a around 0 45.8%
*-commutative45.8%
times-frac47.8%
unpow247.8%
unpow247.8%
times-frac63.7%
unpow263.7%
unpow263.7%
unpow263.7%
times-frac79.1%
Simplified79.1%
if 6.1999999999999995e-112 < b < 4.1000000000000002e-13Initial program 31.4%
Taylor expanded in angle around 0 75.1%
associate-*r/75.1%
times-frac74.6%
unpow274.6%
unpow274.6%
unpow274.6%
unpow274.6%
Simplified74.6%
Taylor expanded in y-scale around 0 75.1%
unpow275.1%
associate-*r*78.7%
unpow278.7%
unpow278.7%
unpow278.7%
unpow278.7%
associate-*l*85.0%
unpow285.0%
Simplified85.0%
Taylor expanded in x-scale around 0 85.0%
*-commutative85.0%
unpow285.0%
associate-*r*89.5%
*-commutative89.5%
*-commutative89.5%
Simplified89.5%
if 4.1000000000000002e-13 < b Initial program 9.5%
Taylor expanded in angle around 0 51.0%
*-commutative51.0%
times-frac49.3%
unpow249.3%
unpow249.3%
unpow249.3%
unpow249.3%
Simplified49.3%
associate-*l/51.0%
times-frac69.2%
Applied egg-rr69.2%
unpow269.2%
times-frac73.1%
unpow273.1%
associate-*r/82.4%
Simplified82.4%
pow182.4%
associate-*l*86.3%
pow286.3%
Applied egg-rr86.3%
unpow286.3%
Applied egg-rr86.3%
Final simplification81.7%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0
(*
-4.0
(/
(* (* a (/ a x-scale)) (/ (/ b y-scale) (/ y-scale b)))
x-scale))))
(if (<= y-scale -4.2e+160)
t_0
(if (<= y-scale -2.2e-69)
(*
-4.0
(/ (/ (* (* b a) (* b a)) (* y-scale y-scale)) (* x-scale x-scale)))
(if (<= y-scale 4.4e-116)
t_0
(if (<= y-scale 1.22e+154)
(/
(* -4.0 (* (/ a x-scale) (* b (* b (/ a x-scale)))))
(* y-scale y-scale))
(*
-4.0
(*
(/ (* (/ b y-scale) (/ b y-scale)) x-scale)
(/ a (/ x-scale a))))))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = -4.0 * (((a * (a / x_45_scale)) * ((b / y_45_scale) / (y_45_scale / b))) / x_45_scale);
double tmp;
if (y_45_scale <= -4.2e+160) {
tmp = t_0;
} else if (y_45_scale <= -2.2e-69) {
tmp = -4.0 * ((((b * a) * (b * a)) / (y_45_scale * y_45_scale)) / (x_45_scale * x_45_scale));
} else if (y_45_scale <= 4.4e-116) {
tmp = t_0;
} else if (y_45_scale <= 1.22e+154) {
tmp = (-4.0 * ((a / x_45_scale) * (b * (b * (a / x_45_scale))))) / (y_45_scale * y_45_scale);
} else {
tmp = -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a)));
}
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 = (-4.0d0) * (((a * (a / x_45scale)) * ((b / y_45scale) / (y_45scale / b))) / x_45scale)
if (y_45scale <= (-4.2d+160)) then
tmp = t_0
else if (y_45scale <= (-2.2d-69)) then
tmp = (-4.0d0) * ((((b * a) * (b * a)) / (y_45scale * y_45scale)) / (x_45scale * x_45scale))
else if (y_45scale <= 4.4d-116) then
tmp = t_0
else if (y_45scale <= 1.22d+154) then
tmp = ((-4.0d0) * ((a / x_45scale) * (b * (b * (a / x_45scale))))) / (y_45scale * y_45scale)
else
tmp = (-4.0d0) * ((((b / y_45scale) * (b / y_45scale)) / x_45scale) * (a / (x_45scale / a)))
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 = -4.0 * (((a * (a / x_45_scale)) * ((b / y_45_scale) / (y_45_scale / b))) / x_45_scale);
double tmp;
if (y_45_scale <= -4.2e+160) {
tmp = t_0;
} else if (y_45_scale <= -2.2e-69) {
tmp = -4.0 * ((((b * a) * (b * a)) / (y_45_scale * y_45_scale)) / (x_45_scale * x_45_scale));
} else if (y_45_scale <= 4.4e-116) {
tmp = t_0;
} else if (y_45_scale <= 1.22e+154) {
tmp = (-4.0 * ((a / x_45_scale) * (b * (b * (a / x_45_scale))))) / (y_45_scale * y_45_scale);
} else {
tmp = -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a)));
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = -4.0 * (((a * (a / x_45_scale)) * ((b / y_45_scale) / (y_45_scale / b))) / x_45_scale) tmp = 0 if y_45_scale <= -4.2e+160: tmp = t_0 elif y_45_scale <= -2.2e-69: tmp = -4.0 * ((((b * a) * (b * a)) / (y_45_scale * y_45_scale)) / (x_45_scale * x_45_scale)) elif y_45_scale <= 4.4e-116: tmp = t_0 elif y_45_scale <= 1.22e+154: tmp = (-4.0 * ((a / x_45_scale) * (b * (b * (a / x_45_scale))))) / (y_45_scale * y_45_scale) else: tmp = -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a))) return tmp
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(-4.0 * Float64(Float64(Float64(a * Float64(a / x_45_scale)) * Float64(Float64(b / y_45_scale) / Float64(y_45_scale / b))) / x_45_scale)) tmp = 0.0 if (y_45_scale <= -4.2e+160) tmp = t_0; elseif (y_45_scale <= -2.2e-69) tmp = Float64(-4.0 * Float64(Float64(Float64(Float64(b * a) * Float64(b * a)) / Float64(y_45_scale * y_45_scale)) / Float64(x_45_scale * x_45_scale))); elseif (y_45_scale <= 4.4e-116) tmp = t_0; elseif (y_45_scale <= 1.22e+154) tmp = Float64(Float64(-4.0 * Float64(Float64(a / x_45_scale) * Float64(b * Float64(b * Float64(a / x_45_scale))))) / Float64(y_45_scale * y_45_scale)); else tmp = Float64(-4.0 * Float64(Float64(Float64(Float64(b / y_45_scale) * Float64(b / y_45_scale)) / x_45_scale) * Float64(a / Float64(x_45_scale / a)))); end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) t_0 = -4.0 * (((a * (a / x_45_scale)) * ((b / y_45_scale) / (y_45_scale / b))) / x_45_scale); tmp = 0.0; if (y_45_scale <= -4.2e+160) tmp = t_0; elseif (y_45_scale <= -2.2e-69) tmp = -4.0 * ((((b * a) * (b * a)) / (y_45_scale * y_45_scale)) / (x_45_scale * x_45_scale)); elseif (y_45_scale <= 4.4e-116) tmp = t_0; elseif (y_45_scale <= 1.22e+154) tmp = (-4.0 * ((a / x_45_scale) * (b * (b * (a / x_45_scale))))) / (y_45_scale * y_45_scale); else tmp = -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a))); end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(-4.0 * N[(N[(N[(a * N[(a / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(b / y$45$scale), $MachinePrecision] / N[(y$45$scale / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$45$scale, -4.2e+160], t$95$0, If[LessEqual[y$45$scale, -2.2e-69], N[(-4.0 * N[(N[(N[(N[(b * a), $MachinePrecision] * N[(b * a), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$45$scale, 4.4e-116], t$95$0, If[LessEqual[y$45$scale, 1.22e+154], N[(N[(-4.0 * N[(N[(a / x$45$scale), $MachinePrecision] * N[(b * N[(b * N[(a / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(N[(N[(N[(b / y$45$scale), $MachinePrecision] * N[(b / y$45$scale), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] * N[(a / N[(x$45$scale / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -4 \cdot \frac{\left(a \cdot \frac{a}{x-scale}\right) \cdot \frac{\frac{b}{y-scale}}{\frac{y-scale}{b}}}{x-scale}\\
\mathbf{if}\;y-scale \leq -4.2 \cdot 10^{+160}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y-scale \leq -2.2 \cdot 10^{-69}:\\
\;\;\;\;-4 \cdot \frac{\frac{\left(b \cdot a\right) \cdot \left(b \cdot a\right)}{y-scale \cdot y-scale}}{x-scale \cdot x-scale}\\
\mathbf{elif}\;y-scale \leq 4.4 \cdot 10^{-116}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y-scale \leq 1.22 \cdot 10^{+154}:\\
\;\;\;\;\frac{-4 \cdot \left(\frac{a}{x-scale} \cdot \left(b \cdot \left(b \cdot \frac{a}{x-scale}\right)\right)\right)}{y-scale \cdot y-scale}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(\frac{\frac{b}{y-scale} \cdot \frac{b}{y-scale}}{x-scale} \cdot \frac{a}{\frac{x-scale}{a}}\right)\\
\end{array}
\end{array}
if y-scale < -4.19999999999999993e160 or -2.2e-69 < y-scale < 4.4000000000000002e-116Initial program 26.3%
Taylor expanded in angle around 0 40.2%
*-commutative40.2%
times-frac42.7%
unpow242.7%
unpow242.7%
unpow242.7%
unpow242.7%
Simplified42.7%
associate-*l/41.9%
times-frac67.2%
Applied egg-rr67.2%
unpow267.2%
times-frac75.5%
unpow275.5%
associate-*r/80.5%
Simplified80.5%
associate-*r/76.7%
Applied egg-rr76.7%
associate-*r/78.3%
associate-/l*83.0%
Applied egg-rr83.0%
if -4.19999999999999993e160 < y-scale < -2.2e-69Initial program 28.1%
Taylor expanded in angle around 0 64.6%
associate-*r/64.6%
times-frac62.3%
unpow262.3%
unpow262.3%
unpow262.3%
unpow262.3%
Simplified62.3%
associate-*l/62.3%
associate-*l*71.2%
Applied egg-rr71.2%
Taylor expanded in a around 0 62.3%
unpow262.3%
associate-*r*71.2%
unpow271.2%
unpow271.2%
times-frac71.1%
unpow271.1%
*-commutative71.1%
associate-/l*72.8%
unpow272.8%
Simplified72.8%
Taylor expanded in a around 0 64.6%
*-commutative64.6%
associate-/r*65.6%
*-commutative65.6%
unpow265.6%
unpow265.6%
unswap-sqr89.2%
unpow289.2%
unpow289.2%
Simplified89.2%
if 4.4000000000000002e-116 < y-scale < 1.22e154Initial program 19.7%
Taylor expanded in angle around 0 56.0%
associate-*r/56.0%
times-frac56.1%
unpow256.1%
unpow256.1%
unpow256.1%
unpow256.1%
Simplified56.1%
associate-*l/56.1%
associate-*l*60.1%
Applied egg-rr60.1%
Taylor expanded in a around 0 56.1%
unpow256.1%
associate-*r*60.1%
unpow260.1%
unpow260.1%
times-frac65.8%
unpow265.8%
*-commutative65.8%
associate-/l*67.5%
unpow267.5%
Simplified67.5%
Taylor expanded in b around 0 65.8%
associate-*l/67.5%
unpow267.5%
associate-*r*83.3%
Simplified83.3%
if 1.22e154 < y-scale Initial program 60.2%
Taylor expanded in angle around 0 48.3%
*-commutative48.3%
times-frac52.1%
unpow252.1%
unpow252.1%
unpow252.1%
unpow252.1%
Simplified52.1%
associate-*l/52.3%
times-frac64.6%
Applied egg-rr64.6%
unpow264.6%
times-frac76.5%
unpow276.5%
associate-*r/85.4%
Simplified85.4%
Taylor expanded in a around 0 76.5%
unpow276.5%
associate-/l*85.4%
Simplified85.4%
Final simplification84.7%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(if (<= b 1.22e-119)
(* -4.0 (/ (* (* a (/ a x-scale)) (/ (/ b y-scale) (/ y-scale b))) x-scale))
(if (<= b 6.2e+48)
(*
-4.0
(/ (* a (* a (* b b))) (* x-scale (* y-scale (* y-scale x-scale)))))
(*
-4.0
(* (/ (* (/ b y-scale) (/ b y-scale)) x-scale) (/ a (/ x-scale a)))))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (b <= 1.22e-119) {
tmp = -4.0 * (((a * (a / x_45_scale)) * ((b / y_45_scale) / (y_45_scale / b))) / x_45_scale);
} else if (b <= 6.2e+48) {
tmp = -4.0 * ((a * (a * (b * b))) / (x_45_scale * (y_45_scale * (y_45_scale * x_45_scale))));
} else {
tmp = -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a)));
}
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 (b <= 1.22d-119) then
tmp = (-4.0d0) * (((a * (a / x_45scale)) * ((b / y_45scale) / (y_45scale / b))) / x_45scale)
else if (b <= 6.2d+48) then
tmp = (-4.0d0) * ((a * (a * (b * b))) / (x_45scale * (y_45scale * (y_45scale * x_45scale))))
else
tmp = (-4.0d0) * ((((b / y_45scale) * (b / y_45scale)) / x_45scale) * (a / (x_45scale / a)))
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 (b <= 1.22e-119) {
tmp = -4.0 * (((a * (a / x_45_scale)) * ((b / y_45_scale) / (y_45_scale / b))) / x_45_scale);
} else if (b <= 6.2e+48) {
tmp = -4.0 * ((a * (a * (b * b))) / (x_45_scale * (y_45_scale * (y_45_scale * x_45_scale))));
} else {
tmp = -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a)));
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): tmp = 0 if b <= 1.22e-119: tmp = -4.0 * (((a * (a / x_45_scale)) * ((b / y_45_scale) / (y_45_scale / b))) / x_45_scale) elif b <= 6.2e+48: tmp = -4.0 * ((a * (a * (b * b))) / (x_45_scale * (y_45_scale * (y_45_scale * x_45_scale)))) else: tmp = -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a))) return tmp
function code(a, b, angle, x_45_scale, y_45_scale) tmp = 0.0 if (b <= 1.22e-119) tmp = Float64(-4.0 * Float64(Float64(Float64(a * Float64(a / x_45_scale)) * Float64(Float64(b / y_45_scale) / Float64(y_45_scale / b))) / x_45_scale)); elseif (b <= 6.2e+48) tmp = Float64(-4.0 * Float64(Float64(a * Float64(a * Float64(b * b))) / Float64(x_45_scale * Float64(y_45_scale * Float64(y_45_scale * x_45_scale))))); else tmp = Float64(-4.0 * Float64(Float64(Float64(Float64(b / y_45_scale) * Float64(b / y_45_scale)) / x_45_scale) * Float64(a / Float64(x_45_scale / a)))); end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) tmp = 0.0; if (b <= 1.22e-119) tmp = -4.0 * (((a * (a / x_45_scale)) * ((b / y_45_scale) / (y_45_scale / b))) / x_45_scale); elseif (b <= 6.2e+48) tmp = -4.0 * ((a * (a * (b * b))) / (x_45_scale * (y_45_scale * (y_45_scale * x_45_scale)))); else tmp = -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a))); end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[b, 1.22e-119], N[(-4.0 * N[(N[(N[(a * N[(a / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(b / y$45$scale), $MachinePrecision] / N[(y$45$scale / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.2e+48], N[(-4.0 * N[(N[(a * N[(a * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * N[(y$45$scale * N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(N[(N[(N[(b / y$45$scale), $MachinePrecision] * N[(b / y$45$scale), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] * N[(a / N[(x$45$scale / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.22 \cdot 10^{-119}:\\
\;\;\;\;-4 \cdot \frac{\left(a \cdot \frac{a}{x-scale}\right) \cdot \frac{\frac{b}{y-scale}}{\frac{y-scale}{b}}}{x-scale}\\
\mathbf{elif}\;b \leq 6.2 \cdot 10^{+48}:\\
\;\;\;\;-4 \cdot \frac{a \cdot \left(a \cdot \left(b \cdot b\right)\right)}{x-scale \cdot \left(y-scale \cdot \left(y-scale \cdot x-scale\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(\frac{\frac{b}{y-scale} \cdot \frac{b}{y-scale}}{x-scale} \cdot \frac{a}{\frac{x-scale}{a}}\right)\\
\end{array}
\end{array}
if b < 1.22e-119Initial program 34.4%
Taylor expanded in angle around 0 46.1%
*-commutative46.1%
times-frac48.1%
unpow248.1%
unpow248.1%
unpow248.1%
unpow248.1%
Simplified48.1%
associate-*l/48.1%
times-frac64.1%
Applied egg-rr64.1%
unpow264.1%
times-frac70.0%
unpow270.0%
associate-*r/76.8%
Simplified76.8%
associate-*r/73.2%
Applied egg-rr73.2%
associate-*r/72.4%
associate-/l*76.1%
Applied egg-rr76.1%
if 1.22e-119 < b < 6.20000000000000011e48Initial program 28.9%
Taylor expanded in angle around 0 73.2%
associate-*r/73.2%
times-frac70.4%
unpow270.4%
unpow270.4%
unpow270.4%
unpow270.4%
Simplified70.4%
Taylor expanded in y-scale around 0 73.2%
unpow273.2%
associate-*r*75.6%
unpow275.6%
unpow275.6%
unpow275.6%
unpow275.6%
associate-*l*79.7%
unpow279.7%
Simplified79.7%
Taylor expanded in x-scale around 0 79.7%
*-commutative79.7%
unpow279.7%
associate-*r*85.3%
*-commutative85.3%
*-commutative85.3%
Simplified85.3%
if 6.20000000000000011e48 < b Initial program 4.9%
Taylor expanded in angle around 0 44.2%
*-commutative44.2%
times-frac44.3%
unpow244.3%
unpow244.3%
unpow244.3%
unpow244.3%
Simplified44.3%
associate-*l/44.3%
times-frac67.6%
Applied egg-rr67.6%
unpow267.6%
times-frac74.8%
unpow274.8%
associate-*r/85.9%
Simplified85.9%
Taylor expanded in a around 0 74.8%
unpow274.8%
associate-/l*85.9%
Simplified85.9%
Final simplification79.1%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* -4.0 (* (/ (* (/ b y-scale) (/ b y-scale)) x-scale) (* a (/ a x-scale)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a * (a / 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) * ((((b / y_45scale) * (b / y_45scale)) / x_45scale) * (a * (a / 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 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a * (a / x_45_scale)));
}
def code(a, b, angle, x_45_scale, y_45_scale): return -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a * (a / x_45_scale)))
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(-4.0 * Float64(Float64(Float64(Float64(b / y_45_scale) * Float64(b / y_45_scale)) / x_45_scale) * Float64(a * Float64(a / x_45_scale)))) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a * (a / x_45_scale))); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(-4.0 * N[(N[(N[(N[(b / y$45$scale), $MachinePrecision] * N[(b / y$45$scale), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] * N[(a * N[(a / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-4 \cdot \left(\frac{\frac{b}{y-scale} \cdot \frac{b}{y-scale}}{x-scale} \cdot \left(a \cdot \frac{a}{x-scale}\right)\right)
\end{array}
Initial program 28.6%
Taylor expanded in angle around 0 49.9%
*-commutative49.9%
times-frac49.3%
unpow249.3%
unpow249.3%
unpow249.3%
unpow249.3%
Simplified49.3%
associate-*l/49.8%
times-frac64.5%
Applied egg-rr64.5%
unpow264.5%
times-frac70.1%
unpow270.1%
associate-*r/77.1%
Simplified77.1%
Final simplification77.1%
(FPCore (a b angle x-scale y-scale) :precision binary64 (* -4.0 (* (/ (* (/ b y-scale) (/ b y-scale)) x-scale) (/ a (/ x-scale a)))))
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a)));
}
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) * ((((b / y_45scale) * (b / y_45scale)) / x_45scale) * (a / (x_45scale / a)))
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a)));
}
def code(a, b, angle, x_45_scale, y_45_scale): return -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a)))
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(-4.0 * Float64(Float64(Float64(Float64(b / y_45_scale) * Float64(b / y_45_scale)) / x_45_scale) * Float64(a / Float64(x_45_scale / a)))) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = -4.0 * ((((b / y_45_scale) * (b / y_45_scale)) / x_45_scale) * (a / (x_45_scale / a))); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(-4.0 * N[(N[(N[(N[(b / y$45$scale), $MachinePrecision] * N[(b / y$45$scale), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] * N[(a / N[(x$45$scale / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-4 \cdot \left(\frac{\frac{b}{y-scale} \cdot \frac{b}{y-scale}}{x-scale} \cdot \frac{a}{\frac{x-scale}{a}}\right)
\end{array}
Initial program 28.6%
Taylor expanded in angle around 0 49.9%
*-commutative49.9%
times-frac49.3%
unpow249.3%
unpow249.3%
unpow249.3%
unpow249.3%
Simplified49.3%
associate-*l/49.8%
times-frac64.5%
Applied egg-rr64.5%
unpow264.5%
times-frac70.1%
unpow270.1%
associate-*r/77.1%
Simplified77.1%
Taylor expanded in a around 0 70.1%
unpow270.1%
associate-/l*77.1%
Simplified77.1%
Final simplification77.1%
(FPCore (a b angle x-scale y-scale) :precision binary64 0.0)
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return 0.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 = 0.0d0
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return 0.0;
}
def code(a, b, angle, x_45_scale, y_45_scale): return 0.0
function code(a, b, angle, x_45_scale, y_45_scale) return 0.0 end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = 0.0; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 28.6%
fma-neg30.4%
Simplified24.1%
Taylor expanded in b around 0 23.6%
*-commutative23.6%
*-commutative23.6%
*-commutative23.6%
distribute-lft-out23.6%
Simplified37.3%
Final simplification37.3%
herbie shell --seed 2023215
(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))))