
(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 (pow (sqrt PI) 2.0))))
(t_1 (* 0.005555555555555556 (* angle PI))))
(if (<= a_m 3.45e-28)
(*
180.0
(/ (atan (* (/ (cos t_0) (sin t_0)) (/ y-scale (- x-scale)))) PI))
(* 180.0 (/ (atan (* (/ y-scale x-scale) (/ (sin t_1) (cos t_1)))) 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 * pow(sqrt(((double) M_PI)), 2.0));
double t_1 = 0.005555555555555556 * (angle * ((double) M_PI));
double tmp;
if (a_m <= 3.45e-28) {
tmp = 180.0 * (atan(((cos(t_0) / sin(t_0)) * (y_45_scale / -x_45_scale))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (sin(t_1) / cos(t_1)))) / ((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.pow(Math.sqrt(Math.PI), 2.0));
double t_1 = 0.005555555555555556 * (angle * Math.PI);
double tmp;
if (a_m <= 3.45e-28) {
tmp = 180.0 * (Math.atan(((Math.cos(t_0) / Math.sin(t_0)) * (y_45_scale / -x_45_scale))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (Math.sin(t_1) / Math.cos(t_1)))) / 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.pow(math.sqrt(math.pi), 2.0)) t_1 = 0.005555555555555556 * (angle * math.pi) tmp = 0 if a_m <= 3.45e-28: tmp = 180.0 * (math.atan(((math.cos(t_0) / math.sin(t_0)) * (y_45_scale / -x_45_scale))) / math.pi) else: tmp = 180.0 * (math.atan(((y_45_scale / x_45_scale) * (math.sin(t_1) / math.cos(t_1)))) / 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 * (sqrt(pi) ^ 2.0))) t_1 = Float64(0.005555555555555556 * Float64(angle * pi)) tmp = 0.0 if (a_m <= 3.45e-28) tmp = Float64(180.0 * Float64(atan(Float64(Float64(cos(t_0) / sin(t_0)) * Float64(y_45_scale / Float64(-x_45_scale)))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(sin(t_1) / cos(t_1)))) / 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 * (sqrt(pi) ^ 2.0)); t_1 = 0.005555555555555556 * (angle * pi); tmp = 0.0; if (a_m <= 3.45e-28) tmp = 180.0 * (atan(((cos(t_0) / sin(t_0)) * (y_45_scale / -x_45_scale))) / pi); else tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (sin(t_1) / cos(t_1)))) / 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 * N[Power[N[Sqrt[Pi], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a$95$m, 3.45e-28], N[(180.0 * N[(N[ArcTan[N[(N[(N[Cos[t$95$0], $MachinePrecision] / N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision] * N[(y$45$scale / (-x$45$scale)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[(N[Sin[t$95$1], $MachinePrecision] / N[Cos[t$95$1], $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 {\left(\sqrt{\pi}\right)}^{2}\right)\\
t_1 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
\mathbf{if}\;a\_m \leq 3.45 \cdot 10^{-28}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\cos t\_0}{\sin t\_0} \cdot \frac{y-scale}{-x-scale}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{\sin t\_1}{\cos t\_1}\right)}{\pi}\\
\end{array}
\end{array}
if a < 3.45000000000000001e-28Initial program 18.8%
Simplified15.5%
Taylor expanded in x-scale around 0 29.6%
Simplified32.9%
Taylor expanded in a around 0 55.5%
mul-1-neg55.5%
times-frac56.2%
Simplified56.2%
add-sqr-sqrt56.3%
pow256.3%
Applied egg-rr56.3%
add-sqr-sqrt56.3%
pow256.3%
Applied egg-rr58.6%
if 3.45000000000000001e-28 < a Initial program 9.3%
Simplified6.8%
Taylor expanded in x-scale around 0 15.8%
Simplified21.9%
Taylor expanded in a around inf 57.3%
times-frac57.4%
Simplified57.4%
Final simplification58.2%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle PI))) (t_1 (cos t_0)))
(if (<= a_m 1.55e-27)
(*
180.0
(/
(atan
(*
(/ y-scale x-scale)
(/
t_1
(-
(sin
(*
0.005555555555555556
(* angle (* (cbrt PI) (pow (cbrt PI) 2.0)))))))))
PI))
(* 180.0 (/ (atan (* (/ y-scale x-scale) (/ (sin t_0) t_1))) 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 t_1 = cos(t_0);
double tmp;
if (a_m <= 1.55e-27) {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (t_1 / -sin((0.005555555555555556 * (angle * (cbrt(((double) M_PI)) * pow(cbrt(((double) M_PI)), 2.0)))))))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (sin(t_0) / t_1))) / ((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 t_1 = Math.cos(t_0);
double tmp;
if (a_m <= 1.55e-27) {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (t_1 / -Math.sin((0.005555555555555556 * (angle * (Math.cbrt(Math.PI) * Math.pow(Math.cbrt(Math.PI), 2.0)))))))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (Math.sin(t_0) / t_1))) / 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)) t_1 = cos(t_0) tmp = 0.0 if (a_m <= 1.55e-27) tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(t_1 / Float64(-sin(Float64(0.005555555555555556 * Float64(angle * Float64(cbrt(pi) * (cbrt(pi) ^ 2.0))))))))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(sin(t_0) / t_1))) / pi)); end return 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]}, Block[{t$95$1 = N[Cos[t$95$0], $MachinePrecision]}, If[LessEqual[a$95$m, 1.55e-27], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[(t$95$1 / (-N[Sin[N[(0.005555555555555556 * N[(angle * N[(N[Power[Pi, 1/3], $MachinePrecision] * N[Power[N[Power[Pi, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[(N[Sin[t$95$0], $MachinePrecision] / t$95$1), $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)\\
t_1 := \cos t\_0\\
\mathbf{if}\;a\_m \leq 1.55 \cdot 10^{-27}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{t\_1}{-\sin \left(0.005555555555555556 \cdot \left(angle \cdot \left(\sqrt[3]{\pi} \cdot {\left(\sqrt[3]{\pi}\right)}^{2}\right)\right)\right)}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{\sin t\_0}{t\_1}\right)}{\pi}\\
\end{array}
\end{array}
if a < 1.5499999999999999e-27Initial program 18.8%
Simplified15.5%
Taylor expanded in x-scale around 0 29.6%
Simplified32.9%
Taylor expanded in a around 0 55.5%
mul-1-neg55.5%
times-frac56.2%
Simplified56.2%
add-cube-cbrt58.0%
pow258.0%
Applied egg-rr58.0%
if 1.5499999999999999e-27 < a Initial program 9.3%
Simplified6.8%
Taylor expanded in x-scale around 0 15.8%
Simplified21.9%
Taylor expanded in a around inf 57.3%
times-frac57.4%
Simplified57.4%
Final simplification57.8%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle PI))) (t_1 (cos t_0)))
(if (<= b 5.3e-21)
(* 180.0 (/ (atan (* (/ y-scale x-scale) (/ (sin t_0) t_1))) PI))
(*
180.0
(/
(atan
(*
(/ y-scale x-scale)
(/
(- t_1)
(sin (* 0.005555555555555556 (* angle (cbrt (pow PI 3.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 t_1 = cos(t_0);
double tmp;
if (b <= 5.3e-21) {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (sin(t_0) / t_1))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (-t_1 / sin((0.005555555555555556 * (angle * cbrt(pow(((double) M_PI), 3.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 t_1 = Math.cos(t_0);
double tmp;
if (b <= 5.3e-21) {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (Math.sin(t_0) / t_1))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (-t_1 / Math.sin((0.005555555555555556 * (angle * Math.cbrt(Math.pow(Math.PI, 3.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)) t_1 = cos(t_0) tmp = 0.0 if (b <= 5.3e-21) tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(sin(t_0) / t_1))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(Float64(-t_1) / sin(Float64(0.005555555555555556 * Float64(angle * cbrt((pi ^ 3.0)))))))) / pi)); end return 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]}, Block[{t$95$1 = N[Cos[t$95$0], $MachinePrecision]}, If[LessEqual[b, 5.3e-21], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[(N[Sin[t$95$0], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[((-t$95$1) / N[Sin[N[(0.005555555555555556 * N[(angle * N[Power[N[Power[Pi, 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $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)\\
t_1 := \cos t\_0\\
\mathbf{if}\;b \leq 5.3 \cdot 10^{-21}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{\sin t\_0}{t\_1}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{-t\_1}{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \sqrt[3]{{\pi}^{3}}\right)\right)}\right)}{\pi}\\
\end{array}
\end{array}
if b < 5.2999999999999999e-21Initial program 14.5%
Simplified11.9%
Taylor expanded in x-scale around 0 26.5%
Simplified31.7%
Taylor expanded in a around inf 48.9%
times-frac50.4%
Simplified50.4%
if 5.2999999999999999e-21 < b Initial program 19.1%
Simplified14.8%
Taylor expanded in x-scale around 0 21.5%
Simplified23.2%
Taylor expanded in a around 0 55.9%
mul-1-neg55.9%
times-frac59.6%
Simplified59.6%
add-cbrt-cube61.2%
pow361.2%
Applied egg-rr61.2%
Final simplification53.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 (<= b 7e-17)
(* 180.0 (/ (atan (* (/ y-scale x-scale) (/ (sin t_0) (cos t_0)))) PI))
(* 180.0 (/ (atan (* y-scale (/ (/ 1.0 (tan t_0)) x-scale))) (- 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 (b <= 7e-17) {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (sin(t_0) / cos(t_0)))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((y_45_scale * ((1.0 / tan(t_0)) / x_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 t_0 = 0.005555555555555556 * (angle * Math.PI);
double tmp;
if (b <= 7e-17) {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (Math.sin(t_0) / Math.cos(t_0)))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan((y_45_scale * ((1.0 / Math.tan(t_0)) / x_45_scale))) / -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 b <= 7e-17: tmp = 180.0 * (math.atan(((y_45_scale / x_45_scale) * (math.sin(t_0) / math.cos(t_0)))) / math.pi) else: tmp = 180.0 * (math.atan((y_45_scale * ((1.0 / math.tan(t_0)) / x_45_scale))) / -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 (b <= 7e-17) tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(sin(t_0) / cos(t_0)))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(y_45_scale * Float64(Float64(1.0 / tan(t_0)) / x_45_scale))) / 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 (b <= 7e-17) tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (sin(t_0) / cos(t_0)))) / pi); else tmp = 180.0 * (atan((y_45_scale * ((1.0 / tan(t_0)) / x_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_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 7e-17], 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], N[(180.0 * N[(N[ArcTan[N[(y$45$scale * N[(N[(1.0 / N[Tan[t$95$0], $MachinePrecision]), $MachinePrecision] / x$45$scale), $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}\;b \leq 7 \cdot 10^{-17}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{\sin t\_0}{\cos t\_0}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(y-scale \cdot \frac{\frac{1}{\tan t\_0}}{x-scale}\right)}{-\pi}\\
\end{array}
\end{array}
if b < 7.0000000000000003e-17Initial program 14.5%
Simplified11.9%
Taylor expanded in x-scale around 0 26.5%
Simplified31.7%
Taylor expanded in a around inf 48.9%
times-frac50.4%
Simplified50.4%
if 7.0000000000000003e-17 < b Initial program 19.1%
Simplified14.8%
Taylor expanded in x-scale around 0 21.5%
Simplified23.2%
Taylor expanded in a around 0 55.9%
mul-1-neg55.9%
times-frac59.6%
Simplified59.6%
atan-neg59.6%
clear-num59.6%
quot-tan59.6%
associate-*r*56.9%
Applied egg-rr56.9%
associate-*l/53.2%
associate-/l*53.2%
associate-*r*55.9%
Simplified55.9%
Final simplification51.9%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= b 5.5e-280)
(*
180.0
(/
(atan
(* -180.0 (/ y-scale (* angle (+ (exp (log1p (* x-scale PI))) -1.0)))))
PI))
(*
180.0
(/
1.0
(/
PI
(atan
(/
(/ y-scale x-scale)
(- (tan (* 0.005555555555555556 (* angle 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 (b <= 5.5e-280) {
tmp = 180.0 * (atan((-180.0 * (y_45_scale / (angle * (exp(log1p((x_45_scale * ((double) M_PI)))) + -1.0))))) / ((double) M_PI));
} else {
tmp = 180.0 * (1.0 / (((double) M_PI) / atan(((y_45_scale / x_45_scale) / -tan((0.005555555555555556 * (angle * ((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 (b <= 5.5e-280) {
tmp = 180.0 * (Math.atan((-180.0 * (y_45_scale / (angle * (Math.exp(Math.log1p((x_45_scale * Math.PI))) + -1.0))))) / Math.PI);
} else {
tmp = 180.0 * (1.0 / (Math.PI / Math.atan(((y_45_scale / x_45_scale) / -Math.tan((0.005555555555555556 * (angle * Math.PI)))))));
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): tmp = 0 if b <= 5.5e-280: tmp = 180.0 * (math.atan((-180.0 * (y_45_scale / (angle * (math.exp(math.log1p((x_45_scale * math.pi))) + -1.0))))) / math.pi) else: tmp = 180.0 * (1.0 / (math.pi / math.atan(((y_45_scale / x_45_scale) / -math.tan((0.005555555555555556 * (angle * math.pi))))))) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 0.0 if (b <= 5.5e-280) tmp = Float64(180.0 * Float64(atan(Float64(-180.0 * Float64(y_45_scale / Float64(angle * Float64(exp(log1p(Float64(x_45_scale * pi))) + -1.0))))) / pi)); else tmp = Float64(180.0 * Float64(1.0 / Float64(pi / atan(Float64(Float64(y_45_scale / x_45_scale) / Float64(-tan(Float64(0.005555555555555556 * Float64(angle * pi))))))))); end return tmp end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[b, 5.5e-280], N[(180.0 * N[(N[ArcTan[N[(-180.0 * N[(y$45$scale / N[(angle * N[(N[Exp[N[Log[1 + N[(x$45$scale * Pi), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(1.0 / N[(Pi / N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] / (-N[Tan[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5.5 \cdot 10^{-280}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(e^{\mathsf{log1p}\left(x-scale \cdot \pi\right)} + -1\right)}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{1}{\frac{\pi}{\tan^{-1} \left(\frac{\frac{y-scale}{x-scale}}{-\tan \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}}\\
\end{array}
\end{array}
if b < 5.50000000000000001e-280Initial program 12.7%
Simplified10.6%
Taylor expanded in x-scale around 0 26.0%
Simplified31.7%
Taylor expanded in a around 0 49.6%
mul-1-neg49.6%
times-frac48.9%
Simplified48.9%
Taylor expanded in angle around 0 40.1%
*-commutative40.1%
Simplified40.1%
expm1-log1p-u27.9%
expm1-undefine34.3%
*-commutative34.3%
Applied egg-rr34.3%
if 5.50000000000000001e-280 < b Initial program 19.4%
Simplified15.2%
Taylor expanded in x-scale around 0 24.2%
Simplified26.6%
Taylor expanded in a around 0 47.4%
mul-1-neg47.4%
times-frac50.1%
Simplified50.1%
clear-num50.1%
inv-pow50.1%
distribute-lft-neg-in50.1%
clear-num50.1%
quot-tan50.1%
associate-*r*50.2%
Applied egg-rr50.2%
unpow-150.2%
associate-*r/50.2%
*-rgt-identity50.2%
distribute-frac-neg50.2%
associate-*r*50.1%
Simplified50.1%
Final simplification41.5%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(*
180.0
(/
1.0
(/
PI
(atan
(/
(/ y-scale x-scale)
(- (tan (* 0.005555555555555556 (* angle 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 * (1.0 / (((double) M_PI) / atan(((y_45_scale / x_45_scale) / -tan((0.005555555555555556 * (angle * ((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 * (1.0 / (Math.PI / Math.atan(((y_45_scale / x_45_scale) / -Math.tan((0.005555555555555556 * (angle * Math.PI)))))));
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return 180.0 * (1.0 / (math.pi / math.atan(((y_45_scale / x_45_scale) / -math.tan((0.005555555555555556 * (angle * math.pi)))))))
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64(180.0 * Float64(1.0 / Float64(pi / atan(Float64(Float64(y_45_scale / x_45_scale) / Float64(-tan(Float64(0.005555555555555556 * Float64(angle * pi))))))))) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 180.0 * (1.0 / (pi / atan(((y_45_scale / x_45_scale) / -tan((0.005555555555555556 * (angle * pi))))))); end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := N[(180.0 * N[(1.0 / N[(Pi / N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] / (-N[Tan[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
180 \cdot \frac{1}{\frac{\pi}{\tan^{-1} \left(\frac{\frac{y-scale}{x-scale}}{-\tan \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}}
\end{array}
Initial program 15.7%
Simplified12.7%
Taylor expanded in x-scale around 0 25.2%
Simplified29.4%
Taylor expanded in a around 0 48.6%
mul-1-neg48.6%
times-frac49.4%
Simplified49.4%
clear-num49.4%
inv-pow49.4%
distribute-lft-neg-in49.4%
clear-num49.4%
quot-tan49.4%
associate-*r*48.9%
Applied egg-rr48.9%
unpow-148.9%
associate-*r/48.9%
*-rgt-identity48.9%
distribute-frac-neg48.9%
associate-*r*49.4%
Simplified49.4%
Final simplification49.4%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (/ (/ y-scale x-scale) (tan (* 0.005555555555555556 (* angle 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(((y_45_scale / x_45_scale) / tan((0.005555555555555556 * (angle * ((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(((y_45_scale / x_45_scale) / Math.tan((0.005555555555555556 * (angle * 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(((y_45_scale / x_45_scale) / math.tan((0.005555555555555556 * (angle * 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(Float64(y_45_scale / x_45_scale) / tan(Float64(0.005555555555555556 * Float64(angle * pi))))) / Float64(-pi))) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 180.0 * (atan(((y_45_scale / x_45_scale) / tan((0.005555555555555556 * (angle * 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[(N[(y$45$scale / x$45$scale), $MachinePrecision] / N[Tan[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-Pi)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
180 \cdot \frac{\tan^{-1} \left(\frac{\frac{y-scale}{x-scale}}{\tan \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}{-\pi}
\end{array}
Initial program 15.7%
Simplified12.7%
Taylor expanded in x-scale around 0 25.2%
Simplified29.4%
Taylor expanded in a around 0 48.6%
mul-1-neg48.6%
times-frac49.4%
Simplified49.4%
atan-neg49.4%
clear-num49.4%
quot-tan49.4%
associate-*r*48.9%
Applied egg-rr48.9%
associate-*r/48.9%
*-rgt-identity48.9%
associate-*r*49.4%
Simplified49.4%
Final simplification49.4%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (/ (* -180.0 (atan (/ y-scale (* x-scale (tan (* PI (* 0.005555555555555556 angle))))))) 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((y_45_scale / (x_45_scale * tan((((double) M_PI) * (0.005555555555555556 * angle))))))) / ((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((y_45_scale / (x_45_scale * Math.tan((Math.PI * (0.005555555555555556 * angle))))))) / Math.PI;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return (-180.0 * math.atan((y_45_scale / (x_45_scale * math.tan((math.pi * (0.005555555555555556 * angle))))))) / math.pi
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64(Float64(-180.0 * atan(Float64(y_45_scale / Float64(x_45_scale * tan(Float64(pi * Float64(0.005555555555555556 * angle))))))) / pi) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = (-180.0 * atan((y_45_scale / (x_45_scale * tan((pi * (0.005555555555555556 * angle))))))) / pi; end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(-180.0 * N[ArcTan[N[(y$45$scale / N[(x$45$scale * N[Tan[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
\frac{-180 \cdot \tan^{-1} \left(\frac{y-scale}{x-scale \cdot \tan \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)}\right)}{\pi}
\end{array}
Initial program 15.7%
Simplified12.7%
Taylor expanded in x-scale around 0 25.2%
Simplified29.4%
Taylor expanded in a around 0 48.6%
mul-1-neg48.6%
times-frac49.4%
Simplified49.4%
add-sqr-sqrt50.6%
pow250.6%
Applied egg-rr50.6%
associate-*r/50.6%
Applied egg-rr48.9%
distribute-rgt-neg-out48.9%
distribute-lft-neg-in48.9%
metadata-eval48.9%
associate-/r*48.1%
Simplified48.1%
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 15.7%
Simplified12.7%
Taylor expanded in x-scale around 0 25.2%
Simplified29.4%
Taylor expanded in a around 0 48.6%
mul-1-neg48.6%
times-frac49.4%
Simplified49.4%
Taylor expanded in angle around 0 40.4%
*-commutative40.4%
Simplified40.4%
clear-num40.3%
inv-pow40.3%
*-commutative40.3%
Applied egg-rr40.3%
unpow-140.3%
associate-/l*42.5%
*-commutative42.5%
Simplified42.5%
Final simplification42.5%
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 15.7%
Simplified12.7%
Taylor expanded in x-scale around 0 25.2%
Simplified29.4%
Taylor expanded in a around 0 48.6%
mul-1-neg48.6%
times-frac49.4%
Simplified49.4%
Taylor expanded in angle around 0 40.4%
associate-/r*40.5%
*-commutative40.5%
Simplified40.5%
Final simplification40.5%
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 15.7%
Simplified12.7%
Taylor expanded in angle around 0 12.8%
associate-*r/12.8%
associate-*r*12.3%
distribute-lft-out--12.3%
associate-*r*12.3%
Simplified12.3%
Taylor expanded in a around 0 40.4%
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 15.7%
Simplified12.7%
Taylor expanded in angle around 0 12.8%
associate-*r/12.8%
associate-*r*12.3%
distribute-lft-out--12.3%
associate-*r*12.3%
Simplified12.3%
Taylor expanded in a around inf 11.8%
herbie shell --seed 2024130
(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)))