
(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 (* (* PI angle) 0.005555555555555556)))
(if (<= a_m 3e-47)
(*
(* (/ 1.0 PI) 180.0)
(atan (* (* (* (/ (cos t_0) (* (sin t_0) x-scale)) y-scale) 2.0) -0.5)))
(*
(atan (* (* (* -2.0 (/ y-scale x-scale)) (tan t_0)) -0.5))
(/ 180.0 PI)))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (((double) M_PI) * angle) * 0.005555555555555556;
double tmp;
if (a_m <= 3e-47) {
tmp = ((1.0 / ((double) M_PI)) * 180.0) * atan(((((cos(t_0) / (sin(t_0) * x_45_scale)) * y_45_scale) * 2.0) * -0.5));
} else {
tmp = atan((((-2.0 * (y_45_scale / x_45_scale)) * tan(t_0)) * -0.5)) * (180.0 / ((double) M_PI));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (Math.PI * angle) * 0.005555555555555556;
double tmp;
if (a_m <= 3e-47) {
tmp = ((1.0 / Math.PI) * 180.0) * Math.atan(((((Math.cos(t_0) / (Math.sin(t_0) * x_45_scale)) * y_45_scale) * 2.0) * -0.5));
} else {
tmp = Math.atan((((-2.0 * (y_45_scale / x_45_scale)) * Math.tan(t_0)) * -0.5)) * (180.0 / Math.PI);
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = (math.pi * angle) * 0.005555555555555556 tmp = 0 if a_m <= 3e-47: tmp = ((1.0 / math.pi) * 180.0) * math.atan(((((math.cos(t_0) / (math.sin(t_0) * x_45_scale)) * y_45_scale) * 2.0) * -0.5)) else: tmp = math.atan((((-2.0 * (y_45_scale / x_45_scale)) * math.tan(t_0)) * -0.5)) * (180.0 / math.pi) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(pi * angle) * 0.005555555555555556) tmp = 0.0 if (a_m <= 3e-47) tmp = Float64(Float64(Float64(1.0 / pi) * 180.0) * atan(Float64(Float64(Float64(Float64(cos(t_0) / Float64(sin(t_0) * x_45_scale)) * y_45_scale) * 2.0) * -0.5))); else tmp = Float64(atan(Float64(Float64(Float64(-2.0 * Float64(y_45_scale / x_45_scale)) * tan(t_0)) * -0.5)) * Float64(180.0 / pi)); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = (pi * angle) * 0.005555555555555556; tmp = 0.0; if (a_m <= 3e-47) tmp = ((1.0 / pi) * 180.0) * atan(((((cos(t_0) / (sin(t_0) * x_45_scale)) * y_45_scale) * 2.0) * -0.5)); else tmp = atan((((-2.0 * (y_45_scale / x_45_scale)) * tan(t_0)) * -0.5)) * (180.0 / pi); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, If[LessEqual[a$95$m, 3e-47], N[(N[(N[(1.0 / Pi), $MachinePrecision] * 180.0), $MachinePrecision] * N[ArcTan[N[(N[(N[(N[(N[Cos[t$95$0], $MachinePrecision] / N[(N[Sin[t$95$0], $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision] * y$45$scale), $MachinePrecision] * 2.0), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[ArcTan[N[(N[(N[(-2.0 * N[(y$45$scale / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[Tan[t$95$0], $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \left(\pi \cdot angle\right) \cdot 0.005555555555555556\\
\mathbf{if}\;a\_m \leq 3 \cdot 10^{-47}:\\
\;\;\;\;\left(\frac{1}{\pi} \cdot 180\right) \cdot \tan^{-1} \left(\left(\left(\frac{\cos t\_0}{\sin t\_0 \cdot x-scale} \cdot y-scale\right) \cdot 2\right) \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\left(\left(-2 \cdot \frac{y-scale}{x-scale}\right) \cdot \tan t\_0\right) \cdot -0.5\right) \cdot \frac{180}{\pi}\\
\end{array}
\end{array}
if a < 3.00000000000000017e-47Initial program 19.5%
Taylor expanded in x-scale around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites33.6%
Taylor expanded in a around inf
Applied rewrites41.4%
Applied rewrites43.4%
Taylor expanded in a around 0
Applied rewrites52.7%
if 3.00000000000000017e-47 < a Initial program 9.1%
Taylor expanded in x-scale around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites21.7%
Taylor expanded in a around inf
Applied rewrites65.0%
Applied rewrites65.4%
Applied rewrites65.4%
Final simplification56.3%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* PI angle) 0.005555555555555556)))
(if (<= a_m 3e-47)
(*
(/
(atan (* (* (/ (* (cos t_0) y-scale) (* (sin t_0) x-scale)) 2.0) -0.5))
PI)
180.0)
(*
(atan (* (* (* -2.0 (/ y-scale x-scale)) (tan t_0)) -0.5))
(/ 180.0 PI)))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (((double) M_PI) * angle) * 0.005555555555555556;
double tmp;
if (a_m <= 3e-47) {
tmp = (atan(((((cos(t_0) * y_45_scale) / (sin(t_0) * x_45_scale)) * 2.0) * -0.5)) / ((double) M_PI)) * 180.0;
} else {
tmp = atan((((-2.0 * (y_45_scale / x_45_scale)) * tan(t_0)) * -0.5)) * (180.0 / ((double) M_PI));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (Math.PI * angle) * 0.005555555555555556;
double tmp;
if (a_m <= 3e-47) {
tmp = (Math.atan(((((Math.cos(t_0) * y_45_scale) / (Math.sin(t_0) * x_45_scale)) * 2.0) * -0.5)) / Math.PI) * 180.0;
} else {
tmp = Math.atan((((-2.0 * (y_45_scale / x_45_scale)) * Math.tan(t_0)) * -0.5)) * (180.0 / Math.PI);
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = (math.pi * angle) * 0.005555555555555556 tmp = 0 if a_m <= 3e-47: tmp = (math.atan(((((math.cos(t_0) * y_45_scale) / (math.sin(t_0) * x_45_scale)) * 2.0) * -0.5)) / math.pi) * 180.0 else: tmp = math.atan((((-2.0 * (y_45_scale / x_45_scale)) * math.tan(t_0)) * -0.5)) * (180.0 / math.pi) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(pi * angle) * 0.005555555555555556) tmp = 0.0 if (a_m <= 3e-47) tmp = Float64(Float64(atan(Float64(Float64(Float64(Float64(cos(t_0) * y_45_scale) / Float64(sin(t_0) * x_45_scale)) * 2.0) * -0.5)) / pi) * 180.0); else tmp = Float64(atan(Float64(Float64(Float64(-2.0 * Float64(y_45_scale / x_45_scale)) * tan(t_0)) * -0.5)) * Float64(180.0 / pi)); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = (pi * angle) * 0.005555555555555556; tmp = 0.0; if (a_m <= 3e-47) tmp = (atan(((((cos(t_0) * y_45_scale) / (sin(t_0) * x_45_scale)) * 2.0) * -0.5)) / pi) * 180.0; else tmp = atan((((-2.0 * (y_45_scale / x_45_scale)) * tan(t_0)) * -0.5)) * (180.0 / pi); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, If[LessEqual[a$95$m, 3e-47], N[(N[(N[ArcTan[N[(N[(N[(N[(N[Cos[t$95$0], $MachinePrecision] * y$45$scale), $MachinePrecision] / N[(N[Sin[t$95$0], $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[ArcTan[N[(N[(N[(-2.0 * N[(y$45$scale / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[Tan[t$95$0], $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \left(\pi \cdot angle\right) \cdot 0.005555555555555556\\
\mathbf{if}\;a\_m \leq 3 \cdot 10^{-47}:\\
\;\;\;\;\frac{\tan^{-1} \left(\left(\frac{\cos t\_0 \cdot y-scale}{\sin t\_0 \cdot x-scale} \cdot 2\right) \cdot -0.5\right)}{\pi} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\left(\left(-2 \cdot \frac{y-scale}{x-scale}\right) \cdot \tan t\_0\right) \cdot -0.5\right) \cdot \frac{180}{\pi}\\
\end{array}
\end{array}
if a < 3.00000000000000017e-47Initial program 19.5%
Taylor expanded in x-scale around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites33.6%
Taylor expanded in a around 0
Applied rewrites52.7%
if 3.00000000000000017e-47 < a Initial program 9.1%
Taylor expanded in x-scale around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites21.7%
Taylor expanded in a around inf
Applied rewrites65.0%
Applied rewrites65.4%
Applied rewrites65.4%
Final simplification56.2%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* PI angle) 0.005555555555555556)))
(if (<= a_m 3e-47)
(*
(/ (atan (* (/ (cos t_0) (* (- x-scale) (sin t_0))) y-scale)) PI)
180.0)
(*
(atan (* (* (* -2.0 (/ y-scale x-scale)) (tan t_0)) -0.5))
(/ 180.0 PI)))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (((double) M_PI) * angle) * 0.005555555555555556;
double tmp;
if (a_m <= 3e-47) {
tmp = (atan(((cos(t_0) / (-x_45_scale * sin(t_0))) * y_45_scale)) / ((double) M_PI)) * 180.0;
} else {
tmp = atan((((-2.0 * (y_45_scale / x_45_scale)) * tan(t_0)) * -0.5)) * (180.0 / ((double) M_PI));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (Math.PI * angle) * 0.005555555555555556;
double tmp;
if (a_m <= 3e-47) {
tmp = (Math.atan(((Math.cos(t_0) / (-x_45_scale * Math.sin(t_0))) * y_45_scale)) / Math.PI) * 180.0;
} else {
tmp = Math.atan((((-2.0 * (y_45_scale / x_45_scale)) * Math.tan(t_0)) * -0.5)) * (180.0 / Math.PI);
}
return tmp;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): t_0 = (math.pi * angle) * 0.005555555555555556 tmp = 0 if a_m <= 3e-47: tmp = (math.atan(((math.cos(t_0) / (-x_45_scale * math.sin(t_0))) * y_45_scale)) / math.pi) * 180.0 else: tmp = math.atan((((-2.0 * (y_45_scale / x_45_scale)) * math.tan(t_0)) * -0.5)) * (180.0 / math.pi) return tmp
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(pi * angle) * 0.005555555555555556) tmp = 0.0 if (a_m <= 3e-47) tmp = Float64(Float64(atan(Float64(Float64(cos(t_0) / Float64(Float64(-x_45_scale) * sin(t_0))) * y_45_scale)) / pi) * 180.0); else tmp = Float64(atan(Float64(Float64(Float64(-2.0 * Float64(y_45_scale / x_45_scale)) * tan(t_0)) * -0.5)) * Float64(180.0 / pi)); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) t_0 = (pi * angle) * 0.005555555555555556; tmp = 0.0; if (a_m <= 3e-47) tmp = (atan(((cos(t_0) / (-x_45_scale * sin(t_0))) * y_45_scale)) / pi) * 180.0; else tmp = atan((((-2.0 * (y_45_scale / x_45_scale)) * tan(t_0)) * -0.5)) * (180.0 / pi); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision]
code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, If[LessEqual[a$95$m, 3e-47], N[(N[(N[ArcTan[N[(N[(N[Cos[t$95$0], $MachinePrecision] / N[((-x$45$scale) * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y$45$scale), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[ArcTan[N[(N[(N[(-2.0 * N[(y$45$scale / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[Tan[t$95$0], $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
t_0 := \left(\pi \cdot angle\right) \cdot 0.005555555555555556\\
\mathbf{if}\;a\_m \leq 3 \cdot 10^{-47}:\\
\;\;\;\;\frac{\tan^{-1} \left(\frac{\cos t\_0}{\left(-x-scale\right) \cdot \sin t\_0} \cdot y-scale\right)}{\pi} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\left(\left(-2 \cdot \frac{y-scale}{x-scale}\right) \cdot \tan t\_0\right) \cdot -0.5\right) \cdot \frac{180}{\pi}\\
\end{array}
\end{array}
if a < 3.00000000000000017e-47Initial program 19.5%
Taylor expanded in x-scale around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites33.6%
Taylor expanded in angle around 0
Applied rewrites34.4%
Taylor expanded in a around 0
Applied rewrites52.6%
if 3.00000000000000017e-47 < a Initial program 9.1%
Taylor expanded in x-scale around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites21.7%
Taylor expanded in a around inf
Applied rewrites65.0%
Applied rewrites65.4%
Applied rewrites65.4%
Final simplification56.2%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= a_m 3e-47)
(/
(* (atan (* (* (/ y-scale (* (* PI x-scale) angle)) -2.0) 90.0)) 180.0)
PI)
(*
(atan
(*
(*
(* -2.0 (/ y-scale x-scale))
(tan (* (* PI angle) 0.005555555555555556)))
-0.5))
(/ 180.0 PI))))a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (a_m <= 3e-47) {
tmp = (atan((((y_45_scale / ((((double) M_PI) * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / ((double) M_PI);
} else {
tmp = atan((((-2.0 * (y_45_scale / x_45_scale)) * tan(((((double) M_PI) * angle) * 0.005555555555555556))) * -0.5)) * (180.0 / ((double) M_PI));
}
return tmp;
}
a_m = Math.abs(a);
public static double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
double tmp;
if (a_m <= 3e-47) {
tmp = (Math.atan((((y_45_scale / ((Math.PI * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / Math.PI;
} else {
tmp = Math.atan((((-2.0 * (y_45_scale / x_45_scale)) * Math.tan(((Math.PI * angle) * 0.005555555555555556))) * -0.5)) * (180.0 / 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 <= 3e-47: tmp = (math.atan((((y_45_scale / ((math.pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / math.pi else: tmp = math.atan((((-2.0 * (y_45_scale / x_45_scale)) * math.tan(((math.pi * angle) * 0.005555555555555556))) * -0.5)) * (180.0 / 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 <= 3e-47) tmp = Float64(Float64(atan(Float64(Float64(Float64(y_45_scale / Float64(Float64(pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / pi); else tmp = Float64(atan(Float64(Float64(Float64(-2.0 * Float64(y_45_scale / x_45_scale)) * tan(Float64(Float64(pi * angle) * 0.005555555555555556))) * -0.5)) * Float64(180.0 / pi)); end return tmp end
a_m = abs(a); function tmp_2 = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = 0.0; if (a_m <= 3e-47) tmp = (atan((((y_45_scale / ((pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / pi; else tmp = atan((((-2.0 * (y_45_scale / x_45_scale)) * tan(((pi * angle) * 0.005555555555555556))) * -0.5)) * (180.0 / pi); end tmp_2 = tmp; end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := If[LessEqual[a$95$m, 3e-47], N[(N[(N[ArcTan[N[(N[(N[(y$45$scale / N[(N[(Pi * x$45$scale), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision] * 90.0), $MachinePrecision]], $MachinePrecision] * 180.0), $MachinePrecision] / Pi), $MachinePrecision], N[(N[ArcTan[N[(N[(N[(-2.0 * N[(y$45$scale / x$45$scale), $MachinePrecision]), $MachinePrecision] * N[Tan[N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision] * N[(180.0 / Pi), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 3 \cdot 10^{-47}:\\
\;\;\;\;\frac{\tan^{-1} \left(\left(\frac{y-scale}{\left(\pi \cdot x-scale\right) \cdot angle} \cdot -2\right) \cdot 90\right) \cdot 180}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\left(\left(-2 \cdot \frac{y-scale}{x-scale}\right) \cdot \tan \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right) \cdot -0.5\right) \cdot \frac{180}{\pi}\\
\end{array}
\end{array}
if a < 3.00000000000000017e-47Initial program 19.5%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites13.8%
Taylor expanded in a around inf
Applied rewrites15.9%
Taylor expanded in a around 0
Applied rewrites43.3%
Applied rewrites43.4%
if 3.00000000000000017e-47 < a Initial program 9.1%
Taylor expanded in x-scale around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites21.7%
Taylor expanded in a around inf
Applied rewrites65.0%
Applied rewrites65.4%
Applied rewrites65.4%
Final simplification49.6%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= a_m 1.85e-58)
(/
(* (atan (* (* (/ y-scale (* (* PI x-scale) angle)) -2.0) 90.0)) 180.0)
PI)
(*
(atan
(*
(* (* (* PI angle) 0.005555555555555556) (* -2.0 (/ y-scale x-scale)))
-0.5))
(* (/ 1.0 PI) 180.0))))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.85e-58) {
tmp = (atan((((y_45_scale / ((((double) M_PI) * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / ((double) M_PI);
} else {
tmp = atan(((((((double) M_PI) * angle) * 0.005555555555555556) * (-2.0 * (y_45_scale / x_45_scale))) * -0.5)) * ((1.0 / ((double) M_PI)) * 180.0);
}
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.85e-58) {
tmp = (Math.atan((((y_45_scale / ((Math.PI * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / Math.PI;
} else {
tmp = Math.atan(((((Math.PI * angle) * 0.005555555555555556) * (-2.0 * (y_45_scale / x_45_scale))) * -0.5)) * ((1.0 / Math.PI) * 180.0);
}
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.85e-58: tmp = (math.atan((((y_45_scale / ((math.pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / math.pi else: tmp = math.atan(((((math.pi * angle) * 0.005555555555555556) * (-2.0 * (y_45_scale / x_45_scale))) * -0.5)) * ((1.0 / math.pi) * 180.0) 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.85e-58) tmp = Float64(Float64(atan(Float64(Float64(Float64(y_45_scale / Float64(Float64(pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / pi); else tmp = Float64(atan(Float64(Float64(Float64(Float64(pi * angle) * 0.005555555555555556) * Float64(-2.0 * Float64(y_45_scale / x_45_scale))) * -0.5)) * Float64(Float64(1.0 / pi) * 180.0)); 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.85e-58) tmp = (atan((((y_45_scale / ((pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / pi; else tmp = atan(((((pi * angle) * 0.005555555555555556) * (-2.0 * (y_45_scale / x_45_scale))) * -0.5)) * ((1.0 / pi) * 180.0); 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.85e-58], N[(N[(N[ArcTan[N[(N[(N[(y$45$scale / N[(N[(Pi * x$45$scale), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision] * 90.0), $MachinePrecision]], $MachinePrecision] * 180.0), $MachinePrecision] / Pi), $MachinePrecision], N[(N[ArcTan[N[(N[(N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision] * N[(-2.0 * N[(y$45$scale / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 / Pi), $MachinePrecision] * 180.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 1.85 \cdot 10^{-58}:\\
\;\;\;\;\frac{\tan^{-1} \left(\left(\frac{y-scale}{\left(\pi \cdot x-scale\right) \cdot angle} \cdot -2\right) \cdot 90\right) \cdot 180}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\left(\left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \left(-2 \cdot \frac{y-scale}{x-scale}\right)\right) \cdot -0.5\right) \cdot \left(\frac{1}{\pi} \cdot 180\right)\\
\end{array}
\end{array}
if a < 1.8500000000000001e-58Initial program 19.5%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites13.8%
Taylor expanded in a around inf
Applied rewrites15.9%
Taylor expanded in a around 0
Applied rewrites43.3%
Applied rewrites43.4%
if 1.8500000000000001e-58 < a Initial program 9.1%
Taylor expanded in x-scale around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites21.7%
Taylor expanded in a around inf
Applied rewrites65.0%
Applied rewrites65.4%
Taylor expanded in angle around 0
Applied rewrites57.4%
Final simplification47.3%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= a_m 1.85e-58)
(/
(* (atan (* (* (/ y-scale (* (* PI x-scale) angle)) -2.0) 90.0)) 180.0)
PI)
(*
(/
(atan
(*
(* (* (* PI angle) 0.005555555555555556) (* -2.0 (/ y-scale x-scale)))
-0.5))
PI)
180.0)))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.85e-58) {
tmp = (atan((((y_45_scale / ((((double) M_PI) * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / ((double) M_PI);
} else {
tmp = (atan(((((((double) M_PI) * angle) * 0.005555555555555556) * (-2.0 * (y_45_scale / x_45_scale))) * -0.5)) / ((double) M_PI)) * 180.0;
}
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.85e-58) {
tmp = (Math.atan((((y_45_scale / ((Math.PI * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / Math.PI;
} else {
tmp = (Math.atan(((((Math.PI * angle) * 0.005555555555555556) * (-2.0 * (y_45_scale / x_45_scale))) * -0.5)) / Math.PI) * 180.0;
}
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.85e-58: tmp = (math.atan((((y_45_scale / ((math.pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / math.pi else: tmp = (math.atan(((((math.pi * angle) * 0.005555555555555556) * (-2.0 * (y_45_scale / x_45_scale))) * -0.5)) / math.pi) * 180.0 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.85e-58) tmp = Float64(Float64(atan(Float64(Float64(Float64(y_45_scale / Float64(Float64(pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / pi); else tmp = Float64(Float64(atan(Float64(Float64(Float64(Float64(pi * angle) * 0.005555555555555556) * Float64(-2.0 * Float64(y_45_scale / x_45_scale))) * -0.5)) / pi) * 180.0); 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.85e-58) tmp = (atan((((y_45_scale / ((pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / pi; else tmp = (atan(((((pi * angle) * 0.005555555555555556) * (-2.0 * (y_45_scale / x_45_scale))) * -0.5)) / pi) * 180.0; 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.85e-58], N[(N[(N[ArcTan[N[(N[(N[(y$45$scale / N[(N[(Pi * x$45$scale), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision] * 90.0), $MachinePrecision]], $MachinePrecision] * 180.0), $MachinePrecision] / Pi), $MachinePrecision], N[(N[(N[ArcTan[N[(N[(N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision] * N[(-2.0 * N[(y$45$scale / x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 1.85 \cdot 10^{-58}:\\
\;\;\;\;\frac{\tan^{-1} \left(\left(\frac{y-scale}{\left(\pi \cdot x-scale\right) \cdot angle} \cdot -2\right) \cdot 90\right) \cdot 180}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\left(\left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right) \cdot \left(-2 \cdot \frac{y-scale}{x-scale}\right)\right) \cdot -0.5\right)}{\pi} \cdot 180\\
\end{array}
\end{array}
if a < 1.8500000000000001e-58Initial program 19.5%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites13.8%
Taylor expanded in a around inf
Applied rewrites15.9%
Taylor expanded in a around 0
Applied rewrites43.3%
Applied rewrites43.4%
if 1.8500000000000001e-58 < a Initial program 9.1%
Taylor expanded in x-scale around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites21.7%
Taylor expanded in a around inf
Applied rewrites65.0%
Applied rewrites65.2%
Taylor expanded in angle around 0
Applied rewrites57.3%
Final simplification47.3%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= a_m 1.85e-58)
(/
(* (atan (* (* (/ y-scale (* (* PI x-scale) angle)) -2.0) 90.0)) 180.0)
PI)
(*
(atan
(* (* -0.011111111111111112 (/ (* (* PI y-scale) angle) x-scale)) -0.5))
(* (/ 1.0 PI) 180.0))))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.85e-58) {
tmp = (atan((((y_45_scale / ((((double) M_PI) * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / ((double) M_PI);
} else {
tmp = atan(((-0.011111111111111112 * (((((double) M_PI) * y_45_scale) * angle) / x_45_scale)) * -0.5)) * ((1.0 / ((double) M_PI)) * 180.0);
}
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.85e-58) {
tmp = (Math.atan((((y_45_scale / ((Math.PI * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / Math.PI;
} else {
tmp = Math.atan(((-0.011111111111111112 * (((Math.PI * y_45_scale) * angle) / x_45_scale)) * -0.5)) * ((1.0 / Math.PI) * 180.0);
}
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.85e-58: tmp = (math.atan((((y_45_scale / ((math.pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / math.pi else: tmp = math.atan(((-0.011111111111111112 * (((math.pi * y_45_scale) * angle) / x_45_scale)) * -0.5)) * ((1.0 / math.pi) * 180.0) 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.85e-58) tmp = Float64(Float64(atan(Float64(Float64(Float64(y_45_scale / Float64(Float64(pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / pi); else tmp = Float64(atan(Float64(Float64(-0.011111111111111112 * Float64(Float64(Float64(pi * y_45_scale) * angle) / x_45_scale)) * -0.5)) * Float64(Float64(1.0 / pi) * 180.0)); 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.85e-58) tmp = (atan((((y_45_scale / ((pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / pi; else tmp = atan(((-0.011111111111111112 * (((pi * y_45_scale) * angle) / x_45_scale)) * -0.5)) * ((1.0 / pi) * 180.0); 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.85e-58], N[(N[(N[ArcTan[N[(N[(N[(y$45$scale / N[(N[(Pi * x$45$scale), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision] * 90.0), $MachinePrecision]], $MachinePrecision] * 180.0), $MachinePrecision] / Pi), $MachinePrecision], N[(N[ArcTan[N[(N[(-0.011111111111111112 * N[(N[(N[(Pi * y$45$scale), $MachinePrecision] * angle), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 / Pi), $MachinePrecision] * 180.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 1.85 \cdot 10^{-58}:\\
\;\;\;\;\frac{\tan^{-1} \left(\left(\frac{y-scale}{\left(\pi \cdot x-scale\right) \cdot angle} \cdot -2\right) \cdot 90\right) \cdot 180}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\tan^{-1} \left(\left(-0.011111111111111112 \cdot \frac{\left(\pi \cdot y-scale\right) \cdot angle}{x-scale}\right) \cdot -0.5\right) \cdot \left(\frac{1}{\pi} \cdot 180\right)\\
\end{array}
\end{array}
if a < 1.8500000000000001e-58Initial program 19.5%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites13.8%
Taylor expanded in a around inf
Applied rewrites15.9%
Taylor expanded in a around 0
Applied rewrites43.3%
Applied rewrites43.4%
if 1.8500000000000001e-58 < a Initial program 9.1%
Taylor expanded in x-scale around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites21.7%
Taylor expanded in a around inf
Applied rewrites65.0%
Applied rewrites65.4%
Taylor expanded in angle around 0
Applied rewrites57.3%
Final simplification47.3%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= a_m 1.85e-58)
(/
(* (atan (* (* (/ y-scale (* (* PI x-scale) angle)) -2.0) 90.0)) 180.0)
PI)
(*
(/
(atan
(* (* -0.011111111111111112 (/ (* (* PI y-scale) angle) x-scale)) -0.5))
PI)
180.0)))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.85e-58) {
tmp = (atan((((y_45_scale / ((((double) M_PI) * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / ((double) M_PI);
} else {
tmp = (atan(((-0.011111111111111112 * (((((double) M_PI) * y_45_scale) * angle) / x_45_scale)) * -0.5)) / ((double) M_PI)) * 180.0;
}
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.85e-58) {
tmp = (Math.atan((((y_45_scale / ((Math.PI * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / Math.PI;
} else {
tmp = (Math.atan(((-0.011111111111111112 * (((Math.PI * y_45_scale) * angle) / x_45_scale)) * -0.5)) / Math.PI) * 180.0;
}
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.85e-58: tmp = (math.atan((((y_45_scale / ((math.pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / math.pi else: tmp = (math.atan(((-0.011111111111111112 * (((math.pi * y_45_scale) * angle) / x_45_scale)) * -0.5)) / math.pi) * 180.0 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.85e-58) tmp = Float64(Float64(atan(Float64(Float64(Float64(y_45_scale / Float64(Float64(pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / pi); else tmp = Float64(Float64(atan(Float64(Float64(-0.011111111111111112 * Float64(Float64(Float64(pi * y_45_scale) * angle) / x_45_scale)) * -0.5)) / pi) * 180.0); 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.85e-58) tmp = (atan((((y_45_scale / ((pi * x_45_scale) * angle)) * -2.0) * 90.0)) * 180.0) / pi; else tmp = (atan(((-0.011111111111111112 * (((pi * y_45_scale) * angle) / x_45_scale)) * -0.5)) / pi) * 180.0; 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.85e-58], N[(N[(N[ArcTan[N[(N[(N[(y$45$scale / N[(N[(Pi * x$45$scale), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision] * 90.0), $MachinePrecision]], $MachinePrecision] * 180.0), $MachinePrecision] / Pi), $MachinePrecision], N[(N[(N[ArcTan[N[(N[(-0.011111111111111112 * N[(N[(N[(Pi * y$45$scale), $MachinePrecision] * angle), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 1.85 \cdot 10^{-58}:\\
\;\;\;\;\frac{\tan^{-1} \left(\left(\frac{y-scale}{\left(\pi \cdot x-scale\right) \cdot angle} \cdot -2\right) \cdot 90\right) \cdot 180}{\pi}\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\left(-0.011111111111111112 \cdot \frac{\left(\pi \cdot y-scale\right) \cdot angle}{x-scale}\right) \cdot -0.5\right)}{\pi} \cdot 180\\
\end{array}
\end{array}
if a < 1.8500000000000001e-58Initial program 19.5%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites13.8%
Taylor expanded in a around inf
Applied rewrites15.9%
Taylor expanded in a around 0
Applied rewrites43.3%
Applied rewrites43.4%
if 1.8500000000000001e-58 < a Initial program 9.1%
Taylor expanded in x-scale around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites21.7%
Taylor expanded in a around inf
Applied rewrites65.0%
Applied rewrites65.2%
Taylor expanded in angle around 0
Applied rewrites57.2%
Final simplification47.3%
a_m = (fabs.f64 a)
(FPCore (a_m b angle x-scale y-scale)
:precision binary64
(if (<= a_m 1.85e-58)
(*
(/ (atan (* (* (/ y-scale (* (* PI x-scale) angle)) -2.0) 90.0)) PI)
180.0)
(*
(/
(atan
(* (* -0.011111111111111112 (/ (* (* PI y-scale) angle) x-scale)) -0.5))
PI)
180.0)))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.85e-58) {
tmp = (atan((((y_45_scale / ((((double) M_PI) * x_45_scale) * angle)) * -2.0) * 90.0)) / ((double) M_PI)) * 180.0;
} else {
tmp = (atan(((-0.011111111111111112 * (((((double) M_PI) * y_45_scale) * angle) / x_45_scale)) * -0.5)) / ((double) M_PI)) * 180.0;
}
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.85e-58) {
tmp = (Math.atan((((y_45_scale / ((Math.PI * x_45_scale) * angle)) * -2.0) * 90.0)) / Math.PI) * 180.0;
} else {
tmp = (Math.atan(((-0.011111111111111112 * (((Math.PI * y_45_scale) * angle) / x_45_scale)) * -0.5)) / Math.PI) * 180.0;
}
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.85e-58: tmp = (math.atan((((y_45_scale / ((math.pi * x_45_scale) * angle)) * -2.0) * 90.0)) / math.pi) * 180.0 else: tmp = (math.atan(((-0.011111111111111112 * (((math.pi * y_45_scale) * angle) / x_45_scale)) * -0.5)) / math.pi) * 180.0 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.85e-58) tmp = Float64(Float64(atan(Float64(Float64(Float64(y_45_scale / Float64(Float64(pi * x_45_scale) * angle)) * -2.0) * 90.0)) / pi) * 180.0); else tmp = Float64(Float64(atan(Float64(Float64(-0.011111111111111112 * Float64(Float64(Float64(pi * y_45_scale) * angle) / x_45_scale)) * -0.5)) / pi) * 180.0); 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.85e-58) tmp = (atan((((y_45_scale / ((pi * x_45_scale) * angle)) * -2.0) * 90.0)) / pi) * 180.0; else tmp = (atan(((-0.011111111111111112 * (((pi * y_45_scale) * angle) / x_45_scale)) * -0.5)) / pi) * 180.0; 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.85e-58], N[(N[(N[ArcTan[N[(N[(N[(y$45$scale / N[(N[(Pi * x$45$scale), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision] * 90.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision], N[(N[(N[ArcTan[N[(N[(-0.011111111111111112 * N[(N[(N[(Pi * y$45$scale), $MachinePrecision] * angle), $MachinePrecision] / x$45$scale), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 1.85 \cdot 10^{-58}:\\
\;\;\;\;\frac{\tan^{-1} \left(\left(\frac{y-scale}{\left(\pi \cdot x-scale\right) \cdot angle} \cdot -2\right) \cdot 90\right)}{\pi} \cdot 180\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan^{-1} \left(\left(-0.011111111111111112 \cdot \frac{\left(\pi \cdot y-scale\right) \cdot angle}{x-scale}\right) \cdot -0.5\right)}{\pi} \cdot 180\\
\end{array}
\end{array}
if a < 1.8500000000000001e-58Initial program 19.5%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites13.8%
Taylor expanded in a around 0
Applied rewrites43.3%
if 1.8500000000000001e-58 < a Initial program 9.1%
Taylor expanded in x-scale around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites21.7%
Taylor expanded in a around inf
Applied rewrites65.0%
Applied rewrites65.2%
Taylor expanded in angle around 0
Applied rewrites57.2%
Final simplification47.2%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* (/ (atan (* (* (/ y-scale (* (* PI x-scale) angle)) -2.0) 90.0)) PI) 180.0))
a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return (atan((((y_45_scale / ((((double) M_PI) * x_45_scale) * angle)) * -2.0) * 90.0)) / ((double) M_PI)) * 180.0;
}
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 (Math.atan((((y_45_scale / ((Math.PI * x_45_scale) * angle)) * -2.0) * 90.0)) / Math.PI) * 180.0;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return (math.atan((((y_45_scale / ((math.pi * x_45_scale) * angle)) * -2.0) * 90.0)) / math.pi) * 180.0
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64(Float64(atan(Float64(Float64(Float64(y_45_scale / Float64(Float64(pi * x_45_scale) * angle)) * -2.0) * 90.0)) / pi) * 180.0) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = (atan((((y_45_scale / ((pi * x_45_scale) * angle)) * -2.0) * 90.0)) / pi) * 180.0; end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[ArcTan[N[(N[(N[(y$45$scale / N[(N[(Pi * x$45$scale), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision] * 90.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
\frac{\tan^{-1} \left(\left(\frac{y-scale}{\left(\pi \cdot x-scale\right) \cdot angle} \cdot -2\right) \cdot 90\right)}{\pi} \cdot 180
\end{array}
Initial program 16.6%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites11.6%
Taylor expanded in a around 0
Applied rewrites38.3%
Final simplification38.3%
a_m = (fabs.f64 a) (FPCore (a_m b angle x-scale y-scale) :precision binary64 (* (/ (atan (* (* (/ x-scale (* (* PI y-scale) angle)) -2.0) 90.0)) PI) 180.0))
a_m = fabs(a);
double code(double a_m, double b, double angle, double x_45_scale, double y_45_scale) {
return (atan((((x_45_scale / ((((double) M_PI) * y_45_scale) * angle)) * -2.0) * 90.0)) / ((double) M_PI)) * 180.0;
}
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 (Math.atan((((x_45_scale / ((Math.PI * y_45_scale) * angle)) * -2.0) * 90.0)) / Math.PI) * 180.0;
}
a_m = math.fabs(a) def code(a_m, b, angle, x_45_scale, y_45_scale): return (math.atan((((x_45_scale / ((math.pi * y_45_scale) * angle)) * -2.0) * 90.0)) / math.pi) * 180.0
a_m = abs(a) function code(a_m, b, angle, x_45_scale, y_45_scale) return Float64(Float64(atan(Float64(Float64(Float64(x_45_scale / Float64(Float64(pi * y_45_scale) * angle)) * -2.0) * 90.0)) / pi) * 180.0) end
a_m = abs(a); function tmp = code(a_m, b, angle, x_45_scale, y_45_scale) tmp = (atan((((x_45_scale / ((pi * y_45_scale) * angle)) * -2.0) * 90.0)) / pi) * 180.0; end
a_m = N[Abs[a], $MachinePrecision] code[a$95$m_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[ArcTan[N[(N[(N[(x$45$scale / N[(N[(Pi * y$45$scale), $MachinePrecision] * angle), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision] * 90.0), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision] * 180.0), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
\frac{\tan^{-1} \left(\left(\frac{x-scale}{\left(\pi \cdot y-scale\right) \cdot angle} \cdot -2\right) \cdot 90\right)}{\pi} \cdot 180
\end{array}
Initial program 16.6%
Taylor expanded in angle around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites11.6%
Taylor expanded in a around inf
Applied rewrites14.8%
Final simplification14.8%
herbie shell --seed 2024235
(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)))