
(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 11 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))) (t_1 (sin t_0)))
(if (<= a_m 2.1e-17)
(* 180.0 (/ (atan (* (/ (cos t_0) t_1) (/ y-scale (- x-scale)))) PI))
(*
180.0
(/
(atan
(*
(/ y-scale x-scale)
(/
t_1
(cos (* 0.005555555555555556 (* angle (cbrt (* PI (* PI PI)))))))))
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 = sin(t_0);
double tmp;
if (a_m <= 2.1e-17) {
tmp = 180.0 * (atan(((cos(t_0) / t_1) * (y_45_scale / -x_45_scale))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (t_1 / cos((0.005555555555555556 * (angle * cbrt((((double) M_PI) * (((double) M_PI) * ((double) M_PI)))))))))) / ((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.sin(t_0);
double tmp;
if (a_m <= 2.1e-17) {
tmp = 180.0 * (Math.atan(((Math.cos(t_0) / t_1) * (y_45_scale / -x_45_scale))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (t_1 / Math.cos((0.005555555555555556 * (angle * Math.cbrt((Math.PI * (Math.PI * Math.PI))))))))) / 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 = sin(t_0) tmp = 0.0 if (a_m <= 2.1e-17) tmp = Float64(180.0 * Float64(atan(Float64(Float64(cos(t_0) / t_1) * 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(t_1 / cos(Float64(0.005555555555555556 * Float64(angle * cbrt(Float64(pi * Float64(pi * pi))))))))) / 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[Sin[t$95$0], $MachinePrecision]}, If[LessEqual[a$95$m, 2.1e-17], N[(180.0 * N[(N[ArcTan[N[(N[(N[Cos[t$95$0], $MachinePrecision] / t$95$1), $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[(t$95$1 / N[Cos[N[(0.005555555555555556 * N[(angle * N[Power[N[(Pi * N[(Pi * Pi), $MachinePrecision]), $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 := \sin t\_0\\
\mathbf{if}\;a\_m \leq 2.1 \cdot 10^{-17}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{\cos t\_0}{t\_1} \cdot \frac{y-scale}{-x-scale}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{t\_1}{\cos \left(0.005555555555555556 \cdot \left(angle \cdot \sqrt[3]{\pi \cdot \left(\pi \cdot \pi\right)}\right)\right)}\right)}{\pi}\\
\end{array}
\end{array}
if a < 2.09999999999999992e-17Initial program 13.7%
Simplified11.8%
Taylor expanded in x-scale around 0 31.8%
Simplified34.7%
Taylor expanded in a around 0 48.8%
mul-1-neg48.8%
times-frac50.0%
Simplified50.0%
if 2.09999999999999992e-17 < a Initial program 5.1%
Simplified4.8%
Taylor expanded in x-scale around 0 19.1%
Simplified20.7%
Taylor expanded in a around inf 57.4%
times-frac57.4%
Simplified57.4%
add-cbrt-cube67.5%
Applied egg-rr67.5%
Final simplification54.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 1.85e-17)
(*
180.0
(/ (atan (* (/ (cos t_0) (sin t_0)) (/ y-scale (- x-scale)))) PI))
(*
180.0
(/
(atan
(* (/ y-scale x-scale) (sin (* 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) {
double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
double tmp;
if (a_m <= 1.85e-17) {
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((((double) M_PI) * (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 t_0 = 0.005555555555555556 * (angle * Math.PI);
double tmp;
if (a_m <= 1.85e-17) {
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((Math.PI * (0.005555555555555556 * angle))))) / 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.85e-17: 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((math.pi * (0.005555555555555556 * angle))))) / 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.85e-17) 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) * sin(Float64(pi * Float64(0.005555555555555556 * angle))))) / 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.85e-17) 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((pi * (0.005555555555555556 * angle))))) / 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.85e-17], 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[Sin[N[(Pi * N[(0.005555555555555556 * angle), $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 1.85 \cdot 10^{-17}:\\
\;\;\;\;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 \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}{\pi}\\
\end{array}
\end{array}
if a < 1.8499999999999999e-17Initial program 13.7%
Simplified11.8%
Taylor expanded in x-scale around 0 31.8%
Simplified34.7%
Taylor expanded in a around 0 48.8%
mul-1-neg48.8%
times-frac50.0%
Simplified50.0%
if 1.8499999999999999e-17 < a Initial program 5.1%
Simplified4.8%
Taylor expanded in x-scale around 0 19.1%
Simplified20.7%
Taylor expanded in angle around 0 20.9%
add-cube-cbrt17.5%
Applied egg-rr17.5%
Taylor expanded in a around inf 61.0%
*-commutative61.0%
associate-*r/61.0%
associate-*r*64.9%
*-commutative64.9%
Simplified64.9%
Final simplification53.9%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= a_m 4.8e-128)
(*
180.0
(log (exp (/ (atan (* -180.0 (/ (/ y-scale angle) (* x-scale PI)))) PI))))
(*
180.0
(/
(atan (* (/ y-scale x-scale) (sin (* 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) {
double tmp;
if (a_m <= 4.8e-128) {
tmp = 180.0 * log(exp((atan((-180.0 * ((y_45_scale / angle) / (x_45_scale * ((double) M_PI))))) / ((double) M_PI))));
} else {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * sin((((double) M_PI) * (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 (a_m <= 4.8e-128) {
tmp = 180.0 * Math.log(Math.exp((Math.atan((-180.0 * ((y_45_scale / angle) / (x_45_scale * Math.PI)))) / Math.PI)));
} else {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * Math.sin((Math.PI * (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 a_m <= 4.8e-128: tmp = 180.0 * math.log(math.exp((math.atan((-180.0 * ((y_45_scale / angle) / (x_45_scale * math.pi)))) / math.pi))) else: tmp = 180.0 * (math.atan(((y_45_scale / x_45_scale) * math.sin((math.pi * (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 (a_m <= 4.8e-128) tmp = Float64(180.0 * log(exp(Float64(atan(Float64(-180.0 * Float64(Float64(y_45_scale / angle) / Float64(x_45_scale * pi)))) / pi)))); else tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * sin(Float64(pi * Float64(0.005555555555555556 * angle))))) / 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 (a_m <= 4.8e-128) tmp = 180.0 * log(exp((atan((-180.0 * ((y_45_scale / angle) / (x_45_scale * pi)))) / pi))); else tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * sin((pi * (0.005555555555555556 * angle))))) / 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[LessEqual[a$95$m, 4.8e-128], N[(180.0 * N[Log[N[Exp[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]], $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[Sin[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 4.8 \cdot 10^{-128}:\\
\;\;\;\;180 \cdot \log \left(e^{\frac{\tan^{-1} \left(-180 \cdot \frac{\frac{y-scale}{angle}}{x-scale \cdot \pi}\right)}{\pi}}\right)\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}{\pi}\\
\end{array}
\end{array}
if a < 4.7999999999999996e-128Initial program 14.1%
Simplified12.0%
Taylor expanded in angle around 0 11.4%
associate-*r/11.4%
associate-*r*10.6%
distribute-lft-out--10.6%
associate-*r*10.6%
Simplified10.6%
Taylor expanded in a around 0 44.4%
add-log-exp46.4%
associate-/r*46.4%
Applied egg-rr46.4%
if 4.7999999999999996e-128 < a Initial program 6.4%
Simplified6.1%
Taylor expanded in x-scale around 0 22.8%
Simplified24.2%
Taylor expanded in angle around 0 27.6%
add-cube-cbrt23.9%
Applied egg-rr23.9%
Taylor expanded in a around inf 58.5%
*-commutative58.5%
associate-*r/59.5%
associate-*r*63.7%
*-commutative63.7%
Simplified63.7%
Final simplification52.4%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= a_m 2.8e-127)
(*
180.0
(/ (atan (* -180.0 (/ 1.0 (/ (* angle (* x-scale PI)) y-scale)))) PI))
(if (<= a_m 2.5e+158)
(*
180.0
(/
(atan
(* y-scale (/ (sin (* 0.005555555555555556 (* angle PI))) x-scale)))
PI))
(*
180.0
(/
(atan (* 0.005555555555555556 (* angle (/ (* y-scale PI) 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 tmp;
if (a_m <= 2.8e-127) {
tmp = 180.0 * (atan((-180.0 * (1.0 / ((angle * (x_45_scale * ((double) M_PI))) / y_45_scale)))) / ((double) M_PI));
} else if (a_m <= 2.5e+158) {
tmp = 180.0 * (atan((y_45_scale * (sin((0.005555555555555556 * (angle * ((double) M_PI)))) / x_45_scale))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((0.005555555555555556 * (angle * ((y_45_scale * ((double) M_PI)) / 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 tmp;
if (a_m <= 2.8e-127) {
tmp = 180.0 * (Math.atan((-180.0 * (1.0 / ((angle * (x_45_scale * Math.PI)) / y_45_scale)))) / Math.PI);
} else if (a_m <= 2.5e+158) {
tmp = 180.0 * (Math.atan((y_45_scale * (Math.sin((0.005555555555555556 * (angle * Math.PI))) / x_45_scale))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan((0.005555555555555556 * (angle * ((y_45_scale * Math.PI) / x_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 a_m <= 2.8e-127: tmp = 180.0 * (math.atan((-180.0 * (1.0 / ((angle * (x_45_scale * math.pi)) / y_45_scale)))) / math.pi) elif a_m <= 2.5e+158: tmp = 180.0 * (math.atan((y_45_scale * (math.sin((0.005555555555555556 * (angle * math.pi))) / x_45_scale))) / math.pi) else: tmp = 180.0 * (math.atan((0.005555555555555556 * (angle * ((y_45_scale * math.pi) / x_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 (a_m <= 2.8e-127) tmp = Float64(180.0 * Float64(atan(Float64(-180.0 * Float64(1.0 / Float64(Float64(angle * Float64(x_45_scale * pi)) / y_45_scale)))) / pi)); elseif (a_m <= 2.5e+158) tmp = Float64(180.0 * Float64(atan(Float64(y_45_scale * Float64(sin(Float64(0.005555555555555556 * Float64(angle * pi))) / x_45_scale))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(0.005555555555555556 * Float64(angle * Float64(Float64(y_45_scale * pi) / x_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 (a_m <= 2.8e-127) tmp = 180.0 * (atan((-180.0 * (1.0 / ((angle * (x_45_scale * pi)) / y_45_scale)))) / pi); elseif (a_m <= 2.5e+158) tmp = 180.0 * (atan((y_45_scale * (sin((0.005555555555555556 * (angle * pi))) / x_45_scale))) / pi); else tmp = 180.0 * (atan((0.005555555555555556 * (angle * ((y_45_scale * pi) / 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_] := If[LessEqual[a$95$m, 2.8e-127], N[(180.0 * N[(N[ArcTan[N[(-180.0 * N[(1.0 / N[(N[(angle * N[(x$45$scale * Pi), $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[a$95$m, 2.5e+158], N[(180.0 * N[(N[ArcTan[N[(y$45$scale * N[(N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(0.005555555555555556 * N[(angle * N[(N[(y$45$scale * Pi), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 2.8 \cdot 10^{-127}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{1}{\frac{angle \cdot \left(x-scale \cdot \pi\right)}{y-scale}}\right)}{\pi}\\
\mathbf{elif}\;a\_m \leq 2.5 \cdot 10^{+158}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(y-scale \cdot \frac{\sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}{x-scale}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.005555555555555556 \cdot \left(angle \cdot \frac{y-scale \cdot \pi}{x-scale}\right)\right)}{\pi}\\
\end{array}
\end{array}
if a < 2.8e-127Initial program 14.1%
Simplified12.0%
Taylor expanded in angle around 0 11.4%
associate-*r/11.4%
associate-*r*10.6%
distribute-lft-out--10.6%
associate-*r*10.6%
Simplified10.6%
Taylor expanded in a around 0 44.4%
clear-num44.8%
inv-pow44.8%
Applied egg-rr44.8%
unpow-144.8%
*-commutative44.8%
Simplified44.8%
if 2.8e-127 < a < 2.4999999999999998e158Initial program 10.4%
Simplified10.0%
Taylor expanded in x-scale around 0 37.2%
Simplified35.7%
Taylor expanded in angle around 0 41.2%
Taylor expanded in a around inf 49.7%
associate-/l*50.1%
Simplified50.1%
if 2.4999999999999998e158 < a Initial program 0.0%
Simplified0.0%
Taylor expanded in x-scale around 0 0.0%
Simplified6.0%
Taylor expanded in a around inf 68.9%
times-frac68.9%
Simplified68.9%
add-cube-cbrt6.0%
Applied egg-rr71.8%
Taylor expanded in angle around 0 68.4%
associate-/l*73.8%
Simplified73.8%
Final simplification49.8%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= a_m 7.8e-128)
(*
180.0
(/ (atan (* -180.0 (/ 1.0 (/ (* angle (* x-scale PI)) y-scale)))) PI))
(*
180.0
(/
(atan (* (/ y-scale x-scale) (sin (* 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) {
double tmp;
if (a_m <= 7.8e-128) {
tmp = 180.0 * (atan((-180.0 * (1.0 / ((angle * (x_45_scale * ((double) M_PI))) / y_45_scale)))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * sin((((double) M_PI) * (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 (a_m <= 7.8e-128) {
tmp = 180.0 * (Math.atan((-180.0 * (1.0 / ((angle * (x_45_scale * Math.PI)) / y_45_scale)))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * Math.sin((Math.PI * (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 a_m <= 7.8e-128: tmp = 180.0 * (math.atan((-180.0 * (1.0 / ((angle * (x_45_scale * math.pi)) / y_45_scale)))) / math.pi) else: tmp = 180.0 * (math.atan(((y_45_scale / x_45_scale) * math.sin((math.pi * (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 (a_m <= 7.8e-128) tmp = Float64(180.0 * Float64(atan(Float64(-180.0 * Float64(1.0 / Float64(Float64(angle * Float64(x_45_scale * pi)) / y_45_scale)))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * sin(Float64(pi * Float64(0.005555555555555556 * angle))))) / 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 (a_m <= 7.8e-128) tmp = 180.0 * (atan((-180.0 * (1.0 / ((angle * (x_45_scale * pi)) / y_45_scale)))) / pi); else tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * sin((pi * (0.005555555555555556 * angle))))) / 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[LessEqual[a$95$m, 7.8e-128], N[(180.0 * N[(N[ArcTan[N[(-180.0 * N[(1.0 / N[(N[(angle * N[(x$45$scale * Pi), $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[Sin[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 7.8 \cdot 10^{-128}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{1}{\frac{angle \cdot \left(x-scale \cdot \pi\right)}{y-scale}}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)}{\pi}\\
\end{array}
\end{array}
if a < 7.79999999999999993e-128Initial program 14.1%
Simplified12.0%
Taylor expanded in angle around 0 11.4%
associate-*r/11.4%
associate-*r*10.6%
distribute-lft-out--10.6%
associate-*r*10.6%
Simplified10.6%
Taylor expanded in a around 0 44.4%
clear-num44.8%
inv-pow44.8%
Applied egg-rr44.8%
unpow-144.8%
*-commutative44.8%
Simplified44.8%
if 7.79999999999999993e-128 < a Initial program 6.4%
Simplified6.1%
Taylor expanded in x-scale around 0 22.8%
Simplified24.2%
Taylor expanded in angle around 0 27.6%
add-cube-cbrt23.9%
Applied egg-rr23.9%
Taylor expanded in a around inf 58.5%
*-commutative58.5%
associate-*r/59.5%
associate-*r*63.7%
*-commutative63.7%
Simplified63.7%
Final simplification51.3%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= a_m 1.55e-37)
(*
180.0
(/ (atan (* -180.0 (/ 1.0 (/ (* angle (* x-scale PI)) y-scale)))) PI))
(*
180.0
(/
(atan (* 0.005555555555555556 (* angle (/ (* y-scale PI) 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 tmp;
if (a_m <= 1.55e-37) {
tmp = 180.0 * (atan((-180.0 * (1.0 / ((angle * (x_45_scale * ((double) M_PI))) / y_45_scale)))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((0.005555555555555556 * (angle * ((y_45_scale * ((double) M_PI)) / 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 tmp;
if (a_m <= 1.55e-37) {
tmp = 180.0 * (Math.atan((-180.0 * (1.0 / ((angle * (x_45_scale * Math.PI)) / y_45_scale)))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan((0.005555555555555556 * (angle * ((y_45_scale * Math.PI) / x_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 a_m <= 1.55e-37: tmp = 180.0 * (math.atan((-180.0 * (1.0 / ((angle * (x_45_scale * math.pi)) / y_45_scale)))) / math.pi) else: tmp = 180.0 * (math.atan((0.005555555555555556 * (angle * ((y_45_scale * math.pi) / x_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 (a_m <= 1.55e-37) tmp = Float64(180.0 * Float64(atan(Float64(-180.0 * Float64(1.0 / Float64(Float64(angle * Float64(x_45_scale * pi)) / y_45_scale)))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(0.005555555555555556 * Float64(angle * Float64(Float64(y_45_scale * pi) / x_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 (a_m <= 1.55e-37) tmp = 180.0 * (atan((-180.0 * (1.0 / ((angle * (x_45_scale * pi)) / y_45_scale)))) / pi); else tmp = 180.0 * (atan((0.005555555555555556 * (angle * ((y_45_scale * pi) / 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_] := If[LessEqual[a$95$m, 1.55e-37], N[(180.0 * N[(N[ArcTan[N[(-180.0 * N[(1.0 / N[(N[(angle * N[(x$45$scale * Pi), $MachinePrecision]), $MachinePrecision] / y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(0.005555555555555556 * N[(angle * N[(N[(y$45$scale * Pi), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 1.55 \cdot 10^{-37}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{1}{\frac{angle \cdot \left(x-scale \cdot \pi\right)}{y-scale}}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.005555555555555556 \cdot \left(angle \cdot \frac{y-scale \cdot \pi}{x-scale}\right)\right)}{\pi}\\
\end{array}
\end{array}
if a < 1.54999999999999997e-37Initial program 14.0%
Simplified12.0%
Taylor expanded in angle around 0 11.0%
associate-*r/11.0%
associate-*r*10.4%
distribute-lft-out--10.4%
associate-*r*10.4%
Simplified10.4%
Taylor expanded in a around 0 43.3%
clear-num43.6%
inv-pow43.6%
Applied egg-rr43.6%
unpow-143.6%
*-commutative43.6%
Simplified43.6%
if 1.54999999999999997e-37 < a Initial program 4.9%
Simplified4.6%
Taylor expanded in x-scale around 0 19.5%
Simplified21.1%
Taylor expanded in a around inf 57.1%
times-frac57.1%
Simplified57.1%
add-cube-cbrt19.4%
Applied egg-rr60.8%
Taylor expanded in angle around 0 56.2%
associate-/l*60.2%
Simplified60.2%
Final simplification48.2%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= a_m 1e-36)
(/ (* 180.0 (atan (* -180.0 (/ (/ y-scale angle) (* x-scale PI))))) PI)
(*
180.0
(/
(atan (* 0.005555555555555556 (* angle (/ (* y-scale PI) 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 tmp;
if (a_m <= 1e-36) {
tmp = (180.0 * atan((-180.0 * ((y_45_scale / angle) / (x_45_scale * ((double) M_PI)))))) / ((double) M_PI);
} else {
tmp = 180.0 * (atan((0.005555555555555556 * (angle * ((y_45_scale * ((double) M_PI)) / 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 tmp;
if (a_m <= 1e-36) {
tmp = (180.0 * Math.atan((-180.0 * ((y_45_scale / angle) / (x_45_scale * Math.PI))))) / Math.PI;
} else {
tmp = 180.0 * (Math.atan((0.005555555555555556 * (angle * ((y_45_scale * Math.PI) / x_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 a_m <= 1e-36: tmp = (180.0 * math.atan((-180.0 * ((y_45_scale / angle) / (x_45_scale * math.pi))))) / math.pi else: tmp = 180.0 * (math.atan((0.005555555555555556 * (angle * ((y_45_scale * math.pi) / x_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 (a_m <= 1e-36) tmp = Float64(Float64(180.0 * atan(Float64(-180.0 * Float64(Float64(y_45_scale / angle) / Float64(x_45_scale * pi))))) / pi); else tmp = Float64(180.0 * Float64(atan(Float64(0.005555555555555556 * Float64(angle * Float64(Float64(y_45_scale * pi) / x_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 (a_m <= 1e-36) tmp = (180.0 * atan((-180.0 * ((y_45_scale / angle) / (x_45_scale * pi))))) / pi; else tmp = 180.0 * (atan((0.005555555555555556 * (angle * ((y_45_scale * pi) / 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_] := If[LessEqual[a$95$m, 1e-36], N[(N[(180.0 * N[ArcTan[N[(-180.0 * N[(N[(y$45$scale / angle), $MachinePrecision] / N[(x$45$scale * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(0.005555555555555556 * N[(angle * N[(N[(y$45$scale * Pi), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 10^{-36}:\\
\;\;\;\;\frac{180 \cdot \tan^{-1} \left(-180 \cdot \frac{\frac{y-scale}{angle}}{x-scale \cdot \pi}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.005555555555555556 \cdot \left(angle \cdot \frac{y-scale \cdot \pi}{x-scale}\right)\right)}{\pi}\\
\end{array}
\end{array}
if a < 9.9999999999999994e-37Initial program 14.0%
Simplified12.0%
Taylor expanded in angle around 0 11.0%
associate-*r/11.0%
associate-*r*10.4%
distribute-lft-out--10.4%
associate-*r*10.4%
Simplified10.4%
Taylor expanded in a around 0 43.3%
associate-*r/43.3%
associate-/r*43.3%
Applied egg-rr43.3%
if 9.9999999999999994e-37 < a Initial program 4.9%
Simplified4.6%
Taylor expanded in x-scale around 0 19.5%
Simplified21.1%
Taylor expanded in a around inf 57.1%
times-frac57.1%
Simplified57.1%
add-cube-cbrt19.4%
Applied egg-rr60.8%
Taylor expanded in angle around 0 56.2%
associate-/l*60.2%
Simplified60.2%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= a_m 2.2e-37)
(* 180.0 (/ (atan (* -180.0 (/ y-scale (* angle (* x-scale PI))))) PI))
(*
180.0
(/
(atan (* 0.005555555555555556 (* angle (/ (* y-scale PI) 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 tmp;
if (a_m <= 2.2e-37) {
tmp = 180.0 * (atan((-180.0 * (y_45_scale / (angle * (x_45_scale * ((double) M_PI)))))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((0.005555555555555556 * (angle * ((y_45_scale * ((double) M_PI)) / 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 tmp;
if (a_m <= 2.2e-37) {
tmp = 180.0 * (Math.atan((-180.0 * (y_45_scale / (angle * (x_45_scale * Math.PI))))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan((0.005555555555555556 * (angle * ((y_45_scale * Math.PI) / x_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 a_m <= 2.2e-37: tmp = 180.0 * (math.atan((-180.0 * (y_45_scale / (angle * (x_45_scale * math.pi))))) / math.pi) else: tmp = 180.0 * (math.atan((0.005555555555555556 * (angle * ((y_45_scale * math.pi) / x_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 (a_m <= 2.2e-37) tmp = Float64(180.0 * Float64(atan(Float64(-180.0 * Float64(y_45_scale / Float64(angle * Float64(x_45_scale * pi))))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(0.005555555555555556 * Float64(angle * Float64(Float64(y_45_scale * pi) / x_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 (a_m <= 2.2e-37) tmp = 180.0 * (atan((-180.0 * (y_45_scale / (angle * (x_45_scale * pi))))) / pi); else tmp = 180.0 * (atan((0.005555555555555556 * (angle * ((y_45_scale * pi) / 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_] := If[LessEqual[a$95$m, 2.2e-37], 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], N[(180.0 * N[(N[ArcTan[N[(0.005555555555555556 * N[(angle * N[(N[(y$45$scale * Pi), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 2.2 \cdot 10^{-37}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \pi\right)}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.005555555555555556 \cdot \left(angle \cdot \frac{y-scale \cdot \pi}{x-scale}\right)\right)}{\pi}\\
\end{array}
\end{array}
if a < 2.20000000000000002e-37Initial program 14.0%
Simplified12.0%
Taylor expanded in angle around 0 11.0%
associate-*r/11.0%
associate-*r*10.4%
distribute-lft-out--10.4%
associate-*r*10.4%
Simplified10.4%
Taylor expanded in a around 0 43.3%
if 2.20000000000000002e-37 < a Initial program 4.9%
Simplified4.6%
Taylor expanded in x-scale around 0 19.5%
Simplified21.1%
Taylor expanded in a around inf 57.1%
times-frac57.1%
Simplified57.1%
add-cube-cbrt19.4%
Applied egg-rr60.8%
Taylor expanded in angle around 0 56.2%
associate-/l*60.2%
Simplified60.2%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= a_m 2.7e-36)
(* 180.0 (/ (atan (* -180.0 (/ y-scale (* angle (* x-scale PI))))) PI))
(*
180.0
(/
(atan (* 0.005555555555555556 (* angle (* y-scale (/ PI 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 tmp;
if (a_m <= 2.7e-36) {
tmp = 180.0 * (atan((-180.0 * (y_45_scale / (angle * (x_45_scale * ((double) M_PI)))))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((0.005555555555555556 * (angle * (y_45_scale * (((double) M_PI) / 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 tmp;
if (a_m <= 2.7e-36) {
tmp = 180.0 * (Math.atan((-180.0 * (y_45_scale / (angle * (x_45_scale * Math.PI))))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan((0.005555555555555556 * (angle * (y_45_scale * (Math.PI / x_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 a_m <= 2.7e-36: tmp = 180.0 * (math.atan((-180.0 * (y_45_scale / (angle * (x_45_scale * math.pi))))) / math.pi) else: tmp = 180.0 * (math.atan((0.005555555555555556 * (angle * (y_45_scale * (math.pi / x_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 (a_m <= 2.7e-36) tmp = Float64(180.0 * Float64(atan(Float64(-180.0 * Float64(y_45_scale / Float64(angle * Float64(x_45_scale * pi))))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(0.005555555555555556 * Float64(angle * Float64(y_45_scale * Float64(pi / x_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 (a_m <= 2.7e-36) tmp = 180.0 * (atan((-180.0 * (y_45_scale / (angle * (x_45_scale * pi))))) / pi); else tmp = 180.0 * (atan((0.005555555555555556 * (angle * (y_45_scale * (pi / 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_] := If[LessEqual[a$95$m, 2.7e-36], 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], N[(180.0 * N[(N[ArcTan[N[(0.005555555555555556 * N[(angle * N[(y$45$scale * N[(Pi / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 2.7 \cdot 10^{-36}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \pi\right)}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(0.005555555555555556 \cdot \left(angle \cdot \left(y-scale \cdot \frac{\pi}{x-scale}\right)\right)\right)}{\pi}\\
\end{array}
\end{array}
if a < 2.70000000000000007e-36Initial program 14.0%
Simplified12.0%
Taylor expanded in angle around 0 11.0%
associate-*r/11.0%
associate-*r*10.4%
distribute-lft-out--10.4%
associate-*r*10.4%
Simplified10.4%
Taylor expanded in a around 0 43.3%
if 2.70000000000000007e-36 < a Initial program 4.9%
Simplified4.6%
Taylor expanded in x-scale around 0 19.5%
Simplified21.1%
Taylor expanded in a around inf 57.1%
times-frac57.1%
Simplified57.1%
Taylor expanded in angle around 0 56.2%
associate-/l*60.2%
associate-/l*60.2%
Simplified60.2%
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 11.5%
Simplified9.9%
Taylor expanded in angle around 0 9.7%
associate-*r/9.7%
associate-*r*9.2%
distribute-lft-out--9.2%
associate-*r*9.2%
Simplified9.2%
Taylor expanded in a around 0 38.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 11.5%
Simplified9.9%
Taylor expanded in angle around 0 9.7%
associate-*r/9.7%
associate-*r*9.2%
distribute-lft-out--9.2%
associate-*r*9.2%
Simplified9.2%
Taylor expanded in a around inf 13.4%
herbie shell --seed 2024156
(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)))