
(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 10 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}
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (sin (* 0.005555555555555556 (* angle PI)))))
(if (<= b_m 100000000.0)
(*
180.0
(/
(atan
(*
(/ y-scale x-scale)
(/ t_0 (sin (fma 0.005555555555555556 (* angle PI) (* 0.5 PI))))))
PI))
(*
180.0
(/
(atan
(*
(/ (- y-scale) x-scale)
(/ (sin (fma 0.005555555555555556 (* angle PI) (/ PI 2.0))) t_0)))
PI)))))b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = sin((0.005555555555555556 * (angle * ((double) M_PI))));
double tmp;
if (b_m <= 100000000.0) {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (t_0 / sin(fma(0.005555555555555556, (angle * ((double) M_PI)), (0.5 * ((double) M_PI))))))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(((-y_45_scale / x_45_scale) * (sin(fma(0.005555555555555556, (angle * ((double) M_PI)), (((double) M_PI) / 2.0))) / t_0))) / ((double) M_PI));
}
return tmp;
}
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) t_0 = sin(Float64(0.005555555555555556 * Float64(angle * pi))) tmp = 0.0 if (b_m <= 100000000.0) tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(t_0 / sin(fma(0.005555555555555556, Float64(angle * pi), Float64(0.5 * pi)))))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(Float64(Float64(-y_45_scale) / x_45_scale) * Float64(sin(fma(0.005555555555555556, Float64(angle * pi), Float64(pi / 2.0))) / t_0))) / pi)); end return tmp end
b_m = N[Abs[b], $MachinePrecision]
code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b$95$m, 100000000.0], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[(t$95$0 / N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision] + N[(0.5 * Pi), $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[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision] + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\\
\mathbf{if}\;b\_m \leq 100000000:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{t\_0}{\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-y-scale}{x-scale} \cdot \frac{\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, \frac{\pi}{2}\right)\right)}{t\_0}\right)}{\pi}\\
\end{array}
\end{array}
if b < 1e8Initial program 14.0%
Taylor expanded in x-scale around 0
Applied rewrites28.5%
lift-cos.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6429.7
Applied rewrites29.7%
Taylor expanded in a around inf
Applied rewrites49.5%
if 1e8 < b Initial program 8.3%
Taylor expanded in x-scale around 0
Applied rewrites24.3%
Taylor expanded in a around 0
lower-*.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
Applied rewrites64.7%
lift-cos.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
sin-+PI/2-revN/A
lift-*.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lift-PI.f64N/A
lift-fma.f64N/A
lift-sin.f6465.8
Applied rewrites65.8%
Final simplification53.5%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle PI))) (t_1 (sin t_0)))
(if (<= b_m 2.3e+42)
(*
180.0
(/
(atan
(*
(/ y-scale x-scale)
(/ t_1 (sin (fma 0.005555555555555556 (* angle PI) (* 0.5 PI))))))
PI))
(* 180.0 (/ (atan (* (/ (- y-scale) x-scale) (/ (cos t_0) t_1))) PI)))))b_m = fabs(b);
double code(double a, double b_m, 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 (b_m <= 2.3e+42) {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (t_1 / sin(fma(0.005555555555555556, (angle * ((double) M_PI)), (0.5 * ((double) M_PI))))))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(((-y_45_scale / x_45_scale) * (cos(t_0) / t_1))) / ((double) M_PI));
}
return tmp;
}
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(0.005555555555555556 * Float64(angle * pi)) t_1 = sin(t_0) tmp = 0.0 if (b_m <= 2.3e+42) tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(t_1 / sin(fma(0.005555555555555556, Float64(angle * pi), Float64(0.5 * pi)))))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(Float64(Float64(-y_45_scale) / x_45_scale) * Float64(cos(t_0) / t_1))) / pi)); end return tmp end
b_m = N[Abs[b], $MachinePrecision]
code[a_, b$95$m_, 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[b$95$m, 2.3e+42], 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 * Pi), $MachinePrecision] + N[(0.5 * Pi), $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[Cos[t$95$0], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
t_1 := \sin t\_0\\
\mathbf{if}\;b\_m \leq 2.3 \cdot 10^{+42}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{t\_1}{\sin \left(\mathsf{fma}\left(0.005555555555555556, angle \cdot \pi, 0.5 \cdot \pi\right)\right)}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-y-scale}{x-scale} \cdot \frac{\cos t\_0}{t\_1}\right)}{\pi}\\
\end{array}
\end{array}
if b < 2.3e42Initial program 14.5%
Taylor expanded in x-scale around 0
Applied rewrites29.1%
lift-cos.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lower-/.f64N/A
lift-PI.f6430.7
Applied rewrites30.7%
Taylor expanded in a around inf
Applied rewrites49.8%
if 2.3e42 < b Initial program 5.7%
Taylor expanded in x-scale around 0
Applied rewrites21.3%
Taylor expanded in a around 0
lower-*.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
Applied rewrites67.8%
Final simplification53.6%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle PI))))
(if (<= b_m 8.4e+43)
(* 180.0 (/ (atan (* (/ y-scale x-scale) (tan t_0))) PI))
(*
180.0
(/ (atan (* (/ (- y-scale) x-scale) (/ (cos t_0) (sin t_0)))) PI)))))b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
double tmp;
if (b_m <= 8.4e+43) {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * tan(t_0))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(((-y_45_scale / x_45_scale) * (cos(t_0) / sin(t_0)))) / ((double) M_PI));
}
return tmp;
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 0.005555555555555556 * (angle * Math.PI);
double tmp;
if (b_m <= 8.4e+43) {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * Math.tan(t_0))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(((-y_45_scale / x_45_scale) * (Math.cos(t_0) / Math.sin(t_0)))) / Math.PI);
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): t_0 = 0.005555555555555556 * (angle * math.pi) tmp = 0 if b_m <= 8.4e+43: tmp = 180.0 * (math.atan(((y_45_scale / x_45_scale) * math.tan(t_0))) / math.pi) else: tmp = 180.0 * (math.atan(((-y_45_scale / x_45_scale) * (math.cos(t_0) / math.sin(t_0)))) / math.pi) return tmp
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(0.005555555555555556 * Float64(angle * pi)) tmp = 0.0 if (b_m <= 8.4e+43) tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * tan(t_0))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(Float64(Float64(-y_45_scale) / x_45_scale) * Float64(cos(t_0) / sin(t_0)))) / pi)); end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale) t_0 = 0.005555555555555556 * (angle * pi); tmp = 0.0; if (b_m <= 8.4e+43) tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * tan(t_0))) / pi); else tmp = 180.0 * (atan(((-y_45_scale / x_45_scale) * (cos(t_0) / sin(t_0)))) / pi); end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision]
code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b$95$m, 8.4e+43], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[Tan[t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(N[((-y$45$scale) / x$45$scale), $MachinePrecision] * N[(N[Cos[t$95$0], $MachinePrecision] / N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
\mathbf{if}\;b\_m \leq 8.4 \cdot 10^{+43}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \tan t\_0\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-y-scale}{x-scale} \cdot \frac{\cos t\_0}{\sin t\_0}\right)}{\pi}\\
\end{array}
\end{array}
if b < 8.40000000000000007e43Initial program 14.5%
Taylor expanded in x-scale around 0
Applied rewrites29.1%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6449.0
Applied rewrites49.0%
if 8.40000000000000007e43 < b Initial program 5.7%
Taylor expanded in x-scale around 0
Applied rewrites21.3%
Taylor expanded in a around 0
lower-*.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
Applied rewrites67.8%
Final simplification53.0%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(if (<= b_m 8.5e+43)
(*
180.0
(/
(atan (* (/ y-scale x-scale) (tan (* 0.005555555555555556 (* angle PI)))))
PI))
(* 180.0 (/ (atan (* (/ (- y-scale) x-scale) (/ 180.0 (* angle PI)))) PI))))b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (b_m <= 8.5e+43) {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * tan((0.005555555555555556 * (angle * ((double) M_PI)))))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(((-y_45_scale / x_45_scale) * (180.0 / (angle * ((double) M_PI))))) / ((double) M_PI));
}
return tmp;
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (b_m <= 8.5e+43) {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * Math.tan((0.005555555555555556 * (angle * Math.PI))))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(((-y_45_scale / x_45_scale) * (180.0 / (angle * Math.PI)))) / Math.PI);
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): tmp = 0 if b_m <= 8.5e+43: tmp = 180.0 * (math.atan(((y_45_scale / x_45_scale) * math.tan((0.005555555555555556 * (angle * math.pi))))) / math.pi) else: tmp = 180.0 * (math.atan(((-y_45_scale / x_45_scale) * (180.0 / (angle * math.pi)))) / math.pi) return tmp
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 0.0 if (b_m <= 8.5e+43) tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * tan(Float64(0.005555555555555556 * Float64(angle * pi))))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(Float64(Float64(-y_45_scale) / x_45_scale) * Float64(180.0 / Float64(angle * pi)))) / pi)); end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 0.0; if (b_m <= 8.5e+43) tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * tan((0.005555555555555556 * (angle * pi))))) / pi); else tmp = 180.0 * (atan(((-y_45_scale / x_45_scale) * (180.0 / (angle * pi)))) / pi); end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[b$95$m, 8.5e+43], 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], N[(180.0 * N[(N[ArcTan[N[(N[((-y$45$scale) / x$45$scale), $MachinePrecision] * N[(180.0 / N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 8.5 \cdot 10^{+43}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \tan \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-y-scale}{x-scale} \cdot \frac{180}{angle \cdot \pi}\right)}{\pi}\\
\end{array}
\end{array}
if b < 8.5e43Initial program 14.5%
Taylor expanded in x-scale around 0
Applied rewrites29.1%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6449.0
Applied rewrites49.0%
if 8.5e43 < b Initial program 5.7%
Taylor expanded in x-scale around 0
Applied rewrites21.3%
Taylor expanded in a around 0
lower-*.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
Applied rewrites67.8%
Taylor expanded in angle around 0
lower-/.f64N/A
lift-*.f64N/A
lift-PI.f6467.6
Applied rewrites67.6%
Final simplification52.9%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(if (<= b_m 7000000.0)
(*
180.0
(/
(atan (* (/ y-scale x-scale) (* angle (* 0.005555555555555556 PI))))
PI))
(* 180.0 (/ (atan (* (/ (- y-scale) x-scale) (/ 180.0 (* angle PI)))) PI))))b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (b_m <= 7000000.0) {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * ((double) M_PI))))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan(((-y_45_scale / x_45_scale) * (180.0 / (angle * ((double) M_PI))))) / ((double) M_PI));
}
return tmp;
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (b_m <= 7000000.0) {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * Math.PI)))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan(((-y_45_scale / x_45_scale) * (180.0 / (angle * Math.PI)))) / Math.PI);
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): tmp = 0 if b_m <= 7000000.0: tmp = 180.0 * (math.atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * math.pi)))) / math.pi) else: tmp = 180.0 * (math.atan(((-y_45_scale / x_45_scale) * (180.0 / (angle * math.pi)))) / math.pi) return tmp
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 0.0 if (b_m <= 7000000.0) tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(angle * Float64(0.005555555555555556 * pi)))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(Float64(Float64(-y_45_scale) / x_45_scale) * Float64(180.0 / Float64(angle * pi)))) / pi)); end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 0.0; if (b_m <= 7000000.0) tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * pi)))) / pi); else tmp = 180.0 * (atan(((-y_45_scale / x_45_scale) * (180.0 / (angle * pi)))) / pi); end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[b$95$m, 7000000.0], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[(angle * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(N[ArcTan[N[(N[((-y$45$scale) / x$45$scale), $MachinePrecision] * N[(180.0 / N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 7000000:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{-y-scale}{x-scale} \cdot \frac{180}{angle \cdot \pi}\right)}{\pi}\\
\end{array}
\end{array}
if b < 7e6Initial program 14.0%
Taylor expanded in x-scale around 0
Applied rewrites28.5%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6448.2
Applied rewrites48.2%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-fma.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-PI.f6442.4
Applied rewrites42.4%
Taylor expanded in angle around 0
lower-*.f64N/A
lift-PI.f6445.6
Applied rewrites45.6%
if 7e6 < b Initial program 8.3%
Taylor expanded in x-scale around 0
Applied rewrites24.3%
Taylor expanded in a around 0
lower-*.f64N/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
Applied rewrites64.7%
Taylor expanded in angle around 0
lower-/.f64N/A
lift-*.f64N/A
lift-PI.f6466.2
Applied rewrites66.2%
Final simplification50.6%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(if (<= b_m 3.9e+45)
(*
180.0
(/
(atan (* (/ y-scale x-scale) (* angle (* 0.005555555555555556 PI))))
PI))
(* 180.0 (/ (atan (* -180.0 (/ y-scale (* angle (* x-scale PI))))) PI))))b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (b_m <= 3.9e+45) {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * ((double) M_PI))))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((-180.0 * (y_45_scale / (angle * (x_45_scale * ((double) M_PI)))))) / ((double) M_PI));
}
return tmp;
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (b_m <= 3.9e+45) {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * Math.PI)))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan((-180.0 * (y_45_scale / (angle * (x_45_scale * Math.PI))))) / Math.PI);
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): tmp = 0 if b_m <= 3.9e+45: tmp = 180.0 * (math.atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * math.pi)))) / math.pi) else: tmp = 180.0 * (math.atan((-180.0 * (y_45_scale / (angle * (x_45_scale * math.pi))))) / math.pi) return tmp
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 0.0 if (b_m <= 3.9e+45) tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(angle * Float64(0.005555555555555556 * pi)))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(-180.0 * Float64(y_45_scale / Float64(angle * Float64(x_45_scale * pi))))) / pi)); end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 0.0; if (b_m <= 3.9e+45) tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * pi)))) / pi); else tmp = 180.0 * (atan((-180.0 * (y_45_scale / (angle * (x_45_scale * pi))))) / pi); end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[b$95$m, 3.9e+45], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[(angle * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], 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}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 3.9 \cdot 10^{+45}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \pi\right)}\right)}{\pi}\\
\end{array}
\end{array}
if b < 3.8999999999999999e45Initial program 14.4%
Taylor expanded in x-scale around 0
Applied rewrites29.5%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6449.3
Applied rewrites49.3%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-fma.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-PI.f6442.8
Applied rewrites42.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lift-PI.f6446.3
Applied rewrites46.3%
if 3.8999999999999999e45 < b Initial program 5.8%
Taylor expanded in angle around 0
Applied rewrites9.9%
Taylor expanded in a around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f6466.0
Applied rewrites66.0%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(if (<= b_m 5.2e+239)
(*
180.0
(/
(atan (* (/ y-scale x-scale) (* angle (* 0.005555555555555556 PI))))
PI))
(* 180.0 (/ (atan (* -180.0 (/ x-scale (* angle (* y-scale PI))))) PI))))b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (b_m <= 5.2e+239) {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * ((double) M_PI))))) / ((double) M_PI));
} else {
tmp = 180.0 * (atan((-180.0 * (x_45_scale / (angle * (y_45_scale * ((double) M_PI)))))) / ((double) M_PI));
}
return tmp;
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (b_m <= 5.2e+239) {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * Math.PI)))) / Math.PI);
} else {
tmp = 180.0 * (Math.atan((-180.0 * (x_45_scale / (angle * (y_45_scale * Math.PI))))) / Math.PI);
}
return tmp;
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): tmp = 0 if b_m <= 5.2e+239: tmp = 180.0 * (math.atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * math.pi)))) / math.pi) else: tmp = 180.0 * (math.atan((-180.0 * (x_45_scale / (angle * (y_45_scale * math.pi))))) / math.pi) return tmp
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 0.0 if (b_m <= 5.2e+239) tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(angle * Float64(0.005555555555555556 * pi)))) / pi)); else tmp = Float64(180.0 * Float64(atan(Float64(-180.0 * Float64(x_45_scale / Float64(angle * Float64(y_45_scale * pi))))) / pi)); end return tmp end
b_m = abs(b); function tmp_2 = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 0.0; if (b_m <= 5.2e+239) tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * pi)))) / pi); else tmp = 180.0 * (atan((-180.0 * (x_45_scale / (angle * (y_45_scale * pi))))) / pi); end tmp_2 = tmp; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[b$95$m, 5.2e+239], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[(angle * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], 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}
b_m = \left|b\right|
\\
\begin{array}{l}
\mathbf{if}\;b\_m \leq 5.2 \cdot 10^{+239}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \pi\right)}\right)}{\pi}\\
\end{array}
\end{array}
if b < 5.2000000000000004e239Initial program 13.5%
Taylor expanded in x-scale around 0
Applied rewrites29.3%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6446.1
Applied rewrites46.1%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-fma.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-PI.f6439.8
Applied rewrites39.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lift-PI.f6443.2
Applied rewrites43.2%
if 5.2000000000000004e239 < b Initial program 0.0%
Taylor expanded in angle around 0
Applied rewrites0.0%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lift-PI.f6429.1
Applied rewrites29.1%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* (/ y-scale x-scale) (* angle (* 0.005555555555555556 PI)))) PI)))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * ((double) M_PI))))) / ((double) M_PI));
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * Math.PI)))) / Math.PI);
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): return 180.0 * (math.atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * math.pi)))) / math.pi)
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) return Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(angle * Float64(0.005555555555555556 * pi)))) / pi)) end
b_m = abs(b); function tmp = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (angle * (0.005555555555555556 * pi)))) / pi); end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[(angle * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right)\right)}{\pi}
\end{array}
Initial program 12.6%
Taylor expanded in x-scale around 0
Applied rewrites27.5%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6443.8
Applied rewrites43.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-fma.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-PI.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-PI.f6437.8
Applied rewrites37.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lift-PI.f6441.0
Applied rewrites41.0%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* (/ y-scale x-scale) (* 0.005555555555555556 (* angle PI)))) PI)))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (atan(((y_45_scale / x_45_scale) * (0.005555555555555556 * (angle * ((double) M_PI))))) / ((double) M_PI));
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (0.005555555555555556 * (angle * Math.PI)))) / Math.PI);
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): return 180.0 * (math.atan(((y_45_scale / x_45_scale) * (0.005555555555555556 * (angle * math.pi)))) / math.pi)
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) return Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(0.005555555555555556 * Float64(angle * pi)))) / pi)) end
b_m = abs(b); function tmp = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (0.005555555555555556 * (angle * pi)))) / pi); end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)\right)}{\pi}
\end{array}
Initial program 12.6%
Taylor expanded in x-scale around 0
Applied rewrites27.5%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6443.8
Applied rewrites43.8%
Taylor expanded in angle around 0
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6441.0
Applied rewrites41.0%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* 0.005555555555555556 (/ (* angle (* y-scale PI)) x-scale))) PI)))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (atan((0.005555555555555556 * ((angle * (y_45_scale * ((double) M_PI))) / x_45_scale))) / ((double) M_PI));
}
b_m = Math.abs(b);
public static double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (Math.atan((0.005555555555555556 * ((angle * (y_45_scale * Math.PI)) / x_45_scale))) / Math.PI);
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): return 180.0 * (math.atan((0.005555555555555556 * ((angle * (y_45_scale * math.pi)) / x_45_scale))) / math.pi)
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) return Float64(180.0 * Float64(atan(Float64(0.005555555555555556 * Float64(Float64(angle * Float64(y_45_scale * pi)) / x_45_scale))) / pi)) end
b_m = abs(b); function tmp = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 180.0 * (atan((0.005555555555555556 * ((angle * (y_45_scale * pi)) / x_45_scale))) / pi); end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := N[(180.0 * N[(N[ArcTan[N[(0.005555555555555556 * N[(N[(angle * N[(y$45$scale * Pi), $MachinePrecision]), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
180 \cdot \frac{\tan^{-1} \left(0.005555555555555556 \cdot \frac{angle \cdot \left(y-scale \cdot \pi\right)}{x-scale}\right)}{\pi}
\end{array}
Initial program 12.6%
Taylor expanded in x-scale around 0
Applied rewrites27.5%
Taylor expanded in a around inf
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
quot-tanN/A
lower-tan.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6443.8
Applied rewrites43.8%
Taylor expanded in angle around 0
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-PI.f64N/A
lift-*.f6436.0
Applied rewrites36.0%
herbie shell --seed 2025080
(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)))