| Alternative 1 | |
|---|---|
| Accuracy | 25.7% |
| Cost | 39560 |
(FPCore (a b angle x-scale y-scale)
:precision binary64
(/
(-
(sqrt
(*
(*
(* 2.0 (/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0)))
(* (* b a) (* b (- a))))
(+
(+
(/
(/
(+
(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))
(sqrt
(+
(pow
(-
(/
(/
(+
(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))
2.0)
(pow
(/
(/
(*
(*
(* 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)))))))
(/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0))))(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* PI (* 0.005555555555555556 angle)))
(t_1 (* (sin t_0) b))
(t_2 (* x-scale (sqrt 8.0))))
(if (<= x-scale -2.3e-129)
(* (sqrt 2.0) (* (* t_2 (hypot t_1 a)) -0.25))
(if (<= x-scale 3.1e-120)
(* 0.25 (fabs (* 4.0 (* b y-scale))))
(* (sqrt 2.0) (* 0.25 (* t_2 (hypot t_1 (* a (cos t_0))))))))))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return -sqrt((((2.0 * ((4.0 * ((b * a) * (b * -a))) / pow((x_45_scale * y_45_scale), 2.0))) * ((b * a) * (b * -a))) * (((((pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0)) / x_45_scale) / x_45_scale) + (((pow((a * cos(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * sin(((angle / 180.0) * ((double) M_PI)))), 2.0)) / y_45_scale) / y_45_scale)) + sqrt((pow(((((pow((a * sin(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * cos(((angle / 180.0) * ((double) M_PI)))), 2.0)) / x_45_scale) / x_45_scale) - (((pow((a * cos(((angle / 180.0) * ((double) M_PI)))), 2.0) + pow((b * sin(((angle / 180.0) * ((double) M_PI)))), 2.0)) / y_45_scale) / y_45_scale)), 2.0) + pow((((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin(((angle / 180.0) * ((double) M_PI)))) * cos(((angle / 180.0) * ((double) M_PI)))) / x_45_scale) / y_45_scale), 2.0)))))) / ((4.0 * ((b * a) * (b * -a))) / pow((x_45_scale * y_45_scale), 2.0));
}
double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = ((double) M_PI) * (0.005555555555555556 * angle);
double t_1 = sin(t_0) * b;
double t_2 = x_45_scale * sqrt(8.0);
double tmp;
if (x_45_scale <= -2.3e-129) {
tmp = sqrt(2.0) * ((t_2 * hypot(t_1, a)) * -0.25);
} else if (x_45_scale <= 3.1e-120) {
tmp = 0.25 * fabs((4.0 * (b * y_45_scale)));
} else {
tmp = sqrt(2.0) * (0.25 * (t_2 * hypot(t_1, (a * cos(t_0)))));
}
return tmp;
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return -Math.sqrt((((2.0 * ((4.0 * ((b * a) * (b * -a))) / Math.pow((x_45_scale * y_45_scale), 2.0))) * ((b * a) * (b * -a))) * (((((Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0)) / x_45_scale) / x_45_scale) + (((Math.pow((a * Math.cos(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.sin(((angle / 180.0) * Math.PI))), 2.0)) / y_45_scale) / y_45_scale)) + Math.sqrt((Math.pow(((((Math.pow((a * Math.sin(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.cos(((angle / 180.0) * Math.PI))), 2.0)) / x_45_scale) / x_45_scale) - (((Math.pow((a * Math.cos(((angle / 180.0) * Math.PI))), 2.0) + Math.pow((b * Math.sin(((angle / 180.0) * Math.PI))), 2.0)) / y_45_scale) / y_45_scale)), 2.0) + Math.pow((((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin(((angle / 180.0) * Math.PI))) * Math.cos(((angle / 180.0) * Math.PI))) / x_45_scale) / y_45_scale), 2.0)))))) / ((4.0 * ((b * a) * (b * -a))) / Math.pow((x_45_scale * y_45_scale), 2.0));
}
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = Math.PI * (0.005555555555555556 * angle);
double t_1 = Math.sin(t_0) * b;
double t_2 = x_45_scale * Math.sqrt(8.0);
double tmp;
if (x_45_scale <= -2.3e-129) {
tmp = Math.sqrt(2.0) * ((t_2 * Math.hypot(t_1, a)) * -0.25);
} else if (x_45_scale <= 3.1e-120) {
tmp = 0.25 * Math.abs((4.0 * (b * y_45_scale)));
} else {
tmp = Math.sqrt(2.0) * (0.25 * (t_2 * Math.hypot(t_1, (a * Math.cos(t_0)))));
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): return -math.sqrt((((2.0 * ((4.0 * ((b * a) * (b * -a))) / math.pow((x_45_scale * y_45_scale), 2.0))) * ((b * a) * (b * -a))) * (((((math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0)) / x_45_scale) / x_45_scale) + (((math.pow((a * math.cos(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.sin(((angle / 180.0) * math.pi))), 2.0)) / y_45_scale) / y_45_scale)) + math.sqrt((math.pow(((((math.pow((a * math.sin(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.cos(((angle / 180.0) * math.pi))), 2.0)) / x_45_scale) / x_45_scale) - (((math.pow((a * math.cos(((angle / 180.0) * math.pi))), 2.0) + math.pow((b * math.sin(((angle / 180.0) * math.pi))), 2.0)) / y_45_scale) / y_45_scale)), 2.0) + math.pow((((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin(((angle / 180.0) * math.pi))) * math.cos(((angle / 180.0) * math.pi))) / x_45_scale) / y_45_scale), 2.0)))))) / ((4.0 * ((b * a) * (b * -a))) / math.pow((x_45_scale * y_45_scale), 2.0))
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = math.pi * (0.005555555555555556 * angle) t_1 = math.sin(t_0) * b t_2 = x_45_scale * math.sqrt(8.0) tmp = 0 if x_45_scale <= -2.3e-129: tmp = math.sqrt(2.0) * ((t_2 * math.hypot(t_1, a)) * -0.25) elif x_45_scale <= 3.1e-120: tmp = 0.25 * math.fabs((4.0 * (b * y_45_scale))) else: tmp = math.sqrt(2.0) * (0.25 * (t_2 * math.hypot(t_1, (a * math.cos(t_0))))) return tmp
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * Float64(Float64(4.0 * Float64(Float64(b * a) * Float64(b * Float64(-a)))) / (Float64(x_45_scale * y_45_scale) ^ 2.0))) * Float64(Float64(b * a) * Float64(b * Float64(-a)))) * Float64(Float64(Float64(Float64(Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) / x_45_scale) / x_45_scale) + Float64(Float64(Float64((Float64(a * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) / y_45_scale) / y_45_scale)) + sqrt(Float64((Float64(Float64(Float64(Float64((Float64(a * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) / x_45_scale) / x_45_scale) - Float64(Float64(Float64((Float64(a * cos(Float64(Float64(angle / 180.0) * pi))) ^ 2.0) + (Float64(b * sin(Float64(Float64(angle / 180.0) * pi))) ^ 2.0)) / y_45_scale) / y_45_scale)) ^ 2.0) + (Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(Float64(Float64(angle / 180.0) * pi))) * cos(Float64(Float64(angle / 180.0) * pi))) / x_45_scale) / y_45_scale) ^ 2.0))))))) / Float64(Float64(4.0 * Float64(Float64(b * a) * Float64(b * Float64(-a)))) / (Float64(x_45_scale * y_45_scale) ^ 2.0))) end
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(pi * Float64(0.005555555555555556 * angle)) t_1 = Float64(sin(t_0) * b) t_2 = Float64(x_45_scale * sqrt(8.0)) tmp = 0.0 if (x_45_scale <= -2.3e-129) tmp = Float64(sqrt(2.0) * Float64(Float64(t_2 * hypot(t_1, a)) * -0.25)); elseif (x_45_scale <= 3.1e-120) tmp = Float64(0.25 * abs(Float64(4.0 * Float64(b * y_45_scale)))); else tmp = Float64(sqrt(2.0) * Float64(0.25 * Float64(t_2 * hypot(t_1, Float64(a * cos(t_0)))))); end return tmp end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = -sqrt((((2.0 * ((4.0 * ((b * a) * (b * -a))) / ((x_45_scale * y_45_scale) ^ 2.0))) * ((b * a) * (b * -a))) * (((((((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos(((angle / 180.0) * pi))) ^ 2.0)) / x_45_scale) / x_45_scale) + (((((a * cos(((angle / 180.0) * pi))) ^ 2.0) + ((b * sin(((angle / 180.0) * pi))) ^ 2.0)) / y_45_scale) / y_45_scale)) + sqrt(((((((((a * sin(((angle / 180.0) * pi))) ^ 2.0) + ((b * cos(((angle / 180.0) * pi))) ^ 2.0)) / x_45_scale) / x_45_scale) - (((((a * cos(((angle / 180.0) * pi))) ^ 2.0) + ((b * sin(((angle / 180.0) * pi))) ^ 2.0)) / y_45_scale) / y_45_scale)) ^ 2.0) + ((((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin(((angle / 180.0) * pi))) * cos(((angle / 180.0) * pi))) / x_45_scale) / y_45_scale) ^ 2.0)))))) / ((4.0 * ((b * a) * (b * -a))) / ((x_45_scale * y_45_scale) ^ 2.0)); end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) t_0 = pi * (0.005555555555555556 * angle); t_1 = sin(t_0) * b; t_2 = x_45_scale * sqrt(8.0); tmp = 0.0; if (x_45_scale <= -2.3e-129) tmp = sqrt(2.0) * ((t_2 * hypot(t_1, a)) * -0.25); elseif (x_45_scale <= 3.1e-120) tmp = 0.25 * abs((4.0 * (b * y_45_scale))); else tmp = sqrt(2.0) * (0.25 * (t_2 * hypot(t_1, (a * cos(t_0))))); end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[((-N[Sqrt[N[(N[(N[(2.0 * N[(N[(4.0 * N[(N[(b * a), $MachinePrecision] * N[(b * (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[(x$45$scale * y$45$scale), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(b * a), $MachinePrecision] * N[(b * (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision] + N[(N[(N[(N[Power[N[(a * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(N[(N[(N[(N[Power[N[(a * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision] - N[(N[(N[(N[Power[N[(a * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(angle / 180.0), $MachinePrecision] * Pi), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(4.0 * N[(N[(b * a), $MachinePrecision] * N[(b * (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[(x$45$scale * y$45$scale), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[t$95$0], $MachinePrecision] * b), $MachinePrecision]}, Block[{t$95$2 = N[(x$45$scale * N[Sqrt[8.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$45$scale, -2.3e-129], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[(t$95$2 * N[Sqrt[t$95$1 ^ 2 + a ^ 2], $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$45$scale, 3.1e-120], N[(0.25 * N[Abs[N[(4.0 * N[(b * y$45$scale), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(0.25 * N[(t$95$2 * N[Sqrt[t$95$1 ^ 2 + N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\frac{-\sqrt{\left(\left(2 \cdot \frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} + \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{y-scale}}{y-scale}\right) + \sqrt{{\left(\frac{\frac{{\left(a \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{x-scale}}{x-scale} - \frac{\frac{{\left(a \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2} + {\left(b \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right)}^{2}}{y-scale}}{y-scale}\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\frac{angle}{180} \cdot \pi\right)\right) \cdot \cos \left(\frac{angle}{180} \cdot \pi\right)}{x-scale}}{y-scale}\right)}^{2}}\right)}}{\frac{4 \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)}{{\left(x-scale \cdot y-scale\right)}^{2}}}
\begin{array}{l}
t_0 := \pi \cdot \left(0.005555555555555556 \cdot angle\right)\\
t_1 := \sin t_0 \cdot b\\
t_2 := x-scale \cdot \sqrt{8}\\
\mathbf{if}\;x-scale \leq -2.3 \cdot 10^{-129}:\\
\;\;\;\;\sqrt{2} \cdot \left(\left(t_2 \cdot \mathsf{hypot}\left(t_1, a\right)\right) \cdot -0.25\right)\\
\mathbf{elif}\;x-scale \leq 3.1 \cdot 10^{-120}:\\
\;\;\;\;0.25 \cdot \left|4 \cdot \left(b \cdot y-scale\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(0.25 \cdot \left(t_2 \cdot \mathsf{hypot}\left(t_1, a \cdot \cos t_0\right)\right)\right)\\
\end{array}
Results
if x-scale < -2.3e-129Initial program 0.6%
Taylor expanded in x-scale around inf 3.7%
Simplified4.1%
[Start]3.7 | \[ 0.25 \cdot \left(\left(y-scale \cdot \left(x-scale \cdot \sqrt{8}\right)\right) \cdot \sqrt{2 \cdot \frac{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}} + 2 \cdot \frac{{b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}}}\right)
\] |
|---|---|
associate-*r* [=>]3.7 | \[ \color{blue}{\left(0.25 \cdot \left(y-scale \cdot \left(x-scale \cdot \sqrt{8}\right)\right)\right) \cdot \sqrt{2 \cdot \frac{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}} + 2 \cdot \frac{{b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}}}}
\] |
associate-*r* [=>]3.7 | \[ \left(0.25 \cdot \color{blue}{\left(\left(y-scale \cdot x-scale\right) \cdot \sqrt{8}\right)}\right) \cdot \sqrt{2 \cdot \frac{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}} + 2 \cdot \frac{{b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}}}
\] |
distribute-lft-out [=>]3.7 | \[ \left(0.25 \cdot \left(\left(y-scale \cdot x-scale\right) \cdot \sqrt{8}\right)\right) \cdot \sqrt{\color{blue}{2 \cdot \left(\frac{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}} + \frac{{b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}}\right)}}
\] |
Taylor expanded in y-scale around -inf 16.8%
Simplified28.2%
[Start]16.8 | \[ -0.25 \cdot \left(\left(\sqrt{2} \cdot \left(x-scale \cdot \sqrt{8}\right)\right) \cdot \sqrt{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}\right)
\] |
|---|---|
*-commutative [=>]16.8 | \[ \color{blue}{\left(\left(\sqrt{2} \cdot \left(x-scale \cdot \sqrt{8}\right)\right) \cdot \sqrt{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}\right) \cdot -0.25}
\] |
associate-*l* [=>]16.8 | \[ \color{blue}{\left(\sqrt{2} \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}\right)\right)} \cdot -0.25
\] |
associate-*l* [=>]16.8 | \[ \color{blue}{\sqrt{2} \cdot \left(\left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}\right) \cdot -0.25\right)}
\] |
Taylor expanded in angle around 0 28.1%
if -2.3e-129 < x-scale < 3.10000000000000019e-120Initial program 0.1%
Taylor expanded in angle around 0 18.9%
Applied egg-rr19.1%
[Start]18.9 | \[ 0.25 \cdot \left(\sqrt{2} \cdot \left(y-scale \cdot \left(b \cdot \sqrt{8}\right)\right)\right)
\] |
|---|---|
add-log-exp [=>]5.6 | \[ 0.25 \cdot \color{blue}{\log \left(e^{\sqrt{2} \cdot \left(y-scale \cdot \left(b \cdot \sqrt{8}\right)\right)}\right)}
\] |
*-un-lft-identity [=>]5.6 | \[ 0.25 \cdot \log \color{blue}{\left(1 \cdot e^{\sqrt{2} \cdot \left(y-scale \cdot \left(b \cdot \sqrt{8}\right)\right)}\right)}
\] |
log-prod [=>]5.6 | \[ 0.25 \cdot \color{blue}{\left(\log 1 + \log \left(e^{\sqrt{2} \cdot \left(y-scale \cdot \left(b \cdot \sqrt{8}\right)\right)}\right)\right)}
\] |
metadata-eval [=>]5.6 | \[ 0.25 \cdot \left(\color{blue}{0} + \log \left(e^{\sqrt{2} \cdot \left(y-scale \cdot \left(b \cdot \sqrt{8}\right)\right)}\right)\right)
\] |
add-log-exp [<=]18.9 | \[ 0.25 \cdot \left(0 + \color{blue}{\sqrt{2} \cdot \left(y-scale \cdot \left(b \cdot \sqrt{8}\right)\right)}\right)
\] |
*-commutative [=>]18.9 | \[ 0.25 \cdot \left(0 + \color{blue}{\left(y-scale \cdot \left(b \cdot \sqrt{8}\right)\right) \cdot \sqrt{2}}\right)
\] |
associate-*r* [=>]18.9 | \[ 0.25 \cdot \left(0 + \color{blue}{\left(\left(y-scale \cdot b\right) \cdot \sqrt{8}\right)} \cdot \sqrt{2}\right)
\] |
associate-*l* [=>]18.8 | \[ 0.25 \cdot \left(0 + \color{blue}{\left(y-scale \cdot b\right) \cdot \left(\sqrt{8} \cdot \sqrt{2}\right)}\right)
\] |
*-commutative [=>]18.8 | \[ 0.25 \cdot \left(0 + \color{blue}{\left(b \cdot y-scale\right)} \cdot \left(\sqrt{8} \cdot \sqrt{2}\right)\right)
\] |
pow1/2 [=>]18.8 | \[ 0.25 \cdot \left(0 + \left(b \cdot y-scale\right) \cdot \left(\color{blue}{{8}^{0.5}} \cdot \sqrt{2}\right)\right)
\] |
pow1/2 [=>]18.8 | \[ 0.25 \cdot \left(0 + \left(b \cdot y-scale\right) \cdot \left({8}^{0.5} \cdot \color{blue}{{2}^{0.5}}\right)\right)
\] |
pow-prod-down [=>]19.1 | \[ 0.25 \cdot \left(0 + \left(b \cdot y-scale\right) \cdot \color{blue}{{\left(8 \cdot 2\right)}^{0.5}}\right)
\] |
metadata-eval [=>]19.1 | \[ 0.25 \cdot \left(0 + \left(b \cdot y-scale\right) \cdot {\color{blue}{16}}^{0.5}\right)
\] |
Simplified19.1%
[Start]19.1 | \[ 0.25 \cdot \left(0 + \left(b \cdot y-scale\right) \cdot {16}^{0.5}\right)
\] |
|---|---|
+-lft-identity [=>]19.1 | \[ 0.25 \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot {16}^{0.5}\right)}
\] |
unpow1/2 [=>]19.1 | \[ 0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{\sqrt{16}}\right)
\] |
metadata-eval [=>]19.1 | \[ 0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot \color{blue}{4}\right)
\] |
Applied egg-rr15.1%
[Start]19.1 | \[ 0.25 \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)
\] |
|---|---|
expm1-log1p-u [=>]18.2 | \[ 0.25 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(b \cdot y-scale\right) \cdot 4\right)\right)}
\] |
expm1-udef [=>]14.2 | \[ 0.25 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\left(b \cdot y-scale\right) \cdot 4\right)} - 1\right)}
\] |
log1p-udef [=>]14.2 | \[ 0.25 \cdot \left(e^{\color{blue}{\log \left(1 + \left(b \cdot y-scale\right) \cdot 4\right)}} - 1\right)
\] |
add-exp-log [<=]15.1 | \[ 0.25 \cdot \left(\color{blue}{\left(1 + \left(b \cdot y-scale\right) \cdot 4\right)} - 1\right)
\] |
associate-*l* [=>]15.1 | \[ 0.25 \cdot \left(\left(1 + \color{blue}{b \cdot \left(y-scale \cdot 4\right)}\right) - 1\right)
\] |
Applied egg-rr22.1%
[Start]15.1 | \[ 0.25 \cdot \left(\left(1 + b \cdot \left(y-scale \cdot 4\right)\right) - 1\right)
\] |
|---|---|
*-rgt-identity [<=]15.1 | \[ 0.25 \cdot \left(\color{blue}{\left(1 + b \cdot \left(y-scale \cdot 4\right)\right) \cdot 1} - 1\right)
\] |
add-exp-log [=>]14.2 | \[ 0.25 \cdot \left(\color{blue}{e^{\log \left(\left(1 + b \cdot \left(y-scale \cdot 4\right)\right) \cdot 1\right)}} - 1\right)
\] |
*-rgt-identity [=>]14.2 | \[ 0.25 \cdot \left(e^{\log \color{blue}{\left(1 + b \cdot \left(y-scale \cdot 4\right)\right)}} - 1\right)
\] |
log1p-udef [<=]14.2 | \[ 0.25 \cdot \left(e^{\color{blue}{\mathsf{log1p}\left(b \cdot \left(y-scale \cdot 4\right)\right)}} - 1\right)
\] |
expm1-udef [<=]18.2 | \[ 0.25 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}
\] |
expm1-log1p-u [<=]19.1 | \[ 0.25 \cdot \color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)}
\] |
add-sqr-sqrt [=>]18.3 | \[ 0.25 \cdot \color{blue}{\left(\sqrt{b \cdot \left(y-scale \cdot 4\right)} \cdot \sqrt{b \cdot \left(y-scale \cdot 4\right)}\right)}
\] |
sqrt-unprod [=>]22.1 | \[ 0.25 \cdot \color{blue}{\sqrt{\left(b \cdot \left(y-scale \cdot 4\right)\right) \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)}}
\] |
pow1/2 [=>]22.1 | \[ 0.25 \cdot \color{blue}{{\left(\left(b \cdot \left(y-scale \cdot 4\right)\right) \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}^{0.5}}
\] |
associate-*r* [=>]22.1 | \[ 0.25 \cdot {\left(\color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right)} \cdot \left(b \cdot \left(y-scale \cdot 4\right)\right)\right)}^{0.5}
\] |
associate-*r* [=>]22.1 | \[ 0.25 \cdot {\left(\left(\left(b \cdot y-scale\right) \cdot 4\right) \cdot \color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right)}\right)}^{0.5}
\] |
swap-sqr [=>]22.1 | \[ 0.25 \cdot {\color{blue}{\left(\left(\left(b \cdot y-scale\right) \cdot \left(b \cdot y-scale\right)\right) \cdot \left(4 \cdot 4\right)\right)}}^{0.5}
\] |
pow2 [=>]22.1 | \[ 0.25 \cdot {\left(\color{blue}{{\left(b \cdot y-scale\right)}^{2}} \cdot \left(4 \cdot 4\right)\right)}^{0.5}
\] |
metadata-eval [=>]22.1 | \[ 0.25 \cdot {\left({\left(b \cdot y-scale\right)}^{2} \cdot \color{blue}{16}\right)}^{0.5}
\] |
Simplified34.0%
[Start]22.1 | \[ 0.25 \cdot {\left({\left(b \cdot y-scale\right)}^{2} \cdot 16\right)}^{0.5}
\] |
|---|---|
unpow1/2 [=>]22.1 | \[ 0.25 \cdot \color{blue}{\sqrt{{\left(b \cdot y-scale\right)}^{2} \cdot 16}}
\] |
unpow2 [=>]22.1 | \[ 0.25 \cdot \sqrt{\color{blue}{\left(\left(b \cdot y-scale\right) \cdot \left(b \cdot y-scale\right)\right)} \cdot 16}
\] |
metadata-eval [<=]22.1 | \[ 0.25 \cdot \sqrt{\left(\left(b \cdot y-scale\right) \cdot \left(b \cdot y-scale\right)\right) \cdot \color{blue}{\left(4 \cdot 4\right)}}
\] |
swap-sqr [<=]22.1 | \[ 0.25 \cdot \sqrt{\color{blue}{\left(\left(b \cdot y-scale\right) \cdot 4\right) \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)}}
\] |
associate-*r* [<=]22.1 | \[ 0.25 \cdot \sqrt{\color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)} \cdot \left(\left(b \cdot y-scale\right) \cdot 4\right)}
\] |
associate-*r* [<=]22.1 | \[ 0.25 \cdot \sqrt{\left(b \cdot \left(y-scale \cdot 4\right)\right) \cdot \color{blue}{\left(b \cdot \left(y-scale \cdot 4\right)\right)}}
\] |
rem-sqrt-square [=>]34.0 | \[ 0.25 \cdot \color{blue}{\left|b \cdot \left(y-scale \cdot 4\right)\right|}
\] |
*-commutative [<=]34.0 | \[ 0.25 \cdot \left|\color{blue}{\left(y-scale \cdot 4\right) \cdot b}\right|
\] |
*-commutative [=>]34.0 | \[ 0.25 \cdot \left|\color{blue}{\left(4 \cdot y-scale\right)} \cdot b\right|
\] |
associate-*r* [<=]34.0 | \[ 0.25 \cdot \left|\color{blue}{4 \cdot \left(y-scale \cdot b\right)}\right|
\] |
if 3.10000000000000019e-120 < x-scale Initial program 1.0%
Taylor expanded in x-scale around inf 3.7%
Simplified4.1%
[Start]3.7 | \[ 0.25 \cdot \left(\left(y-scale \cdot \left(x-scale \cdot \sqrt{8}\right)\right) \cdot \sqrt{2 \cdot \frac{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}} + 2 \cdot \frac{{b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}}}\right)
\] |
|---|---|
associate-*r* [=>]3.7 | \[ \color{blue}{\left(0.25 \cdot \left(y-scale \cdot \left(x-scale \cdot \sqrt{8}\right)\right)\right) \cdot \sqrt{2 \cdot \frac{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}} + 2 \cdot \frac{{b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}}}}
\] |
associate-*r* [=>]3.7 | \[ \left(0.25 \cdot \color{blue}{\left(\left(y-scale \cdot x-scale\right) \cdot \sqrt{8}\right)}\right) \cdot \sqrt{2 \cdot \frac{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}} + 2 \cdot \frac{{b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}}}
\] |
distribute-lft-out [=>]3.7 | \[ \left(0.25 \cdot \left(\left(y-scale \cdot x-scale\right) \cdot \sqrt{8}\right)\right) \cdot \sqrt{\color{blue}{2 \cdot \left(\frac{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}} + \frac{{b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}{{y-scale}^{2}}\right)}}
\] |
Taylor expanded in y-scale around 0 16.9%
Simplified29.3%
[Start]16.9 | \[ 0.25 \cdot \left(\left(\sqrt{2} \cdot \left(x-scale \cdot \sqrt{8}\right)\right) \cdot \sqrt{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}\right)
\] |
|---|---|
*-commutative [=>]16.9 | \[ \color{blue}{\left(\left(\sqrt{2} \cdot \left(x-scale \cdot \sqrt{8}\right)\right) \cdot \sqrt{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}\right) \cdot 0.25}
\] |
associate-*l* [=>]16.9 | \[ \color{blue}{\left(\sqrt{2} \cdot \left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}\right)\right)} \cdot 0.25
\] |
associate-*l* [=>]16.9 | \[ \color{blue}{\sqrt{2} \cdot \left(\left(\left(x-scale \cdot \sqrt{8}\right) \cdot \sqrt{{a}^{2} \cdot {\cos \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2} + {b}^{2} \cdot {\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}^{2}}\right) \cdot 0.25\right)}
\] |
Final simplification30.3%
| Alternative 1 | |
|---|---|
| Accuracy | 25.7% |
| Cost | 39560 |
| Alternative 2 | |
|---|---|
| Accuracy | 24.4% |
| Cost | 33416 |
| Alternative 3 | |
|---|---|
| Accuracy | 24.9% |
| Cost | 33092 |
| Alternative 4 | |
|---|---|
| Accuracy | 23.8% |
| Cost | 26692 |
| Alternative 5 | |
|---|---|
| Accuracy | 21.4% |
| Cost | 13641 |
| Alternative 6 | |
|---|---|
| Accuracy | 21.3% |
| Cost | 13641 |
| Alternative 7 | |
|---|---|
| Accuracy | 21.4% |
| Cost | 13641 |
| Alternative 8 | |
|---|---|
| Accuracy | 21.4% |
| Cost | 13641 |
| Alternative 9 | |
|---|---|
| Accuracy | 20.2% |
| Cost | 6848 |
| Alternative 10 | |
|---|---|
| Accuracy | 11.1% |
| Cost | 448 |
herbie shell --seed 2023153
(FPCore (a b angle x-scale y-scale)
:name "a from scale-rotated-ellipse"
:precision binary64
(/ (- (sqrt (* (* (* 2.0 (/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0))) (* (* b a) (* b (- a)))) (+ (+ (/ (/ (+ (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)) (sqrt (+ (pow (- (/ (/ (+ (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)) 2.0) (pow (/ (/ (* (* (* 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))))))) (/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0))))