
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI))
(t_1 (cos t_0))
(t_2 (sin t_0))
(t_3
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_2) t_1) x-scale)
y-scale))
(t_4
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) y-scale) y-scale))
(t_5
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) x-scale) x-scale)))
(*
180.0
(/
(atan
(/ (- (- t_4 t_5) (sqrt (+ (pow (- t_5 t_4) 2.0) (pow t_3 2.0)))) t_3))
PI))))
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 = cos(t_0);
double t_2 = sin(t_0);
double t_3 = ((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_2) * t_1) / x_45_scale) / y_45_scale;
double t_4 = ((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale;
double t_5 = ((pow((a * t_2), 2.0) + pow((b * t_1), 2.0)) / x_45_scale) / x_45_scale;
return 180.0 * (atan((((t_4 - t_5) - sqrt((pow((t_5 - t_4), 2.0) + pow(t_3, 2.0)))) / t_3)) / ((double) M_PI));
}
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.cos(t_0);
double t_2 = Math.sin(t_0);
double t_3 = ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_2) * t_1) / x_45_scale) / y_45_scale;
double t_4 = ((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale;
double t_5 = ((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / x_45_scale) / x_45_scale;
return 180.0 * (Math.atan((((t_4 - t_5) - Math.sqrt((Math.pow((t_5 - t_4), 2.0) + Math.pow(t_3, 2.0)))) / t_3)) / Math.PI);
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (angle / 180.0) * math.pi t_1 = math.cos(t_0) t_2 = math.sin(t_0) t_3 = ((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_2) * t_1) / x_45_scale) / y_45_scale t_4 = ((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale t_5 = ((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / x_45_scale) / x_45_scale return 180.0 * (math.atan((((t_4 - t_5) - math.sqrt((math.pow((t_5 - t_4), 2.0) + math.pow(t_3, 2.0)))) / t_3)) / math.pi)
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(angle / 180.0) * pi) t_1 = cos(t_0) t_2 = sin(t_0) t_3 = Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_2) * t_1) / x_45_scale) / y_45_scale) t_4 = Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / y_45_scale) / y_45_scale) t_5 = Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / x_45_scale) / x_45_scale) return Float64(180.0 * Float64(atan(Float64(Float64(Float64(t_4 - t_5) - sqrt(Float64((Float64(t_5 - t_4) ^ 2.0) + (t_3 ^ 2.0)))) / t_3)) / pi)) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (angle / 180.0) * pi; t_1 = cos(t_0); t_2 = sin(t_0); t_3 = ((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_2) * t_1) / x_45_scale) / y_45_scale; t_4 = ((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / y_45_scale) / y_45_scale; t_5 = ((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / x_45_scale) / x_45_scale; tmp = 180.0 * (atan((((t_4 - t_5) - sqrt((((t_5 - t_4) ^ 2.0) + (t_3 ^ 2.0)))) / t_3)) / pi); 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[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Sin[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$2), $MachinePrecision] * t$95$1), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, Block[{t$95$4 = 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] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, Block[{t$95$5 = 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] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]}, N[(180.0 * N[(N[ArcTan[N[(N[(N[(t$95$4 - t$95$5), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(t$95$5 - t$95$4), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[t$95$3, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := \cos t\_0\\
t_2 := \sin t\_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_2\right) \cdot t\_1}{x-scale}}{y-scale}\\
t_4 := \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{y-scale}}{y-scale}\\
t_5 := \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{x-scale}}{x-scale}\\
180 \cdot \frac{\tan^{-1} \left(\frac{\left(t\_4 - t\_5\right) - \sqrt{{\left(t\_5 - t\_4\right)}^{2} + {t\_3}^{2}}}{t\_3}\right)}{\pi}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI))
(t_1 (cos t_0))
(t_2 (sin t_0))
(t_3
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_2) t_1) x-scale)
y-scale))
(t_4
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) y-scale) y-scale))
(t_5
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) x-scale) x-scale)))
(*
180.0
(/
(atan
(/ (- (- t_4 t_5) (sqrt (+ (pow (- t_5 t_4) 2.0) (pow t_3 2.0)))) t_3))
PI))))
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 = cos(t_0);
double t_2 = sin(t_0);
double t_3 = ((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_2) * t_1) / x_45_scale) / y_45_scale;
double t_4 = ((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale;
double t_5 = ((pow((a * t_2), 2.0) + pow((b * t_1), 2.0)) / x_45_scale) / x_45_scale;
return 180.0 * (atan((((t_4 - t_5) - sqrt((pow((t_5 - t_4), 2.0) + pow(t_3, 2.0)))) / t_3)) / ((double) M_PI));
}
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.cos(t_0);
double t_2 = Math.sin(t_0);
double t_3 = ((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_2) * t_1) / x_45_scale) / y_45_scale;
double t_4 = ((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale;
double t_5 = ((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / x_45_scale) / x_45_scale;
return 180.0 * (Math.atan((((t_4 - t_5) - Math.sqrt((Math.pow((t_5 - t_4), 2.0) + Math.pow(t_3, 2.0)))) / t_3)) / Math.PI);
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (angle / 180.0) * math.pi t_1 = math.cos(t_0) t_2 = math.sin(t_0) t_3 = ((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_2) * t_1) / x_45_scale) / y_45_scale t_4 = ((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / y_45_scale) / y_45_scale t_5 = ((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / x_45_scale) / x_45_scale return 180.0 * (math.atan((((t_4 - t_5) - math.sqrt((math.pow((t_5 - t_4), 2.0) + math.pow(t_3, 2.0)))) / t_3)) / math.pi)
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(angle / 180.0) * pi) t_1 = cos(t_0) t_2 = sin(t_0) t_3 = Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_2) * t_1) / x_45_scale) / y_45_scale) t_4 = Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / y_45_scale) / y_45_scale) t_5 = Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / x_45_scale) / x_45_scale) return Float64(180.0 * Float64(atan(Float64(Float64(Float64(t_4 - t_5) - sqrt(Float64((Float64(t_5 - t_4) ^ 2.0) + (t_3 ^ 2.0)))) / t_3)) / pi)) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (angle / 180.0) * pi; t_1 = cos(t_0); t_2 = sin(t_0); t_3 = ((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_2) * t_1) / x_45_scale) / y_45_scale; t_4 = ((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / y_45_scale) / y_45_scale; t_5 = ((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / x_45_scale) / x_45_scale; tmp = 180.0 * (atan((((t_4 - t_5) - sqrt((((t_5 - t_4) ^ 2.0) + (t_3 ^ 2.0)))) / t_3)) / pi); 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[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Sin[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$2), $MachinePrecision] * t$95$1), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, Block[{t$95$4 = 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] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, Block[{t$95$5 = 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] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]}, N[(180.0 * N[(N[ArcTan[N[(N[(N[(t$95$4 - t$95$5), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(t$95$5 - t$95$4), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[t$95$3, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := \cos t\_0\\
t_2 := \sin t\_0\\
t_3 := \frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_2\right) \cdot t\_1}{x-scale}}{y-scale}\\
t_4 := \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{y-scale}}{y-scale}\\
t_5 := \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{x-scale}}{x-scale}\\
180 \cdot \frac{\tan^{-1} \left(\frac{\left(t\_4 - t\_5\right) - \sqrt{{\left(t\_5 - t\_4\right)}^{2} + {t\_3}^{2}}}{t\_3}\right)}{\pi}
\end{array}
\end{array}
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle PI))))
(if (<= a_m 1.25e-55)
(/ (* -180.0 (atan (/ (/ y-scale x-scale) (tan t_0)))) PI)
(* 180.0 (/ (atan (* (/ y-scale x-scale) (/ (sin t_0) (cos t_0)))) PI)))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
double tmp;
if (a_m <= 1.25e-55) {
tmp = (-180.0 * atan(((y_45_scale / x_45_scale) / tan(t_0)))) / ((double) M_PI);
} else {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (sin(t_0) / cos(t_0)))) / ((double) M_PI));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.005555555555555556 * (angle * Math.PI);
double tmp;
if (a_m <= 1.25e-55) {
tmp = (-180.0 * Math.atan(((y_45_scale / x_45_scale) / Math.tan(t_0)))) / Math.PI;
} else {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (Math.sin(t_0) / Math.cos(t_0)))) / Math.PI);
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = 0.005555555555555556 * (angle * math.pi) tmp = 0 if a_m <= 1.25e-55: tmp = (-180.0 * math.atan(((y_45_scale / x_45_scale) / math.tan(t_0)))) / math.pi else: tmp = 180.0 * (math.atan(((y_45_scale / x_45_scale) * (math.sin(t_0) / math.cos(t_0)))) / math.pi) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(0.005555555555555556 * Float64(angle * pi)) tmp = 0.0 if (a_m <= 1.25e-55) tmp = Float64(Float64(-180.0 * atan(Float64(Float64(y_45_scale / x_45_scale) / tan(t_0)))) / pi); else tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(sin(t_0) / cos(t_0)))) / pi)); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = 0.005555555555555556 * (angle * pi); tmp = 0.0; if (a_m <= 1.25e-55) tmp = (-180.0 * atan(((y_45_scale / x_45_scale) / tan(t_0)))) / pi; else tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (sin(t_0) / cos(t_0)))) / pi); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a$95$m, 1.25e-55], N[(N[(-180.0 * N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] / N[Tan[t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[(N[Sin[t$95$0], $MachinePrecision] / N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
\mathbf{if}\;a\_m \leq 1.25 \cdot 10^{-55}:\\
\;\;\;\;\frac{-180 \cdot \tan^{-1} \left(\frac{\frac{y-scale}{x-scale}}{\tan t\_0}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{\sin t\_0}{\cos t\_0}\right)}{\pi}\\
\end{array}
\end{array}
if a < 1.25e-55Initial program 20.3%
Simplified18.9%
Taylor expanded in x-scale around 0 30.0%
Simplified32.5%
Taylor expanded in a around 0 48.9%
mul-1-neg48.9%
times-frac50.8%
Simplified50.8%
associate-*r/50.8%
atan-neg50.8%
clear-num50.8%
quot-tan50.8%
associate-*r*48.1%
Applied egg-rr48.1%
distribute-rgt-neg-out48.1%
distribute-lft-neg-in48.1%
metadata-eval48.1%
associate-*r/48.1%
*-rgt-identity48.1%
associate-*r*50.8%
Simplified50.8%
if 1.25e-55 < a Initial program 12.0%
Simplified10.4%
Taylor expanded in x-scale around 0 21.4%
Simplified28.2%
Taylor expanded in a around inf 55.5%
times-frac57.2%
Simplified57.2%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle PI))))
(if (<= a_m 7.5e-55)
(/ (* -180.0 (atan (/ (/ y-scale x-scale) (tan t_0)))) PI)
(* 180.0 (/ (atan (* y-scale (/ (sin t_0) (* x-scale (cos t_0))))) PI)))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
double tmp;
if (a_m <= 7.5e-55) {
tmp = (-180.0 * atan(((y_45_scale / x_45_scale) / tan(t_0)))) / ((double) M_PI);
} else {
tmp = 180.0 * (atan((y_45_scale * (sin(t_0) / (x_45_scale * cos(t_0))))) / ((double) M_PI));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.005555555555555556 * (angle * Math.PI);
double tmp;
if (a_m <= 7.5e-55) {
tmp = (-180.0 * Math.atan(((y_45_scale / x_45_scale) / Math.tan(t_0)))) / Math.PI;
} else {
tmp = 180.0 * (Math.atan((y_45_scale * (Math.sin(t_0) / (x_45_scale * Math.cos(t_0))))) / Math.PI);
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = 0.005555555555555556 * (angle * math.pi) tmp = 0 if a_m <= 7.5e-55: tmp = (-180.0 * math.atan(((y_45_scale / x_45_scale) / math.tan(t_0)))) / math.pi else: tmp = 180.0 * (math.atan((y_45_scale * (math.sin(t_0) / (x_45_scale * math.cos(t_0))))) / math.pi) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(0.005555555555555556 * Float64(angle * pi)) tmp = 0.0 if (a_m <= 7.5e-55) tmp = Float64(Float64(-180.0 * atan(Float64(Float64(y_45_scale / x_45_scale) / tan(t_0)))) / pi); else tmp = Float64(180.0 * Float64(atan(Float64(y_45_scale * Float64(sin(t_0) / Float64(x_45_scale * cos(t_0))))) / pi)); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = 0.005555555555555556 * (angle * pi); tmp = 0.0; if (a_m <= 7.5e-55) tmp = (-180.0 * atan(((y_45_scale / x_45_scale) / tan(t_0)))) / pi; else tmp = 180.0 * (atan((y_45_scale * (sin(t_0) / (x_45_scale * cos(t_0))))) / pi); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a$95$m, 7.5e-55], N[(N[(-180.0 * N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] / N[Tan[t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(y$45$scale * N[(N[Sin[t$95$0], $MachinePrecision] / N[(x$45$scale * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
\mathbf{if}\;a\_m \leq 7.5 \cdot 10^{-55}:\\
\;\;\;\;\frac{-180 \cdot \tan^{-1} \left(\frac{\frac{y-scale}{x-scale}}{\tan t\_0}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(y-scale \cdot \frac{\sin t\_0}{x-scale \cdot \cos t\_0}\right)}{\pi}\\
\end{array}
\end{array}
if a < 7.50000000000000023e-55Initial program 20.3%
Simplified18.9%
Taylor expanded in x-scale around 0 30.0%
Simplified32.5%
Taylor expanded in a around 0 48.9%
mul-1-neg48.9%
times-frac50.8%
Simplified50.8%
associate-*r/50.8%
atan-neg50.8%
clear-num50.8%
quot-tan50.8%
associate-*r*48.1%
Applied egg-rr48.1%
distribute-rgt-neg-out48.1%
distribute-lft-neg-in48.1%
metadata-eval48.1%
associate-*r/48.1%
*-rgt-identity48.1%
associate-*r*50.8%
Simplified50.8%
if 7.50000000000000023e-55 < a Initial program 12.0%
Simplified10.4%
Taylor expanded in x-scale around 0 21.4%
Simplified28.2%
add-cbrt-cube29.7%
Applied egg-rr29.7%
Taylor expanded in a around inf 55.5%
associate-/l*57.1%
*-commutative57.1%
Simplified57.1%
Final simplification52.3%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (or (<= angle -1.6) (not (<= angle 340.0)))
(/
(*
-180.0
(atan
(/ y-scale (* x-scale (sin (* 0.005555555555555556 (* angle PI)))))))
PI)
(*
180.0
(/ (atan (* -180.0 (/ 1.0 (* angle (/ (* x-scale PI) y-scale))))) PI))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if ((angle <= -1.6) || !(angle <= 340.0)) {
tmp = (-180.0 * atan((y_45_scale / (x_45_scale * sin((0.005555555555555556 * (angle * ((double) M_PI)))))))) / ((double) M_PI);
} else {
tmp = 180.0 * (atan((-180.0 * (1.0 / (angle * ((x_45_scale * ((double) M_PI)) / y_45_scale))))) / ((double) M_PI));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if ((angle <= -1.6) || !(angle <= 340.0)) {
tmp = (-180.0 * Math.atan((y_45_scale / (x_45_scale * Math.sin((0.005555555555555556 * (angle * Math.PI))))))) / Math.PI;
} else {
tmp = 180.0 * (Math.atan((-180.0 * (1.0 / (angle * ((x_45_scale * Math.PI) / y_45_scale))))) / Math.PI);
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): tmp = 0 if (angle <= -1.6) or not (angle <= 340.0): tmp = (-180.0 * math.atan((y_45_scale / (x_45_scale * math.sin((0.005555555555555556 * (angle * math.pi))))))) / math.pi else: tmp = 180.0 * (math.atan((-180.0 * (1.0 / (angle * ((x_45_scale * math.pi) / y_45_scale))))) / math.pi) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 0.0 if ((angle <= -1.6) || !(angle <= 340.0)) tmp = Float64(Float64(-180.0 * atan(Float64(y_45_scale / Float64(x_45_scale * sin(Float64(0.005555555555555556 * Float64(angle * pi))))))) / pi); else tmp = Float64(180.0 * Float64(atan(Float64(-180.0 * Float64(1.0 / Float64(angle * Float64(Float64(x_45_scale * pi) / y_45_scale))))) / pi)); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 0.0; if ((angle <= -1.6) || ~((angle <= 340.0))) tmp = (-180.0 * atan((y_45_scale / (x_45_scale * sin((0.005555555555555556 * (angle * pi))))))) / pi; else tmp = 180.0 * (atan((-180.0 * (1.0 / (angle * ((x_45_scale * pi) / y_45_scale))))) / pi); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := If[Or[LessEqual[angle, -1.6], N[Not[LessEqual[angle, 340.0]], $MachinePrecision]], N[(N[(-180.0 * N[ArcTan[N[(y$45$scale / N[(x$45$scale * N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(-180.0 * N[(1.0 / N[(angle * N[(N[(x$45$scale * Pi), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;angle \leq -1.6 \lor \neg \left(angle \leq 340\right):\\
\;\;\;\;\frac{-180 \cdot \tan^{-1} \left(\frac{y-scale}{x-scale \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{1}{angle \cdot \frac{x-scale \cdot \pi}{y-scale}}\right)}{\pi}\\
\end{array}
\end{array}
if angle < -1.6000000000000001 or 340 < angle Initial program 12.0%
Simplified10.5%
Taylor expanded in x-scale around 0 22.1%
Simplified22.3%
Taylor expanded in a around 0 43.5%
mul-1-neg43.5%
times-frac43.5%
Simplified43.5%
Taylor expanded in angle around 0 46.9%
associate-*r/46.9%
atan-neg46.9%
un-div-inv46.9%
Applied egg-rr46.9%
distribute-rgt-neg-out46.9%
distribute-lft-neg-in46.9%
metadata-eval46.9%
associate-/r*46.9%
Simplified46.9%
if -1.6000000000000001 < angle < 340Initial program 24.5%
Simplified23.2%
Taylor expanded in x-scale around 0 33.6%
Simplified40.3%
Taylor expanded in a around 0 46.8%
mul-1-neg46.8%
times-frac52.7%
Simplified52.7%
Taylor expanded in angle around 0 47.0%
*-commutative47.0%
Simplified47.0%
clear-num47.6%
inv-pow47.6%
*-commutative47.6%
Applied egg-rr47.6%
unpow-147.6%
associate-/l*54.2%
Simplified54.2%
Final simplification50.6%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (or (<= angle -6200000000000.0) (not (<= angle 4.3e+48)))
(*
-180.0
(/
(atan (/ y-scale (* x-scale (tan (* 0.005555555555555556 (* angle PI))))))
PI))
(*
180.0
(/ (atan (* -180.0 (/ 1.0 (* angle (/ (* x-scale PI) y-scale))))) PI))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if ((angle <= -6200000000000.0) || !(angle <= 4.3e+48)) {
tmp = -180.0 * (atan((y_45_scale / (x_45_scale * tan((0.005555555555555556 * (angle * ((double) M_PI))))))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((-180.0 * (1.0 / (angle * ((x_45_scale * ((double) M_PI)) / y_45_scale))))) / ((double) M_PI));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if ((angle <= -6200000000000.0) || !(angle <= 4.3e+48)) {
tmp = -180.0 * (Math.atan((y_45_scale / (x_45_scale * Math.tan((0.005555555555555556 * (angle * Math.PI)))))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan((-180.0 * (1.0 / (angle * ((x_45_scale * Math.PI) / y_45_scale))))) / Math.PI);
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): tmp = 0 if (angle <= -6200000000000.0) or not (angle <= 4.3e+48): tmp = -180.0 * (math.atan((y_45_scale / (x_45_scale * math.tan((0.005555555555555556 * (angle * math.pi)))))) / math.pi) else: tmp = 180.0 * (math.atan((-180.0 * (1.0 / (angle * ((x_45_scale * math.pi) / y_45_scale))))) / math.pi) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 0.0 if ((angle <= -6200000000000.0) || !(angle <= 4.3e+48)) tmp = Float64(-180.0 * Float64(atan(Float64(y_45_scale / Float64(x_45_scale * tan(Float64(0.005555555555555556 * Float64(angle * pi)))))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(-180.0 * Float64(1.0 / Float64(angle * Float64(Float64(x_45_scale * pi) / y_45_scale))))) / pi)); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 0.0; if ((angle <= -6200000000000.0) || ~((angle <= 4.3e+48))) tmp = -180.0 * (atan((y_45_scale / (x_45_scale * tan((0.005555555555555556 * (angle * pi)))))) / pi); else tmp = 180.0 * (atan((-180.0 * (1.0 / (angle * ((x_45_scale * pi) / y_45_scale))))) / pi); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := If[Or[LessEqual[angle, -6200000000000.0], N[Not[LessEqual[angle, 4.3e+48]], $MachinePrecision]], N[(-180.0 * N[(N[ArcTan[N[(y$45$scale / N[(x$45$scale * N[Tan[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(-180.0 * N[(1.0 / N[(angle * N[(N[(x$45$scale * Pi), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;angle \leq -6200000000000 \lor \neg \left(angle \leq 4.3 \cdot 10^{+48}\right):\\
\;\;\;\;-180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale \cdot \tan \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{1}{angle \cdot \frac{x-scale \cdot \pi}{y-scale}}\right)}{\pi}\\
\end{array}
\end{array}
if angle < -6.2e12 or 4.29999999999999978e48 < angle Initial program 11.2%
Simplified9.6%
Taylor expanded in x-scale around 0 21.2%
Simplified21.4%
Taylor expanded in a around 0 44.9%
mul-1-neg44.9%
times-frac44.9%
Simplified44.9%
add-log-exp43.1%
atan-neg43.1%
clear-num43.1%
quot-tan43.1%
associate-*r*39.0%
Applied egg-rr39.0%
Taylor expanded in y-scale around 0 44.9%
if -6.2e12 < angle < 4.29999999999999978e48Initial program 24.4%
Simplified23.2%
Taylor expanded in x-scale around 0 33.6%
Simplified39.9%
Taylor expanded in a around 0 45.5%
mul-1-neg45.5%
times-frac51.0%
Simplified51.0%
Taylor expanded in angle around 0 46.2%
*-commutative46.2%
Simplified46.2%
clear-num46.8%
inv-pow46.8%
*-commutative46.8%
Applied egg-rr46.8%
unpow-146.8%
associate-/l*52.9%
Simplified52.9%
Final simplification49.3%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle PI))))
(if (<= a_m 2.7e-157)
(* -180.0 (/ (atan (/ y-scale (* x-scale (tan t_0)))) PI))
(/ (* (atan (/ (/ y-scale x-scale) (sin t_0))) (- 180.0)) PI))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
double tmp;
if (a_m <= 2.7e-157) {
tmp = -180.0 * (atan((y_45_scale / (x_45_scale * tan(t_0)))) / ((double) M_PI));
} else {
tmp = (atan(((y_45_scale / x_45_scale) / sin(t_0))) * -180.0) / ((double) M_PI);
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.005555555555555556 * (angle * Math.PI);
double tmp;
if (a_m <= 2.7e-157) {
tmp = -180.0 * (Math.atan((y_45_scale / (x_45_scale * Math.tan(t_0)))) / Math.PI);
} else {
tmp = (Math.atan(((y_45_scale / x_45_scale) / Math.sin(t_0))) * -180.0) / Math.PI;
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = 0.005555555555555556 * (angle * math.pi) tmp = 0 if a_m <= 2.7e-157: tmp = -180.0 * (math.atan((y_45_scale / (x_45_scale * math.tan(t_0)))) / math.pi) else: tmp = (math.atan(((y_45_scale / x_45_scale) / math.sin(t_0))) * -180.0) / math.pi return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(0.005555555555555556 * Float64(angle * pi)) tmp = 0.0 if (a_m <= 2.7e-157) tmp = Float64(-180.0 * Float64(atan(Float64(y_45_scale / Float64(x_45_scale * tan(t_0)))) / pi)); else tmp = Float64(Float64(atan(Float64(Float64(y_45_scale / x_45_scale) / sin(t_0))) * Float64(-180.0)) / pi); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = 0.005555555555555556 * (angle * pi); tmp = 0.0; if (a_m <= 2.7e-157) tmp = -180.0 * (atan((y_45_scale / (x_45_scale * tan(t_0)))) / pi); else tmp = (atan(((y_45_scale / x_45_scale) / sin(t_0))) * -180.0) / pi; end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a$95$m, 2.7e-157], N[(-180.0 * N[(N[ArcTan[N[(y$45$scale / N[(x$45$scale * N[Tan[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] / N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-180.0)), $MachinePrecision] / Pi), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
\mathbf{if}\;a\_m \leq 2.7 \cdot 10^{-157}:\\
\;\;\;\;-180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale \cdot \tan t\_0}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\frac{y-scale}{x-scale}}{\sin t\_0}\right) \cdot \left(-180\right)}{\pi}\\
\end{array}
\end{array}
if a < 2.7e-157Initial program 17.8%
Simplified15.7%
Taylor expanded in x-scale around 0 26.7%
Simplified29.6%
Taylor expanded in a around 0 47.0%
mul-1-neg47.0%
times-frac48.2%
Simplified48.2%
add-log-exp48.0%
atan-neg48.0%
clear-num48.0%
quot-tan48.0%
associate-*r*46.2%
Applied egg-rr46.2%
Taylor expanded in y-scale around 0 47.0%
if 2.7e-157 < a Initial program 19.4%
Simplified19.2%
Taylor expanded in x-scale around 0 30.3%
Simplified34.8%
Taylor expanded in a around 0 41.8%
mul-1-neg41.8%
times-frac48.2%
Simplified48.2%
Taylor expanded in angle around 0 54.3%
associate-*r/54.3%
atan-neg54.3%
un-div-inv54.3%
Applied egg-rr54.3%
Final simplification49.6%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle PI))))
(if (<= a_m 2.55e-157)
(* -180.0 (/ (atan (/ y-scale (* x-scale (tan t_0)))) PI))
(* 180.0 (/ (atan (/ (/ y-scale x-scale) (sin t_0))) (- PI))))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
double tmp;
if (a_m <= 2.55e-157) {
tmp = -180.0 * (atan((y_45_scale / (x_45_scale * tan(t_0)))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) / sin(t_0))) / -((double) M_PI));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.005555555555555556 * (angle * Math.PI);
double tmp;
if (a_m <= 2.55e-157) {
tmp = -180.0 * (Math.atan((y_45_scale / (x_45_scale * Math.tan(t_0)))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) / Math.sin(t_0))) / -Math.PI);
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = 0.005555555555555556 * (angle * math.pi) tmp = 0 if a_m <= 2.55e-157: tmp = -180.0 * (math.atan((y_45_scale / (x_45_scale * math.tan(t_0)))) / math.pi) else: tmp = 180.0 * (math.atan(((y_45_scale / x_45_scale) / math.sin(t_0))) / -math.pi) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(0.005555555555555556 * Float64(angle * pi)) tmp = 0.0 if (a_m <= 2.55e-157) tmp = Float64(-180.0 * Float64(atan(Float64(y_45_scale / Float64(x_45_scale * tan(t_0)))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) / sin(t_0))) / Float64(-pi))); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = 0.005555555555555556 * (angle * pi); tmp = 0.0; if (a_m <= 2.55e-157) tmp = -180.0 * (atan((y_45_scale / (x_45_scale * tan(t_0)))) / pi); else tmp = 180.0 * (atan(((y_45_scale / x_45_scale) / sin(t_0))) / -pi); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a$95$m, 2.55e-157], N[(-180.0 * N[(N[ArcTan[N[(y$45$scale / N[(x$45$scale * N[Tan[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] / N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-Pi)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
\mathbf{if}\;a\_m \leq 2.55 \cdot 10^{-157}:\\
\;\;\;\;-180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale \cdot \tan t\_0}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\frac{y-scale}{x-scale}}{\sin t\_0}\right)}{-\pi}\\
\end{array}
\end{array}
if a < 2.54999999999999999e-157Initial program 17.8%
Simplified15.7%
Taylor expanded in x-scale around 0 26.7%
Simplified29.6%
Taylor expanded in a around 0 47.0%
mul-1-neg47.0%
times-frac48.2%
Simplified48.2%
add-log-exp48.0%
atan-neg48.0%
clear-num48.0%
quot-tan48.0%
associate-*r*46.2%
Applied egg-rr46.2%
Taylor expanded in y-scale around 0 47.0%
if 2.54999999999999999e-157 < a Initial program 19.4%
Simplified19.2%
Taylor expanded in x-scale around 0 30.3%
Simplified34.8%
Taylor expanded in a around 0 41.8%
mul-1-neg41.8%
times-frac48.2%
Simplified48.2%
Taylor expanded in angle around 0 54.3%
atan-neg54.3%
un-div-inv54.3%
Applied egg-rr54.3%
Final simplification49.6%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle PI))))
(if (<= y-scale -1.8e-88)
(/ (* -180.0 (atan (/ y-scale (* x-scale (sin t_0))))) PI)
(/ (* -180.0 (atan (/ (/ y-scale x-scale) (tan t_0)))) PI))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
double tmp;
if (y_45_scale <= -1.8e-88) {
tmp = (-180.0 * atan((y_45_scale / (x_45_scale * sin(t_0))))) / ((double) M_PI);
} else {
tmp = (-180.0 * atan(((y_45_scale / x_45_scale) / tan(t_0)))) / ((double) M_PI);
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.005555555555555556 * (angle * Math.PI);
double tmp;
if (y_45_scale <= -1.8e-88) {
tmp = (-180.0 * Math.atan((y_45_scale / (x_45_scale * Math.sin(t_0))))) / Math.PI;
} else {
tmp = (-180.0 * Math.atan(((y_45_scale / x_45_scale) / Math.tan(t_0)))) / Math.PI;
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = 0.005555555555555556 * (angle * math.pi) tmp = 0 if y_45_scale <= -1.8e-88: tmp = (-180.0 * math.atan((y_45_scale / (x_45_scale * math.sin(t_0))))) / math.pi else: tmp = (-180.0 * math.atan(((y_45_scale / x_45_scale) / math.tan(t_0)))) / math.pi return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(0.005555555555555556 * Float64(angle * pi)) tmp = 0.0 if (y_45_scale <= -1.8e-88) tmp = Float64(Float64(-180.0 * atan(Float64(y_45_scale / Float64(x_45_scale * sin(t_0))))) / pi); else tmp = Float64(Float64(-180.0 * atan(Float64(Float64(y_45_scale / x_45_scale) / tan(t_0)))) / pi); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = 0.005555555555555556 * (angle * pi); tmp = 0.0; if (y_45_scale <= -1.8e-88) tmp = (-180.0 * atan((y_45_scale / (x_45_scale * sin(t_0))))) / pi; else tmp = (-180.0 * atan(((y_45_scale / x_45_scale) / tan(t_0)))) / pi; end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$45$scale, -1.8e-88], N[(N[(-180.0 * N[ArcTan[N[(y$45$scale / N[(x$45$scale * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision], N[(N[(-180.0 * N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] / N[Tan[t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
\mathbf{if}\;y-scale \leq -1.8 \cdot 10^{-88}:\\
\;\;\;\;\frac{-180 \cdot \tan^{-1} \left(\frac{y-scale}{x-scale \cdot \sin t\_0}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{-180 \cdot \tan^{-1} \left(\frac{\frac{y-scale}{x-scale}}{\tan t\_0}\right)}{\pi}\\
\end{array}
\end{array}
if y-scale < -1.8e-88Initial program 29.2%
Simplified29.1%
Taylor expanded in x-scale around 0 37.5%
Simplified39.4%
Taylor expanded in a around 0 45.5%
mul-1-neg45.5%
times-frac45.5%
Simplified45.5%
Taylor expanded in angle around 0 50.6%
associate-*r/50.6%
atan-neg50.6%
un-div-inv50.6%
Applied egg-rr50.6%
distribute-rgt-neg-out50.6%
distribute-lft-neg-in50.6%
metadata-eval50.6%
associate-/r*50.6%
Simplified50.6%
if -1.8e-88 < y-scale Initial program 12.4%
Simplified10.2%
Taylor expanded in x-scale around 0 22.7%
Simplified27.1%
Taylor expanded in a around 0 45.0%
mul-1-neg45.0%
times-frac49.7%
Simplified49.7%
associate-*r/49.7%
atan-neg49.7%
clear-num49.7%
quot-tan49.7%
associate-*r*47.0%
Applied egg-rr47.0%
distribute-rgt-neg-out47.0%
distribute-lft-neg-in47.0%
metadata-eval47.0%
associate-*r/47.0%
*-rgt-identity47.0%
associate-*r*49.7%
Simplified49.7%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* -180.0 (/ 1.0 (* angle (/ (* x-scale PI) y-scale))))) PI)))
a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (atan((-180.0 * (1.0 / (angle * ((x_45_scale * ((double) M_PI)) / y_45_scale))))) / ((double) M_PI));
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (Math.atan((-180.0 * (1.0 / (angle * ((x_45_scale * Math.PI) / y_45_scale))))) / Math.PI);
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return 180.0 * (math.atan((-180.0 * (1.0 / (angle * ((x_45_scale * math.pi) / y_45_scale))))) / math.pi)
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64(180.0 * Float64(atan(Float64(-180.0 * Float64(1.0 / Float64(angle * Float64(Float64(x_45_scale * pi) / y_45_scale))))) / pi)) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 180.0 * (atan((-180.0 * (1.0 / (angle * ((x_45_scale * pi) / y_45_scale))))) / pi); end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := N[(180.0 * N[(N[ArcTan[N[(-180.0 * N[(1.0 / N[(angle * N[(N[(x$45$scale * Pi), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{1}{angle \cdot \frac{x-scale \cdot \pi}{y-scale}}\right)}{\pi}
\end{array}
Initial program 18.3%
Simplified16.9%
Taylor expanded in x-scale around 0 27.9%
Simplified31.5%
Taylor expanded in a around 0 45.2%
mul-1-neg45.2%
times-frac48.2%
Simplified48.2%
Taylor expanded in angle around 0 39.1%
*-commutative39.1%
Simplified39.1%
clear-num39.4%
inv-pow39.4%
*-commutative39.4%
Applied egg-rr39.4%
unpow-139.4%
associate-/l*42.8%
Simplified42.8%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* (/ 180.0 (* angle PI)) (/ y-scale (- x-scale)))) PI)))
a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (atan(((180.0 / (angle * ((double) M_PI))) * (y_45_scale / -x_45_scale))) / ((double) M_PI));
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (Math.atan(((180.0 / (angle * Math.PI)) * (y_45_scale / -x_45_scale))) / Math.PI);
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return 180.0 * (math.atan(((180.0 / (angle * math.pi)) * (y_45_scale / -x_45_scale))) / math.pi)
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64(180.0 * Float64(atan(Float64(Float64(180.0 / Float64(angle * pi)) * Float64(y_45_scale / Float64(-x_45_scale)))) / pi)) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 180.0 * (atan(((180.0 / (angle * pi)) * (y_45_scale / -x_45_scale))) / pi); end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := N[(180.0 * N[(N[ArcTan[N[(N[(180.0 / N[(angle * Pi), $MachinePrecision]), $MachinePrecision] * N[(y$45$scale / (-x$45$scale)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
180 \cdot \frac{\tan^{-1} \left(\frac{180}{angle \cdot \pi} \cdot \frac{y-scale}{-x-scale}\right)}{\pi}
\end{array}
Initial program 18.3%
Simplified16.9%
Taylor expanded in x-scale around 0 27.9%
Simplified31.5%
Taylor expanded in a around 0 45.2%
mul-1-neg45.2%
times-frac48.2%
Simplified48.2%
Taylor expanded in angle around 0 42.0%
Final simplification42.0%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* -180.0 (/ (/ y-scale angle) (* x-scale PI)))) PI)))
a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (atan((-180.0 * ((y_45_scale / angle) / (x_45_scale * ((double) M_PI))))) / ((double) M_PI));
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (Math.atan((-180.0 * ((y_45_scale / angle) / (x_45_scale * Math.PI)))) / Math.PI);
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return 180.0 * (math.atan((-180.0 * ((y_45_scale / angle) / (x_45_scale * math.pi)))) / math.pi)
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64(180.0 * Float64(atan(Float64(-180.0 * Float64(Float64(y_45_scale / angle) / Float64(x_45_scale * pi)))) / pi)) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 180.0 * (atan((-180.0 * ((y_45_scale / angle) / (x_45_scale * pi)))) / pi); end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := N[(180.0 * N[(N[ArcTan[N[(-180.0 * N[(N[(y$45$scale / angle), $MachinePrecision] / N[(x$45$scale * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{\frac{y-scale}{angle}}{x-scale \cdot \pi}\right)}{\pi}
\end{array}
Initial program 18.3%
Simplified16.9%
Taylor expanded in x-scale around 0 27.9%
Simplified31.5%
Taylor expanded in a around 0 45.2%
mul-1-neg45.2%
times-frac48.2%
Simplified48.2%
Taylor expanded in angle around 0 39.1%
associate-/r*39.1%
*-commutative39.1%
Simplified39.1%
Final simplification39.1%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* -180.0 (/ y-scale (* angle (* x-scale PI))))) PI)))
a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (atan((-180.0 * (y_45_scale / (angle * (x_45_scale * ((double) M_PI)))))) / ((double) M_PI));
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (Math.atan((-180.0 * (y_45_scale / (angle * (x_45_scale * Math.PI))))) / Math.PI);
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return 180.0 * (math.atan((-180.0 * (y_45_scale / (angle * (x_45_scale * math.pi))))) / math.pi)
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64(180.0 * Float64(atan(Float64(-180.0 * Float64(y_45_scale / Float64(angle * Float64(x_45_scale * pi))))) / pi)) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 180.0 * (atan((-180.0 * (y_45_scale / (angle * (x_45_scale * pi))))) / pi); end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := N[(180.0 * N[(N[ArcTan[N[(-180.0 * N[(y$45$scale / N[(angle * N[(x$45$scale * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \pi\right)}\right)}{\pi}
\end{array}
Initial program 18.3%
Simplified16.9%
Taylor expanded in angle around 0 15.0%
associate-*r/15.0%
associate-*r*13.7%
distribute-lft-out--13.7%
associate-*r*13.7%
Simplified13.7%
Taylor expanded in a around 0 39.1%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* -180.0 (/ x-scale (* angle (* y-scale PI))))) PI)))
a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (atan((-180.0 * (x_45_scale / (angle * (y_45_scale * ((double) M_PI)))))) / ((double) M_PI));
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (Math.atan((-180.0 * (x_45_scale / (angle * (y_45_scale * Math.PI))))) / Math.PI);
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return 180.0 * (math.atan((-180.0 * (x_45_scale / (angle * (y_45_scale * math.pi))))) / math.pi)
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64(180.0 * Float64(atan(Float64(-180.0 * Float64(x_45_scale / Float64(angle * Float64(y_45_scale * pi))))) / pi)) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 180.0 * (atan((-180.0 * (x_45_scale / (angle * (y_45_scale * pi))))) / pi); end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := N[(180.0 * N[(N[ArcTan[N[(-180.0 * N[(x$45$scale / N[(angle * N[(y$45$scale * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \pi\right)}\right)}{\pi}
\end{array}
Initial program 18.3%
Simplified16.9%
Taylor expanded in angle around 0 15.0%
associate-*r/15.0%
associate-*r*13.7%
distribute-lft-out--13.7%
associate-*r*13.7%
Simplified13.7%
Taylor expanded in a around inf 11.9%
herbie shell --seed 2024181
(FPCore (a b angle x-scale y-scale)
:name "raw-angle from scale-rotated-ellipse"
:precision binary64
(* 180.0 (/ (atan (/ (- (- (/ (/ (+ (pow (* a (cos (* (/ angle 180.0) PI))) 2.0) (pow (* b (sin (* (/ angle 180.0) PI))) 2.0)) y-scale) y-scale) (/ (/ (+ (pow (* a (sin (* (/ angle 180.0) PI))) 2.0) (pow (* b (cos (* (/ angle 180.0) PI))) 2.0)) x-scale) x-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)))) (/ (/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* (/ angle 180.0) PI))) (cos (* (/ angle 180.0) PI))) x-scale) y-scale))) PI)))