
(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 (* 0.005555555555555556 (* angle PI)))
(t_1 (sin t_0))
(t_2 (* PI (* 0.005555555555555556 angle)))
(t_3 (cos t_2)))
(if (<= b_m 2.8e-78)
(* 180.0 (/ (atan (* (/ y-scale x-scale) (/ t_1 (cos t_0)))) PI))
(if (<= b_m 9.8e+66)
(*
180.0
(/
(atan
(*
-0.5
(*
y-scale
(/
(* 2.0 (+ (pow (* a (sin t_2)) 2.0) (pow (* b_m t_3) 2.0)))
(* x-scale (* (* t_1 t_3) (- (pow b_m 2.0) (pow a 2.0))))))))
PI))
(* 180.0 (/ -1.0 (/ PI (atan (/ (/ y-scale x-scale) (tan t_2))))))))))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 t_2 = ((double) M_PI) * (0.005555555555555556 * angle);
double t_3 = cos(t_2);
double tmp;
if (b_m <= 2.8e-78) {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (t_1 / cos(t_0)))) / ((double) M_PI));
} else if (b_m <= 9.8e+66) {
tmp = 180.0 * (atan((-0.5 * (y_45_scale * ((2.0 * (pow((a * sin(t_2)), 2.0) + pow((b_m * t_3), 2.0))) / (x_45_scale * ((t_1 * t_3) * (pow(b_m, 2.0) - pow(a, 2.0)))))))) / ((double) M_PI));
} else {
tmp = 180.0 * (-1.0 / (((double) M_PI) / atan(((y_45_scale / x_45_scale) / tan(t_2)))));
}
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 t_1 = Math.sin(t_0);
double t_2 = Math.PI * (0.005555555555555556 * angle);
double t_3 = Math.cos(t_2);
double tmp;
if (b_m <= 2.8e-78) {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (t_1 / Math.cos(t_0)))) / Math.PI);
} else if (b_m <= 9.8e+66) {
tmp = 180.0 * (Math.atan((-0.5 * (y_45_scale * ((2.0 * (Math.pow((a * Math.sin(t_2)), 2.0) + Math.pow((b_m * t_3), 2.0))) / (x_45_scale * ((t_1 * t_3) * (Math.pow(b_m, 2.0) - Math.pow(a, 2.0)))))))) / Math.PI);
} else {
tmp = 180.0 * (-1.0 / (Math.PI / Math.atan(((y_45_scale / x_45_scale) / Math.tan(t_2)))));
}
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) t_1 = math.sin(t_0) t_2 = math.pi * (0.005555555555555556 * angle) t_3 = math.cos(t_2) tmp = 0 if b_m <= 2.8e-78: tmp = 180.0 * (math.atan(((y_45_scale / x_45_scale) * (t_1 / math.cos(t_0)))) / math.pi) elif b_m <= 9.8e+66: tmp = 180.0 * (math.atan((-0.5 * (y_45_scale * ((2.0 * (math.pow((a * math.sin(t_2)), 2.0) + math.pow((b_m * t_3), 2.0))) / (x_45_scale * ((t_1 * t_3) * (math.pow(b_m, 2.0) - math.pow(a, 2.0)))))))) / math.pi) else: tmp = 180.0 * (-1.0 / (math.pi / math.atan(((y_45_scale / x_45_scale) / math.tan(t_2))))) 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) t_2 = Float64(pi * Float64(0.005555555555555556 * angle)) t_3 = cos(t_2) tmp = 0.0 if (b_m <= 2.8e-78) tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(t_1 / cos(t_0)))) / pi)); elseif (b_m <= 9.8e+66) tmp = Float64(180.0 * Float64(atan(Float64(-0.5 * Float64(y_45_scale * Float64(Float64(2.0 * Float64((Float64(a * sin(t_2)) ^ 2.0) + (Float64(b_m * t_3) ^ 2.0))) / Float64(x_45_scale * Float64(Float64(t_1 * t_3) * Float64((b_m ^ 2.0) - (a ^ 2.0)))))))) / pi)); else tmp = Float64(180.0 * Float64(-1.0 / Float64(pi / atan(Float64(Float64(y_45_scale / x_45_scale) / tan(t_2)))))); 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); t_1 = sin(t_0); t_2 = pi * (0.005555555555555556 * angle); t_3 = cos(t_2); tmp = 0.0; if (b_m <= 2.8e-78) tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (t_1 / cos(t_0)))) / pi); elseif (b_m <= 9.8e+66) tmp = 180.0 * (atan((-0.5 * (y_45_scale * ((2.0 * (((a * sin(t_2)) ^ 2.0) + ((b_m * t_3) ^ 2.0))) / (x_45_scale * ((t_1 * t_3) * ((b_m ^ 2.0) - (a ^ 2.0)))))))) / pi); else tmp = 180.0 * (-1.0 / (pi / atan(((y_45_scale / x_45_scale) / tan(t_2))))); 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]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Cos[t$95$2], $MachinePrecision]}, If[LessEqual[b$95$m, 2.8e-78], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[(t$95$1 / N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], If[LessEqual[b$95$m, 9.8e+66], N[(180.0 * N[(N[ArcTan[N[(-0.5 * N[(y$45$scale * N[(N[(2.0 * N[(N[Power[N[(a * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(b$95$m * t$95$3), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$45$scale * N[(N[(t$95$1 * t$95$3), $MachinePrecision] * N[(N[Power[b$95$m, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(-1.0 / N[(Pi / N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] / N[Tan[t$95$2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $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\\
t_2 := \pi \cdot \left(0.005555555555555556 \cdot angle\right)\\
t_3 := \cos t\_2\\
\mathbf{if}\;b\_m \leq 2.8 \cdot 10^{-78}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{t\_1}{\cos t\_0}\right)}{\pi}\\
\mathbf{elif}\;b\_m \leq 9.8 \cdot 10^{+66}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(-0.5 \cdot \left(y-scale \cdot \frac{2 \cdot \left({\left(a \cdot \sin t\_2\right)}^{2} + {\left(b\_m \cdot t\_3\right)}^{2}\right)}{x-scale \cdot \left(\left(t\_1 \cdot t\_3\right) \cdot \left({b\_m}^{2} - {a}^{2}\right)\right)}\right)\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{-1}{\frac{\pi}{\tan^{-1} \left(\frac{\frac{y-scale}{x-scale}}{\tan t\_2}\right)}}\\
\end{array}
\end{array}
if b < 2.80000000000000024e-78Initial program 11.3%
Simplified11.1%
Taylor expanded in x-scale around 0 19.8%
Simplified27.0%
Taylor expanded in angle around inf 27.0%
Taylor expanded in a around inf 48.8%
times-frac49.9%
Simplified49.9%
if 2.80000000000000024e-78 < b < 9.7999999999999995e66Initial program 23.5%
Simplified25.6%
Taylor expanded in x-scale around 0 49.9%
Simplified54.2%
Taylor expanded in angle around inf 57.9%
if 9.7999999999999995e66 < b Initial program 12.3%
Simplified10.7%
Taylor expanded in x-scale around 0 10.4%
Simplified12.5%
Taylor expanded in a around 0 65.8%
mul-1-neg65.8%
times-frac63.8%
Simplified63.8%
*-un-lft-identity63.8%
associate-*r*71.6%
*-commutative71.6%
Applied egg-rr71.6%
Applied egg-rr63.8%
unpow-163.8%
associate-*r/63.8%
*-rgt-identity63.8%
associate-*r*73.6%
Simplified73.6%
Final simplification55.7%
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 2.85e-67)
(* 180.0 (/ (atan (* (/ y-scale x-scale) (/ (sin t_0) (cos t_0)))) PI))
(*
180.0
(/
-1.0
(/
PI
(atan
(/
(/ y-scale x-scale)
(tan (* PI (* 0.005555555555555556 angle)))))))))))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 <= 2.85e-67) {
tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (sin(t_0) / cos(t_0)))) / ((double) M_PI));
} else {
tmp = 180.0 * (-1.0 / (((double) M_PI) / atan(((y_45_scale / x_45_scale) / tan((((double) M_PI) * (0.005555555555555556 * angle)))))));
}
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 <= 2.85e-67) {
tmp = 180.0 * (Math.atan(((y_45_scale / x_45_scale) * (Math.sin(t_0) / Math.cos(t_0)))) / Math.PI);
} else {
tmp = 180.0 * (-1.0 / (Math.PI / Math.atan(((y_45_scale / x_45_scale) / Math.tan((Math.PI * (0.005555555555555556 * angle)))))));
}
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 <= 2.85e-67: tmp = 180.0 * (math.atan(((y_45_scale / x_45_scale) * (math.sin(t_0) / math.cos(t_0)))) / math.pi) else: tmp = 180.0 * (-1.0 / (math.pi / math.atan(((y_45_scale / x_45_scale) / math.tan((math.pi * (0.005555555555555556 * angle))))))) 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 <= 2.85e-67) tmp = Float64(180.0 * Float64(atan(Float64(Float64(y_45_scale / x_45_scale) * Float64(sin(t_0) / cos(t_0)))) / pi)); else tmp = Float64(180.0 * Float64(-1.0 / Float64(pi / atan(Float64(Float64(y_45_scale / x_45_scale) / tan(Float64(pi * Float64(0.005555555555555556 * angle)))))))); 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 <= 2.85e-67) tmp = 180.0 * (atan(((y_45_scale / x_45_scale) * (sin(t_0) / cos(t_0)))) / pi); else tmp = 180.0 * (-1.0 / (pi / atan(((y_45_scale / x_45_scale) / tan((pi * (0.005555555555555556 * angle))))))); 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, 2.85e-67], N[(180.0 * N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] * N[(N[Sin[t$95$0], $MachinePrecision] / N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision], N[(180.0 * N[(-1.0 / N[(Pi / N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] / N[Tan[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $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 2.85 \cdot 10^{-67}:\\
\;\;\;\;180 \cdot \frac{\tan^{-1} \left(\frac{y-scale}{x-scale} \cdot \frac{\sin t\_0}{\cos t\_0}\right)}{\pi}\\
\mathbf{else}:\\
\;\;\;\;180 \cdot \frac{-1}{\frac{\pi}{\tan^{-1} \left(\frac{\frac{y-scale}{x-scale}}{\tan \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)}\right)}}\\
\end{array}
\end{array}
if b < 2.8500000000000001e-67Initial program 11.7%
Simplified12.1%
Taylor expanded in x-scale around 0 20.1%
Simplified27.2%
Taylor expanded in angle around inf 26.6%
Taylor expanded in a around inf 48.6%
times-frac50.2%
Simplified50.2%
if 2.8500000000000001e-67 < b Initial program 16.8%
Simplified15.7%
Taylor expanded in x-scale around 0 27.9%
Simplified31.1%
Taylor expanded in a around 0 60.2%
mul-1-neg60.2%
times-frac59.0%
Simplified59.0%
*-un-lft-identity59.0%
associate-*r*65.6%
*-commutative65.6%
Applied egg-rr65.6%
Applied egg-rr59.0%
unpow-159.0%
associate-*r/59.0%
*-rgt-identity59.0%
associate-*r*66.8%
Simplified66.8%
Final simplification55.7%
b_m = (fabs.f64 b)
(FPCore (a b_m angle x-scale y-scale)
:precision binary64
(*
180.0
(/
-1.0
(/
PI
(atan
(/ (/ y-scale x-scale) (tan (* PI (* 0.005555555555555556 angle)))))))))b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return 180.0 * (-1.0 / (((double) M_PI) / atan(((y_45_scale / x_45_scale) / tan((((double) M_PI) * (0.005555555555555556 * angle)))))));
}
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 * (-1.0 / (Math.PI / Math.atan(((y_45_scale / x_45_scale) / Math.tan((Math.PI * (0.005555555555555556 * angle)))))));
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): return 180.0 * (-1.0 / (math.pi / math.atan(((y_45_scale / x_45_scale) / math.tan((math.pi * (0.005555555555555556 * angle)))))))
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) return Float64(180.0 * Float64(-1.0 / Float64(pi / atan(Float64(Float64(y_45_scale / x_45_scale) / tan(Float64(pi * Float64(0.005555555555555556 * angle)))))))) end
b_m = abs(b); function tmp = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 180.0 * (-1.0 / (pi / atan(((y_45_scale / x_45_scale) / tan((pi * (0.005555555555555556 * angle))))))); end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := N[(180.0 * N[(-1.0 / N[(Pi / N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] / N[Tan[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
180 \cdot \frac{-1}{\frac{\pi}{\tan^{-1} \left(\frac{\frac{y-scale}{x-scale}}{\tan \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)}\right)}}
\end{array}
Initial program 13.4%
Simplified13.3%
Taylor expanded in x-scale around 0 22.7%
Simplified28.5%
Taylor expanded in a around 0 45.5%
mul-1-neg45.5%
times-frac48.1%
Simplified48.1%
*-un-lft-identity48.1%
associate-*r*50.7%
*-commutative50.7%
Applied egg-rr50.7%
Applied egg-rr48.2%
unpow-148.2%
associate-*r/48.2%
*-rgt-identity48.2%
associate-*r*50.6%
Simplified50.6%
Final simplification50.6%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (/ (* (atan (/ (/ y-scale x-scale) (tan (* PI (* 0.005555555555555556 angle))))) -180.0) PI))
b_m = fabs(b);
double code(double a, double b_m, double angle, double x_45_scale, double y_45_scale) {
return (atan(((y_45_scale / x_45_scale) / tan((((double) M_PI) * (0.005555555555555556 * angle))))) * -180.0) / ((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 (Math.atan(((y_45_scale / x_45_scale) / Math.tan((Math.PI * (0.005555555555555556 * angle))))) * -180.0) / Math.PI;
}
b_m = math.fabs(b) def code(a, b_m, angle, x_45_scale, y_45_scale): return (math.atan(((y_45_scale / x_45_scale) / math.tan((math.pi * (0.005555555555555556 * angle))))) * -180.0) / math.pi
b_m = abs(b) function code(a, b_m, angle, x_45_scale, y_45_scale) return Float64(Float64(atan(Float64(Float64(y_45_scale / x_45_scale) / tan(Float64(pi * Float64(0.005555555555555556 * angle))))) * -180.0) / pi) end
b_m = abs(b); function tmp = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = (atan(((y_45_scale / x_45_scale) / tan((pi * (0.005555555555555556 * angle))))) * -180.0) / pi; end
b_m = N[Abs[b], $MachinePrecision] code[a_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] / N[Tan[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -180.0), $MachinePrecision] / Pi), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
\frac{\tan^{-1} \left(\frac{\frac{y-scale}{x-scale}}{\tan \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)}\right) \cdot -180}{\pi}
\end{array}
Initial program 13.4%
Simplified13.3%
Taylor expanded in x-scale around 0 22.7%
Simplified28.5%
Taylor expanded in a around 0 45.5%
mul-1-neg45.5%
times-frac48.1%
Simplified48.1%
*-un-lft-identity48.1%
associate-*r*50.7%
*-commutative50.7%
Applied egg-rr50.7%
associate-*r/50.7%
Applied egg-rr48.1%
distribute-rgt-neg-out48.1%
distribute-lft-neg-in48.1%
metadata-eval48.1%
associate-*r/48.1%
*-rgt-identity48.1%
associate-*r*50.6%
Simplified50.6%
Final simplification50.6%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (/ (* -180.0 (atan (/ (/ y-scale x-scale) (tan (* 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) / tan((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) / Math.tan((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) / math.tan((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(Float64(-180.0 * atan(Float64(Float64(y_45_scale / x_45_scale) / tan(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) / tan((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[(N[(-180.0 * N[ArcTan[N[(N[(y$45$scale / x$45$scale), $MachinePrecision] / N[Tan[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / Pi), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
\frac{-180 \cdot \tan^{-1} \left(\frac{\frac{y-scale}{x-scale}}{\tan \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right)}\right)}{\pi}
\end{array}
Initial program 13.4%
Simplified13.3%
Taylor expanded in x-scale around 0 22.7%
Simplified28.5%
Taylor expanded in a around 0 45.5%
mul-1-neg45.5%
times-frac48.1%
Simplified48.1%
associate-*r/48.1%
atan-neg48.1%
clear-num48.1%
quot-tan48.1%
associate-*r*50.6%
*-commutative50.6%
Applied egg-rr50.6%
distribute-rgt-neg-out50.6%
distribute-lft-neg-in50.6%
metadata-eval50.6%
associate-*r/50.6%
*-rgt-identity50.6%
*-commutative50.6%
associate-*r*48.1%
Simplified48.1%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* 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) {
return 180.0 * (atan(((y_45_scale / x_45_scale) * (-180.0 / (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) * (-180.0 / (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) * (-180.0 / (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(Float64(-180.0) / 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) * (-180.0 / (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[((-180.0) / 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 \frac{-180}{angle \cdot \pi}\right)}{\pi}
\end{array}
Initial program 13.4%
Simplified13.3%
Taylor expanded in x-scale around 0 22.7%
Simplified28.5%
Taylor expanded in a around 0 45.5%
mul-1-neg45.5%
times-frac48.1%
Simplified48.1%
Taylor expanded in angle around 0 39.2%
Final simplification39.2%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* 180.0 (/ (atan (* (/ y-scale (* x-scale PI)) (/ -180.0 angle))) 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 * ((double) M_PI))) * (-180.0 / angle))) / ((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 * Math.PI)) * (-180.0 / angle))) / 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 * math.pi)) * (-180.0 / angle))) / 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 / Float64(x_45_scale * pi)) * Float64(-180.0 / angle))) / 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 * pi)) * (-180.0 / angle))) / 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 / N[(x$45$scale * Pi), $MachinePrecision]), $MachinePrecision] * N[(-180.0 / angle), $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 \pi} \cdot \frac{-180}{angle}\right)}{\pi}
\end{array}
Initial program 13.4%
Simplified13.3%
Taylor expanded in x-scale around 0 22.7%
Simplified28.5%
Taylor expanded in a around 0 45.5%
mul-1-neg45.5%
times-frac48.1%
Simplified48.1%
*-un-lft-identity48.1%
associate-*r*50.7%
*-commutative50.7%
Applied egg-rr50.7%
Taylor expanded in angle around 0 36.6%
associate-*r*36.5%
associate-*r/36.6%
*-commutative36.6%
associate-*r*36.6%
*-commutative36.6%
times-frac39.2%
*-commutative39.2%
Simplified39.2%
Final simplification39.2%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* 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) {
return 180.0 * (atan((-180.0 * ((y_45_scale / angle) / (x_45_scale * ((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((-180.0 * ((y_45_scale / angle) / (x_45_scale * 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((-180.0 * ((y_45_scale / angle) / (x_45_scale * 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(-180.0 * Float64(Float64(y_45_scale / angle) / Float64(x_45_scale * pi)))) / pi)) end
b_m = abs(b); function tmp = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 180.0 * (atan((-180.0 * ((y_45_scale / angle) / (x_45_scale * 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[(-180.0 * N[(N[(y$45$scale / angle), $MachinePrecision] / N[(x$45$scale * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{\frac{y-scale}{angle}}{x-scale \cdot \pi}\right)}{\pi}
\end{array}
Initial program 13.4%
Simplified13.3%
Taylor expanded in x-scale around 0 22.7%
Simplified28.5%
Taylor expanded in a around 0 45.5%
mul-1-neg45.5%
times-frac48.1%
Simplified48.1%
Taylor expanded in angle around 0 36.6%
associate-/r*36.6%
*-commutative36.6%
Simplified36.6%
Final simplification36.6%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* 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) {
return 180.0 * (atan((-180.0 * (y_45_scale / (angle * (x_45_scale * ((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((-180.0 * (y_45_scale / (angle * (x_45_scale * 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((-180.0 * (y_45_scale / (angle * (x_45_scale * 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(-180.0 * Float64(y_45_scale / Float64(angle * Float64(x_45_scale * pi))))) / pi)) end
b_m = abs(b); function tmp = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 180.0 * (atan((-180.0 * (y_45_scale / (angle * (x_45_scale * 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[(-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|
\\
180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{y-scale}{angle \cdot \left(x-scale \cdot \pi\right)}\right)}{\pi}
\end{array}
Initial program 13.4%
Simplified13.3%
Taylor expanded in angle around 0 9.8%
times-frac8.9%
distribute-lft-out--8.9%
Simplified8.9%
Taylor expanded in a around 0 36.6%
b_m = (fabs.f64 b) (FPCore (a b_m angle x-scale y-scale) :precision binary64 (* 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) {
return 180.0 * (atan((-180.0 * (x_45_scale / (angle * (y_45_scale * ((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((-180.0 * (x_45_scale / (angle * (y_45_scale * 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((-180.0 * (x_45_scale / (angle * (y_45_scale * 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(-180.0 * Float64(x_45_scale / Float64(angle * Float64(y_45_scale * pi))))) / pi)) end
b_m = abs(b); function tmp = code(a, b_m, angle, x_45_scale, y_45_scale) tmp = 180.0 * (atan((-180.0 * (x_45_scale / (angle * (y_45_scale * 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[(-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|
\\
180 \cdot \frac{\tan^{-1} \left(-180 \cdot \frac{x-scale}{angle \cdot \left(y-scale \cdot \pi\right)}\right)}{\pi}
\end{array}
Initial program 13.4%
Simplified13.3%
Taylor expanded in angle around 0 9.8%
times-frac8.9%
distribute-lft-out--8.9%
Simplified8.9%
Taylor expanded in a around inf 13.4%
herbie shell --seed 2024169
(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)))