
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI))
(t_1 (sin t_0))
(t_2 (cos t_0))
(t_3
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale))
(t_4
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
(t_5 (* (* b a) (* b (- a))))
(t_6 (/ (* 4.0 t_5) (pow (* x-scale y-scale) 2.0))))
(/
(-
(sqrt
(*
(* (* 2.0 t_6) t_5)
(+
(+ t_4 t_3)
(sqrt
(+
(pow (- t_4 t_3) 2.0)
(pow
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
y-scale)
2.0)))))))
t_6)))
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 = sin(t_0);
double t_2 = cos(t_0);
double t_3 = ((pow((a * t_2), 2.0) + pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale;
double t_4 = ((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale;
double t_5 = (b * a) * (b * -a);
double t_6 = (4.0 * t_5) / pow((x_45_scale * y_45_scale), 2.0);
return -sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + sqrt((pow((t_4 - t_3), 2.0) + pow((((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale), 2.0)))))) / t_6;
}
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.sin(t_0);
double t_2 = Math.cos(t_0);
double t_3 = ((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale;
double t_4 = ((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale;
double t_5 = (b * a) * (b * -a);
double t_6 = (4.0 * t_5) / Math.pow((x_45_scale * y_45_scale), 2.0);
return -Math.sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + Math.sqrt((Math.pow((t_4 - t_3), 2.0) + Math.pow((((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale), 2.0)))))) / t_6;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (angle / 180.0) * math.pi t_1 = math.sin(t_0) t_2 = math.cos(t_0) t_3 = ((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale t_4 = ((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale t_5 = (b * a) * (b * -a) t_6 = (4.0 * t_5) / math.pow((x_45_scale * y_45_scale), 2.0) return -math.sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + math.sqrt((math.pow((t_4 - t_3), 2.0) + math.pow((((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale), 2.0)))))) / t_6
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(angle / 180.0) * pi) t_1 = sin(t_0) t_2 = cos(t_0) t_3 = Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale) t_4 = Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale) t_5 = Float64(Float64(b * a) * Float64(b * Float64(-a))) t_6 = Float64(Float64(4.0 * t_5) / (Float64(x_45_scale * y_45_scale) ^ 2.0)) return Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * t_6) * t_5) * Float64(Float64(t_4 + t_3) + sqrt(Float64((Float64(t_4 - t_3) ^ 2.0) + (Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale) ^ 2.0))))))) / t_6) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (angle / 180.0) * pi; t_1 = sin(t_0); t_2 = cos(t_0); t_3 = ((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale; t_4 = ((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale; t_5 = (b * a) * (b * -a); t_6 = (4.0 * t_5) / ((x_45_scale * y_45_scale) ^ 2.0); tmp = -sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + sqrt((((t_4 - t_3) ^ 2.0) + ((((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale) ^ 2.0)))))) / t_6; 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[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$3 = 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] / y$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] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]}, Block[{t$95$5 = N[(N[(b * a), $MachinePrecision] * N[(b * (-a)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(4.0 * t$95$5), $MachinePrecision] / N[Power[N[(x$45$scale * y$45$scale), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(N[(2.0 * t$95$6), $MachinePrecision] * t$95$5), $MachinePrecision] * N[(N[(t$95$4 + t$95$3), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(t$95$4 - t$95$3), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$6), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := \sin t\_0\\
t_2 := \cos t\_0\\
t_3 := \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale}\\
t_4 := \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\\
t_5 := \left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\\
t_6 := \frac{4 \cdot t\_5}{{\left(x-scale \cdot y-scale\right)}^{2}}\\
\frac{-\sqrt{\left(\left(2 \cdot t\_6\right) \cdot t\_5\right) \cdot \left(\left(t\_4 + t\_3\right) + \sqrt{{\left(t\_4 - t\_3\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\right)}^{2}}\right)}}{t\_6}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (/ angle 180.0) PI))
(t_1 (sin t_0))
(t_2 (cos t_0))
(t_3
(/ (/ (+ (pow (* a t_2) 2.0) (pow (* b t_1) 2.0)) y-scale) y-scale))
(t_4
(/ (/ (+ (pow (* a t_1) 2.0) (pow (* b t_2) 2.0)) x-scale) x-scale))
(t_5 (* (* b a) (* b (- a))))
(t_6 (/ (* 4.0 t_5) (pow (* x-scale y-scale) 2.0))))
(/
(-
(sqrt
(*
(* (* 2.0 t_6) t_5)
(+
(+ t_4 t_3)
(sqrt
(+
(pow (- t_4 t_3) 2.0)
(pow
(/
(/ (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) t_1) t_2) x-scale)
y-scale)
2.0)))))))
t_6)))
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 = sin(t_0);
double t_2 = cos(t_0);
double t_3 = ((pow((a * t_2), 2.0) + pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale;
double t_4 = ((pow((a * t_1), 2.0) + pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale;
double t_5 = (b * a) * (b * -a);
double t_6 = (4.0 * t_5) / pow((x_45_scale * y_45_scale), 2.0);
return -sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + sqrt((pow((t_4 - t_3), 2.0) + pow((((((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale), 2.0)))))) / t_6;
}
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.sin(t_0);
double t_2 = Math.cos(t_0);
double t_3 = ((Math.pow((a * t_2), 2.0) + Math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale;
double t_4 = ((Math.pow((a * t_1), 2.0) + Math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale;
double t_5 = (b * a) * (b * -a);
double t_6 = (4.0 * t_5) / Math.pow((x_45_scale * y_45_scale), 2.0);
return -Math.sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + Math.sqrt((Math.pow((t_4 - t_3), 2.0) + Math.pow((((((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale), 2.0)))))) / t_6;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (angle / 180.0) * math.pi t_1 = math.sin(t_0) t_2 = math.cos(t_0) t_3 = ((math.pow((a * t_2), 2.0) + math.pow((b * t_1), 2.0)) / y_45_scale) / y_45_scale t_4 = ((math.pow((a * t_1), 2.0) + math.pow((b * t_2), 2.0)) / x_45_scale) / x_45_scale t_5 = (b * a) * (b * -a) t_6 = (4.0 * t_5) / math.pow((x_45_scale * y_45_scale), 2.0) return -math.sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + math.sqrt((math.pow((t_4 - t_3), 2.0) + math.pow((((((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale), 2.0)))))) / t_6
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(angle / 180.0) * pi) t_1 = sin(t_0) t_2 = cos(t_0) t_3 = Float64(Float64(Float64((Float64(a * t_2) ^ 2.0) + (Float64(b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale) t_4 = Float64(Float64(Float64((Float64(a * t_1) ^ 2.0) + (Float64(b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale) t_5 = Float64(Float64(b * a) * Float64(b * Float64(-a))) t_6 = Float64(Float64(4.0 * t_5) / (Float64(x_45_scale * y_45_scale) ^ 2.0)) return Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * t_6) * t_5) * Float64(Float64(t_4 + t_3) + sqrt(Float64((Float64(t_4 - t_3) ^ 2.0) + (Float64(Float64(Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale) ^ 2.0))))))) / t_6) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (angle / 180.0) * pi; t_1 = sin(t_0); t_2 = cos(t_0); t_3 = ((((a * t_2) ^ 2.0) + ((b * t_1) ^ 2.0)) / y_45_scale) / y_45_scale; t_4 = ((((a * t_1) ^ 2.0) + ((b * t_2) ^ 2.0)) / x_45_scale) / x_45_scale; t_5 = (b * a) * (b * -a); t_6 = (4.0 * t_5) / ((x_45_scale * y_45_scale) ^ 2.0); tmp = -sqrt((((2.0 * t_6) * t_5) * ((t_4 + t_3) + sqrt((((t_4 - t_3) ^ 2.0) + ((((((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * t_1) * t_2) / x_45_scale) / y_45_scale) ^ 2.0)))))) / t_6; 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[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$3 = 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] / y$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] / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]}, Block[{t$95$5 = N[(N[(b * a), $MachinePrecision] * N[(b * (-a)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(4.0 * t$95$5), $MachinePrecision] / N[Power[N[(x$45$scale * y$45$scale), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(N[(2.0 * t$95$6), $MachinePrecision] * t$95$5), $MachinePrecision] * N[(N[(t$95$4 + t$95$3), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(t$95$4 - t$95$3), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(N[(N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] / x$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$6), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{angle}{180} \cdot \pi\\
t_1 := \sin t\_0\\
t_2 := \cos t\_0\\
t_3 := \frac{\frac{{\left(a \cdot t\_2\right)}^{2} + {\left(b \cdot t\_1\right)}^{2}}{y-scale}}{y-scale}\\
t_4 := \frac{\frac{{\left(a \cdot t\_1\right)}^{2} + {\left(b \cdot t\_2\right)}^{2}}{x-scale}}{x-scale}\\
t_5 := \left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\\
t_6 := \frac{4 \cdot t\_5}{{\left(x-scale \cdot y-scale\right)}^{2}}\\
\frac{-\sqrt{\left(\left(2 \cdot t\_6\right) \cdot t\_5\right) \cdot \left(\left(t\_4 + t\_3\right) + \sqrt{{\left(t\_4 - t\_3\right)}^{2} + {\left(\frac{\frac{\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot t\_1\right) \cdot t\_2}{x-scale}}{y-scale}\right)}^{2}}\right)}}{t\_6}
\end{array}
\end{array}
x-scale_m = (fabs.f64 x-scale)
y-scale_m = (fabs.f64 y-scale)
(FPCore (a b angle x-scale_m y-scale_m)
:precision binary64
(let* ((t_0 (* x-scale_m (sqrt 8.0)))
(t_1 (* 0.005555555555555556 (* angle PI)))
(t_2 (sin t_1))
(t_3 (hypot (* a (cos t_1)) (* t_2 b))))
(if (<= x-scale_m 40.0)
(*
0.25
(*
y-scale_m
(*
(sqrt 8.0)
(* (pow 2.0 0.25) (* (pow 2.0 0.25) (hypot (* a t_2) b))))))
(if (<= x-scale_m 2.6e+54)
(* 0.25 (* t_0 (sqrt (* 2.0 (pow t_3 2.0)))))
(* 0.25 (* t_0 (* t_3 (sqrt 2.0))))))))x-scale_m = fabs(x_45_scale);
y-scale_m = fabs(y_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
double t_0 = x_45_scale_m * sqrt(8.0);
double t_1 = 0.005555555555555556 * (angle * ((double) M_PI));
double t_2 = sin(t_1);
double t_3 = hypot((a * cos(t_1)), (t_2 * b));
double tmp;
if (x_45_scale_m <= 40.0) {
tmp = 0.25 * (y_45_scale_m * (sqrt(8.0) * (pow(2.0, 0.25) * (pow(2.0, 0.25) * hypot((a * t_2), b)))));
} else if (x_45_scale_m <= 2.6e+54) {
tmp = 0.25 * (t_0 * sqrt((2.0 * pow(t_3, 2.0))));
} else {
tmp = 0.25 * (t_0 * (t_3 * sqrt(2.0)));
}
return tmp;
}
x-scale_m = Math.abs(x_45_scale);
y-scale_m = Math.abs(y_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
double t_0 = x_45_scale_m * Math.sqrt(8.0);
double t_1 = 0.005555555555555556 * (angle * Math.PI);
double t_2 = Math.sin(t_1);
double t_3 = Math.hypot((a * Math.cos(t_1)), (t_2 * b));
double tmp;
if (x_45_scale_m <= 40.0) {
tmp = 0.25 * (y_45_scale_m * (Math.sqrt(8.0) * (Math.pow(2.0, 0.25) * (Math.pow(2.0, 0.25) * Math.hypot((a * t_2), b)))));
} else if (x_45_scale_m <= 2.6e+54) {
tmp = 0.25 * (t_0 * Math.sqrt((2.0 * Math.pow(t_3, 2.0))));
} else {
tmp = 0.25 * (t_0 * (t_3 * Math.sqrt(2.0)));
}
return tmp;
}
x-scale_m = math.fabs(x_45_scale) y-scale_m = math.fabs(y_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale_m): t_0 = x_45_scale_m * math.sqrt(8.0) t_1 = 0.005555555555555556 * (angle * math.pi) t_2 = math.sin(t_1) t_3 = math.hypot((a * math.cos(t_1)), (t_2 * b)) tmp = 0 if x_45_scale_m <= 40.0: tmp = 0.25 * (y_45_scale_m * (math.sqrt(8.0) * (math.pow(2.0, 0.25) * (math.pow(2.0, 0.25) * math.hypot((a * t_2), b))))) elif x_45_scale_m <= 2.6e+54: tmp = 0.25 * (t_0 * math.sqrt((2.0 * math.pow(t_3, 2.0)))) else: tmp = 0.25 * (t_0 * (t_3 * math.sqrt(2.0))) return tmp
x-scale_m = abs(x_45_scale) y-scale_m = abs(y_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale_m) t_0 = Float64(x_45_scale_m * sqrt(8.0)) t_1 = Float64(0.005555555555555556 * Float64(angle * pi)) t_2 = sin(t_1) t_3 = hypot(Float64(a * cos(t_1)), Float64(t_2 * b)) tmp = 0.0 if (x_45_scale_m <= 40.0) tmp = Float64(0.25 * Float64(y_45_scale_m * Float64(sqrt(8.0) * Float64((2.0 ^ 0.25) * Float64((2.0 ^ 0.25) * hypot(Float64(a * t_2), b)))))); elseif (x_45_scale_m <= 2.6e+54) tmp = Float64(0.25 * Float64(t_0 * sqrt(Float64(2.0 * (t_3 ^ 2.0))))); else tmp = Float64(0.25 * Float64(t_0 * Float64(t_3 * sqrt(2.0)))); end return tmp end
x-scale_m = abs(x_45_scale); y-scale_m = abs(y_45_scale); function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale_m) t_0 = x_45_scale_m * sqrt(8.0); t_1 = 0.005555555555555556 * (angle * pi); t_2 = sin(t_1); t_3 = hypot((a * cos(t_1)), (t_2 * b)); tmp = 0.0; if (x_45_scale_m <= 40.0) tmp = 0.25 * (y_45_scale_m * (sqrt(8.0) * ((2.0 ^ 0.25) * ((2.0 ^ 0.25) * hypot((a * t_2), b))))); elseif (x_45_scale_m <= 2.6e+54) tmp = 0.25 * (t_0 * sqrt((2.0 * (t_3 ^ 2.0)))); else tmp = 0.25 * (t_0 * (t_3 * sqrt(2.0))); end tmp_2 = tmp; end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision]
y-scale_m = N[Abs[y$45$scale], $MachinePrecision]
code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale$95$m_] := Block[{t$95$0 = N[(x$45$scale$95$m * N[Sqrt[8.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(a * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(t$95$2 * b), $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[x$45$scale$95$m, 40.0], N[(0.25 * N[(y$45$scale$95$m * N[(N[Sqrt[8.0], $MachinePrecision] * N[(N[Power[2.0, 0.25], $MachinePrecision] * N[(N[Power[2.0, 0.25], $MachinePrecision] * N[Sqrt[N[(a * t$95$2), $MachinePrecision] ^ 2 + b ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$45$scale$95$m, 2.6e+54], N[(0.25 * N[(t$95$0 * N[Sqrt[N[(2.0 * N[Power[t$95$3, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(t$95$0 * N[(t$95$3 * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
y-scale_m = \left|y-scale\right|
\\
\begin{array}{l}
t_0 := x-scale\_m \cdot \sqrt{8}\\
t_1 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
t_2 := \sin t\_1\\
t_3 := \mathsf{hypot}\left(a \cdot \cos t\_1, t\_2 \cdot b\right)\\
\mathbf{if}\;x-scale\_m \leq 40:\\
\;\;\;\;0.25 \cdot \left(y-scale\_m \cdot \left(\sqrt{8} \cdot \left({2}^{0.25} \cdot \left({2}^{0.25} \cdot \mathsf{hypot}\left(a \cdot t\_2, b\right)\right)\right)\right)\right)\\
\mathbf{elif}\;x-scale\_m \leq 2.6 \cdot 10^{+54}:\\
\;\;\;\;0.25 \cdot \left(t\_0 \cdot \sqrt{2 \cdot {t\_3}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(t\_0 \cdot \left(t\_3 \cdot \sqrt{2}\right)\right)\\
\end{array}
\end{array}
if x-scale < 40Initial program 3.3%
Simplified3.3%
Taylor expanded in x-scale around 0 27.5%
Simplified28.7%
Taylor expanded in angle around 0 28.7%
add-sqr-sqrt28.7%
pow228.7%
Applied egg-rr28.7%
Applied egg-rr29.5%
if 40 < x-scale < 2.60000000000000007e54Initial program 0.4%
Simplified0.4%
Taylor expanded in y-scale around 0 28.9%
Taylor expanded in x-scale around 0 50.3%
Simplified59.0%
if 2.60000000000000007e54 < x-scale Initial program 0.3%
Simplified0.3%
Taylor expanded in y-scale around 0 27.9%
Simplified31.6%
Applied egg-rr30.1%
unpow130.1%
associate-*l*32.0%
Simplified32.0%
Taylor expanded in x-scale around 0 74.8%
*-commutative74.8%
Simplified74.8%
Final simplification40.9%
x-scale_m = (fabs.f64 x-scale)
y-scale_m = (fabs.f64 y-scale)
(FPCore (a b angle x-scale_m y-scale_m)
:precision binary64
(let* ((t_0 (* 0.005555555555555556 (* angle PI))) (t_1 (sin t_0)))
(if (<= x-scale_m 0.21)
(*
0.25
(*
y-scale_m
(*
(sqrt 8.0)
(* (pow 2.0 0.25) (* (pow 2.0 0.25) (hypot (* a t_1) b))))))
(if (or (<= x-scale_m 2.65e+67) (not (<= x-scale_m 7.5e+68)))
(*
0.25
(*
(* x-scale_m (sqrt 8.0))
(* (hypot (* a (cos t_0)) (* t_1 b)) (sqrt 2.0))))
(log1p (expm1 (* 0.25 (* b (* y-scale_m 4.0)))))))))x-scale_m = fabs(x_45_scale);
y-scale_m = fabs(y_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
double t_0 = 0.005555555555555556 * (angle * ((double) M_PI));
double t_1 = sin(t_0);
double tmp;
if (x_45_scale_m <= 0.21) {
tmp = 0.25 * (y_45_scale_m * (sqrt(8.0) * (pow(2.0, 0.25) * (pow(2.0, 0.25) * hypot((a * t_1), b)))));
} else if ((x_45_scale_m <= 2.65e+67) || !(x_45_scale_m <= 7.5e+68)) {
tmp = 0.25 * ((x_45_scale_m * sqrt(8.0)) * (hypot((a * cos(t_0)), (t_1 * b)) * sqrt(2.0)));
} else {
tmp = log1p(expm1((0.25 * (b * (y_45_scale_m * 4.0)))));
}
return tmp;
}
x-scale_m = Math.abs(x_45_scale);
y-scale_m = Math.abs(y_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
double t_0 = 0.005555555555555556 * (angle * Math.PI);
double t_1 = Math.sin(t_0);
double tmp;
if (x_45_scale_m <= 0.21) {
tmp = 0.25 * (y_45_scale_m * (Math.sqrt(8.0) * (Math.pow(2.0, 0.25) * (Math.pow(2.0, 0.25) * Math.hypot((a * t_1), b)))));
} else if ((x_45_scale_m <= 2.65e+67) || !(x_45_scale_m <= 7.5e+68)) {
tmp = 0.25 * ((x_45_scale_m * Math.sqrt(8.0)) * (Math.hypot((a * Math.cos(t_0)), (t_1 * b)) * Math.sqrt(2.0)));
} else {
tmp = Math.log1p(Math.expm1((0.25 * (b * (y_45_scale_m * 4.0)))));
}
return tmp;
}
x-scale_m = math.fabs(x_45_scale) y-scale_m = math.fabs(y_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale_m): t_0 = 0.005555555555555556 * (angle * math.pi) t_1 = math.sin(t_0) tmp = 0 if x_45_scale_m <= 0.21: tmp = 0.25 * (y_45_scale_m * (math.sqrt(8.0) * (math.pow(2.0, 0.25) * (math.pow(2.0, 0.25) * math.hypot((a * t_1), b))))) elif (x_45_scale_m <= 2.65e+67) or not (x_45_scale_m <= 7.5e+68): tmp = 0.25 * ((x_45_scale_m * math.sqrt(8.0)) * (math.hypot((a * math.cos(t_0)), (t_1 * b)) * math.sqrt(2.0))) else: tmp = math.log1p(math.expm1((0.25 * (b * (y_45_scale_m * 4.0))))) return tmp
x-scale_m = abs(x_45_scale) y-scale_m = abs(y_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale_m) t_0 = Float64(0.005555555555555556 * Float64(angle * pi)) t_1 = sin(t_0) tmp = 0.0 if (x_45_scale_m <= 0.21) tmp = Float64(0.25 * Float64(y_45_scale_m * Float64(sqrt(8.0) * Float64((2.0 ^ 0.25) * Float64((2.0 ^ 0.25) * hypot(Float64(a * t_1), b)))))); elseif ((x_45_scale_m <= 2.65e+67) || !(x_45_scale_m <= 7.5e+68)) tmp = Float64(0.25 * Float64(Float64(x_45_scale_m * sqrt(8.0)) * Float64(hypot(Float64(a * cos(t_0)), Float64(t_1 * b)) * sqrt(2.0)))); else tmp = log1p(expm1(Float64(0.25 * Float64(b * Float64(y_45_scale_m * 4.0))))); end return tmp end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision]
y-scale_m = N[Abs[y$45$scale], $MachinePrecision]
code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale$95$m_] := Block[{t$95$0 = N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, If[LessEqual[x$45$scale$95$m, 0.21], N[(0.25 * N[(y$45$scale$95$m * N[(N[Sqrt[8.0], $MachinePrecision] * N[(N[Power[2.0, 0.25], $MachinePrecision] * N[(N[Power[2.0, 0.25], $MachinePrecision] * N[Sqrt[N[(a * t$95$1), $MachinePrecision] ^ 2 + b ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x$45$scale$95$m, 2.65e+67], N[Not[LessEqual[x$45$scale$95$m, 7.5e+68]], $MachinePrecision]], N[(0.25 * N[(N[(x$45$scale$95$m * N[Sqrt[8.0], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(a * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2 + N[(t$95$1 * b), $MachinePrecision] ^ 2], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[1 + N[(Exp[N[(0.25 * N[(b * N[(y$45$scale$95$m * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
y-scale_m = \left|y-scale\right|
\\
\begin{array}{l}
t_0 := 0.005555555555555556 \cdot \left(angle \cdot \pi\right)\\
t_1 := \sin t\_0\\
\mathbf{if}\;x-scale\_m \leq 0.21:\\
\;\;\;\;0.25 \cdot \left(y-scale\_m \cdot \left(\sqrt{8} \cdot \left({2}^{0.25} \cdot \left({2}^{0.25} \cdot \mathsf{hypot}\left(a \cdot t\_1, b\right)\right)\right)\right)\right)\\
\mathbf{elif}\;x-scale\_m \leq 2.65 \cdot 10^{+67} \lor \neg \left(x-scale\_m \leq 7.5 \cdot 10^{+68}\right):\\
\;\;\;\;0.25 \cdot \left(\left(x-scale\_m \cdot \sqrt{8}\right) \cdot \left(\mathsf{hypot}\left(a \cdot \cos t\_0, t\_1 \cdot b\right) \cdot \sqrt{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(0.25 \cdot \left(b \cdot \left(y-scale\_m \cdot 4\right)\right)\right)\right)\\
\end{array}
\end{array}
if x-scale < 0.209999999999999992Initial program 3.4%
Simplified3.3%
Taylor expanded in x-scale around 0 27.6%
Simplified28.8%
Taylor expanded in angle around 0 28.8%
add-sqr-sqrt28.9%
pow228.9%
Applied egg-rr28.9%
Applied egg-rr29.6%
if 0.209999999999999992 < x-scale < 2.65e67 or 7.49999999999999959e68 < x-scale Initial program 0.3%
Simplified0.3%
Taylor expanded in y-scale around 0 28.2%
Simplified31.2%
Applied egg-rr30.0%
unpow130.0%
associate-*l*33.0%
Simplified33.0%
Taylor expanded in x-scale around 0 71.1%
*-commutative71.1%
Simplified71.1%
if 2.65e67 < x-scale < 7.49999999999999959e68Initial program 0.0%
Simplified0.0%
Taylor expanded in angle around 0 3.2%
*-commutative3.2%
Simplified3.2%
log1p-expm1-u100.0%
*-commutative100.0%
sqrt-unprod100.0%
metadata-eval100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Final simplification40.9%
x-scale_m = (fabs.f64 x-scale)
y-scale_m = (fabs.f64 y-scale)
(FPCore (a b angle x-scale_m y-scale_m)
:precision binary64
(if (<= x-scale_m 2.65e+48)
(*
0.25
(*
y-scale_m
(*
(sqrt 8.0)
(*
(pow 2.0 0.25)
(*
(pow 2.0 0.25)
(hypot (* a (sin (* 0.005555555555555556 (* angle PI)))) b))))))
(* 0.25 (* (* x-scale_m a) (* (sqrt 8.0) (sqrt 2.0))))))x-scale_m = fabs(x_45_scale);
y-scale_m = fabs(y_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
double tmp;
if (x_45_scale_m <= 2.65e+48) {
tmp = 0.25 * (y_45_scale_m * (sqrt(8.0) * (pow(2.0, 0.25) * (pow(2.0, 0.25) * hypot((a * sin((0.005555555555555556 * (angle * ((double) M_PI))))), b)))));
} else {
tmp = 0.25 * ((x_45_scale_m * a) * (sqrt(8.0) * sqrt(2.0)));
}
return tmp;
}
x-scale_m = Math.abs(x_45_scale);
y-scale_m = Math.abs(y_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
double tmp;
if (x_45_scale_m <= 2.65e+48) {
tmp = 0.25 * (y_45_scale_m * (Math.sqrt(8.0) * (Math.pow(2.0, 0.25) * (Math.pow(2.0, 0.25) * Math.hypot((a * Math.sin((0.005555555555555556 * (angle * Math.PI)))), b)))));
} else {
tmp = 0.25 * ((x_45_scale_m * a) * (Math.sqrt(8.0) * Math.sqrt(2.0)));
}
return tmp;
}
x-scale_m = math.fabs(x_45_scale) y-scale_m = math.fabs(y_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale_m): tmp = 0 if x_45_scale_m <= 2.65e+48: tmp = 0.25 * (y_45_scale_m * (math.sqrt(8.0) * (math.pow(2.0, 0.25) * (math.pow(2.0, 0.25) * math.hypot((a * math.sin((0.005555555555555556 * (angle * math.pi)))), b))))) else: tmp = 0.25 * ((x_45_scale_m * a) * (math.sqrt(8.0) * math.sqrt(2.0))) return tmp
x-scale_m = abs(x_45_scale) y-scale_m = abs(y_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale_m) tmp = 0.0 if (x_45_scale_m <= 2.65e+48) tmp = Float64(0.25 * Float64(y_45_scale_m * Float64(sqrt(8.0) * Float64((2.0 ^ 0.25) * Float64((2.0 ^ 0.25) * hypot(Float64(a * sin(Float64(0.005555555555555556 * Float64(angle * pi)))), b)))))); else tmp = Float64(0.25 * Float64(Float64(x_45_scale_m * a) * Float64(sqrt(8.0) * sqrt(2.0)))); end return tmp end
x-scale_m = abs(x_45_scale); y-scale_m = abs(y_45_scale); function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale_m) tmp = 0.0; if (x_45_scale_m <= 2.65e+48) tmp = 0.25 * (y_45_scale_m * (sqrt(8.0) * ((2.0 ^ 0.25) * ((2.0 ^ 0.25) * hypot((a * sin((0.005555555555555556 * (angle * pi)))), b))))); else tmp = 0.25 * ((x_45_scale_m * a) * (sqrt(8.0) * sqrt(2.0))); end tmp_2 = tmp; end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision] y-scale_m = N[Abs[y$45$scale], $MachinePrecision] code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale$95$m_] := If[LessEqual[x$45$scale$95$m, 2.65e+48], N[(0.25 * N[(y$45$scale$95$m * N[(N[Sqrt[8.0], $MachinePrecision] * N[(N[Power[2.0, 0.25], $MachinePrecision] * N[(N[Power[2.0, 0.25], $MachinePrecision] * N[Sqrt[N[(a * N[Sin[N[(0.005555555555555556 * N[(angle * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2 + b ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(x$45$scale$95$m * a), $MachinePrecision] * N[(N[Sqrt[8.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
y-scale_m = \left|y-scale\right|
\\
\begin{array}{l}
\mathbf{if}\;x-scale\_m \leq 2.65 \cdot 10^{+48}:\\
\;\;\;\;0.25 \cdot \left(y-scale\_m \cdot \left(\sqrt{8} \cdot \left({2}^{0.25} \cdot \left({2}^{0.25} \cdot \mathsf{hypot}\left(a \cdot \sin \left(0.005555555555555556 \cdot \left(angle \cdot \pi\right)\right), b\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(x-scale\_m \cdot a\right) \cdot \left(\sqrt{8} \cdot \sqrt{2}\right)\right)\\
\end{array}
\end{array}
if x-scale < 2.65e48Initial program 3.2%
Simplified3.2%
Taylor expanded in x-scale around 0 26.8%
Simplified28.4%
Taylor expanded in angle around 0 28.4%
add-sqr-sqrt28.4%
pow228.4%
Applied egg-rr28.4%
Applied egg-rr29.1%
if 2.65e48 < x-scale Initial program 0.3%
Simplified0.3%
Taylor expanded in y-scale around 0 29.2%
Simplified32.7%
distribute-lft-in32.7%
unpow-prod-down32.7%
unpow-prod-down30.9%
add-exp-log30.7%
Applied egg-rr32.7%
Taylor expanded in angle around 0 28.0%
associate-*r*28.0%
Simplified28.0%
Final simplification28.9%
x-scale_m = (fabs.f64 x-scale)
y-scale_m = (fabs.f64 y-scale)
(FPCore (a b angle x-scale_m y-scale_m)
:precision binary64
(if (<= x-scale_m 5.4e+45)
(*
0.25
(*
y-scale_m
(*
(sqrt 8.0)
(*
(sqrt 2.0)
(hypot (* a (sin (* angle (* 0.005555555555555556 PI)))) b)))))
(* 0.25 (* (* x-scale_m a) (* (sqrt 8.0) (sqrt 2.0))))))x-scale_m = fabs(x_45_scale);
y-scale_m = fabs(y_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
double tmp;
if (x_45_scale_m <= 5.4e+45) {
tmp = 0.25 * (y_45_scale_m * (sqrt(8.0) * (sqrt(2.0) * hypot((a * sin((angle * (0.005555555555555556 * ((double) M_PI))))), b))));
} else {
tmp = 0.25 * ((x_45_scale_m * a) * (sqrt(8.0) * sqrt(2.0)));
}
return tmp;
}
x-scale_m = Math.abs(x_45_scale);
y-scale_m = Math.abs(y_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
double tmp;
if (x_45_scale_m <= 5.4e+45) {
tmp = 0.25 * (y_45_scale_m * (Math.sqrt(8.0) * (Math.sqrt(2.0) * Math.hypot((a * Math.sin((angle * (0.005555555555555556 * Math.PI)))), b))));
} else {
tmp = 0.25 * ((x_45_scale_m * a) * (Math.sqrt(8.0) * Math.sqrt(2.0)));
}
return tmp;
}
x-scale_m = math.fabs(x_45_scale) y-scale_m = math.fabs(y_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale_m): tmp = 0 if x_45_scale_m <= 5.4e+45: tmp = 0.25 * (y_45_scale_m * (math.sqrt(8.0) * (math.sqrt(2.0) * math.hypot((a * math.sin((angle * (0.005555555555555556 * math.pi)))), b)))) else: tmp = 0.25 * ((x_45_scale_m * a) * (math.sqrt(8.0) * math.sqrt(2.0))) return tmp
x-scale_m = abs(x_45_scale) y-scale_m = abs(y_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale_m) tmp = 0.0 if (x_45_scale_m <= 5.4e+45) tmp = Float64(0.25 * Float64(y_45_scale_m * Float64(sqrt(8.0) * Float64(sqrt(2.0) * hypot(Float64(a * sin(Float64(angle * Float64(0.005555555555555556 * pi)))), b))))); else tmp = Float64(0.25 * Float64(Float64(x_45_scale_m * a) * Float64(sqrt(8.0) * sqrt(2.0)))); end return tmp end
x-scale_m = abs(x_45_scale); y-scale_m = abs(y_45_scale); function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale_m) tmp = 0.0; if (x_45_scale_m <= 5.4e+45) tmp = 0.25 * (y_45_scale_m * (sqrt(8.0) * (sqrt(2.0) * hypot((a * sin((angle * (0.005555555555555556 * pi)))), b)))); else tmp = 0.25 * ((x_45_scale_m * a) * (sqrt(8.0) * sqrt(2.0))); end tmp_2 = tmp; end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision] y-scale_m = N[Abs[y$45$scale], $MachinePrecision] code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale$95$m_] := If[LessEqual[x$45$scale$95$m, 5.4e+45], N[(0.25 * N[(y$45$scale$95$m * N[(N[Sqrt[8.0], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(a * N[Sin[N[(angle * N[(0.005555555555555556 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2 + b ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(x$45$scale$95$m * a), $MachinePrecision] * N[(N[Sqrt[8.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
y-scale_m = \left|y-scale\right|
\\
\begin{array}{l}
\mathbf{if}\;x-scale\_m \leq 5.4 \cdot 10^{+45}:\\
\;\;\;\;0.25 \cdot \left(y-scale\_m \cdot \left(\sqrt{8} \cdot \left(\sqrt{2} \cdot \mathsf{hypot}\left(a \cdot \sin \left(angle \cdot \left(0.005555555555555556 \cdot \pi\right)\right), b\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(x-scale\_m \cdot a\right) \cdot \left(\sqrt{8} \cdot \sqrt{2}\right)\right)\\
\end{array}
\end{array}
if x-scale < 5.39999999999999968e45Initial program 3.2%
Simplified3.2%
Taylor expanded in x-scale around 0 26.8%
Simplified28.4%
Taylor expanded in angle around 0 28.4%
add-cube-cbrt28.4%
pow228.4%
Applied egg-rr28.4%
*-commutative28.4%
sqrt-prod28.3%
Applied egg-rr29.1%
if 5.39999999999999968e45 < x-scale Initial program 0.3%
Simplified0.3%
Taylor expanded in y-scale around 0 29.2%
Simplified32.7%
distribute-lft-in32.7%
unpow-prod-down32.7%
unpow-prod-down30.9%
add-exp-log30.7%
Applied egg-rr32.7%
Taylor expanded in angle around 0 28.0%
associate-*r*28.0%
Simplified28.0%
Final simplification28.8%
x-scale_m = (fabs.f64 x-scale)
y-scale_m = (fabs.f64 y-scale)
(FPCore (a b angle x-scale_m y-scale_m)
:precision binary64
(let* ((t_0 (* (sqrt 8.0) (sqrt 2.0))))
(if (<= x-scale_m 1.15e+49)
(*
0.25
(*
y-scale_m
(*
(sqrt 8.0)
(*
(sqrt 2.0)
(hypot b (* a (sin (* PI (* 0.005555555555555556 angle)))))))))
(if (<= x-scale_m 4.5e+86)
(* (* 0.25 a) (* x-scale_m t_0))
(if (<= x-scale_m 6.5e+91)
(* 0.25 (* b (* y-scale_m 4.0)))
(* 0.25 (* (* x-scale_m a) t_0)))))))x-scale_m = fabs(x_45_scale);
y-scale_m = fabs(y_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
double t_0 = sqrt(8.0) * sqrt(2.0);
double tmp;
if (x_45_scale_m <= 1.15e+49) {
tmp = 0.25 * (y_45_scale_m * (sqrt(8.0) * (sqrt(2.0) * hypot(b, (a * sin((((double) M_PI) * (0.005555555555555556 * angle))))))));
} else if (x_45_scale_m <= 4.5e+86) {
tmp = (0.25 * a) * (x_45_scale_m * t_0);
} else if (x_45_scale_m <= 6.5e+91) {
tmp = 0.25 * (b * (y_45_scale_m * 4.0));
} else {
tmp = 0.25 * ((x_45_scale_m * a) * t_0);
}
return tmp;
}
x-scale_m = Math.abs(x_45_scale);
y-scale_m = Math.abs(y_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
double t_0 = Math.sqrt(8.0) * Math.sqrt(2.0);
double tmp;
if (x_45_scale_m <= 1.15e+49) {
tmp = 0.25 * (y_45_scale_m * (Math.sqrt(8.0) * (Math.sqrt(2.0) * Math.hypot(b, (a * Math.sin((Math.PI * (0.005555555555555556 * angle))))))));
} else if (x_45_scale_m <= 4.5e+86) {
tmp = (0.25 * a) * (x_45_scale_m * t_0);
} else if (x_45_scale_m <= 6.5e+91) {
tmp = 0.25 * (b * (y_45_scale_m * 4.0));
} else {
tmp = 0.25 * ((x_45_scale_m * a) * t_0);
}
return tmp;
}
x-scale_m = math.fabs(x_45_scale) y-scale_m = math.fabs(y_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale_m): t_0 = math.sqrt(8.0) * math.sqrt(2.0) tmp = 0 if x_45_scale_m <= 1.15e+49: tmp = 0.25 * (y_45_scale_m * (math.sqrt(8.0) * (math.sqrt(2.0) * math.hypot(b, (a * math.sin((math.pi * (0.005555555555555556 * angle)))))))) elif x_45_scale_m <= 4.5e+86: tmp = (0.25 * a) * (x_45_scale_m * t_0) elif x_45_scale_m <= 6.5e+91: tmp = 0.25 * (b * (y_45_scale_m * 4.0)) else: tmp = 0.25 * ((x_45_scale_m * a) * t_0) return tmp
x-scale_m = abs(x_45_scale) y-scale_m = abs(y_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale_m) t_0 = Float64(sqrt(8.0) * sqrt(2.0)) tmp = 0.0 if (x_45_scale_m <= 1.15e+49) tmp = Float64(0.25 * Float64(y_45_scale_m * Float64(sqrt(8.0) * Float64(sqrt(2.0) * hypot(b, Float64(a * sin(Float64(pi * Float64(0.005555555555555556 * angle))))))))); elseif (x_45_scale_m <= 4.5e+86) tmp = Float64(Float64(0.25 * a) * Float64(x_45_scale_m * t_0)); elseif (x_45_scale_m <= 6.5e+91) tmp = Float64(0.25 * Float64(b * Float64(y_45_scale_m * 4.0))); else tmp = Float64(0.25 * Float64(Float64(x_45_scale_m * a) * t_0)); end return tmp end
x-scale_m = abs(x_45_scale); y-scale_m = abs(y_45_scale); function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale_m) t_0 = sqrt(8.0) * sqrt(2.0); tmp = 0.0; if (x_45_scale_m <= 1.15e+49) tmp = 0.25 * (y_45_scale_m * (sqrt(8.0) * (sqrt(2.0) * hypot(b, (a * sin((pi * (0.005555555555555556 * angle)))))))); elseif (x_45_scale_m <= 4.5e+86) tmp = (0.25 * a) * (x_45_scale_m * t_0); elseif (x_45_scale_m <= 6.5e+91) tmp = 0.25 * (b * (y_45_scale_m * 4.0)); else tmp = 0.25 * ((x_45_scale_m * a) * t_0); end tmp_2 = tmp; end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision]
y-scale_m = N[Abs[y$45$scale], $MachinePrecision]
code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale$95$m_] := Block[{t$95$0 = N[(N[Sqrt[8.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$45$scale$95$m, 1.15e+49], N[(0.25 * N[(y$45$scale$95$m * N[(N[Sqrt[8.0], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[b ^ 2 + N[(a * N[Sin[N[(Pi * N[(0.005555555555555556 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$45$scale$95$m, 4.5e+86], N[(N[(0.25 * a), $MachinePrecision] * N[(x$45$scale$95$m * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$45$scale$95$m, 6.5e+91], N[(0.25 * N[(b * N[(y$45$scale$95$m * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(x$45$scale$95$m * a), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
y-scale_m = \left|y-scale\right|
\\
\begin{array}{l}
t_0 := \sqrt{8} \cdot \sqrt{2}\\
\mathbf{if}\;x-scale\_m \leq 1.15 \cdot 10^{+49}:\\
\;\;\;\;0.25 \cdot \left(y-scale\_m \cdot \left(\sqrt{8} \cdot \left(\sqrt{2} \cdot \mathsf{hypot}\left(b, a \cdot \sin \left(\pi \cdot \left(0.005555555555555556 \cdot angle\right)\right)\right)\right)\right)\right)\\
\mathbf{elif}\;x-scale\_m \leq 4.5 \cdot 10^{+86}:\\
\;\;\;\;\left(0.25 \cdot a\right) \cdot \left(x-scale\_m \cdot t\_0\right)\\
\mathbf{elif}\;x-scale\_m \leq 6.5 \cdot 10^{+91}:\\
\;\;\;\;0.25 \cdot \left(b \cdot \left(y-scale\_m \cdot 4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(x-scale\_m \cdot a\right) \cdot t\_0\right)\\
\end{array}
\end{array}
if x-scale < 1.15000000000000001e49Initial program 3.2%
Simplified3.2%
Taylor expanded in x-scale around 0 26.8%
Simplified28.4%
Taylor expanded in angle around 0 28.4%
add-sqr-sqrt28.4%
pow228.4%
Applied egg-rr28.4%
expm1-log1p-u28.3%
expm1-undefine28.4%
Applied egg-rr28.4%
expm1-define28.3%
Simplified28.3%
*-commutative28.3%
sqrt-prod28.2%
Applied egg-rr29.0%
if 1.15000000000000001e49 < x-scale < 4.49999999999999993e86Initial program 0.4%
Simplified0.4%
Taylor expanded in y-scale around 0 23.3%
Simplified33.7%
Taylor expanded in angle around 0 24.1%
associate-*r*24.1%
*-commutative24.1%
Simplified24.1%
if 4.49999999999999993e86 < x-scale < 6.4999999999999997e91Initial program 0.0%
Simplified0.0%
Taylor expanded in angle around 0 100.0%
*-commutative100.0%
Simplified100.0%
sqrt-unprod100.0%
metadata-eval100.0%
metadata-eval100.0%
Applied egg-rr100.0%
if 6.4999999999999997e91 < x-scale Initial program 0.3%
Simplified0.3%
Taylor expanded in y-scale around 0 30.9%
Simplified33.2%
distribute-lft-in33.2%
unpow-prod-down33.2%
unpow-prod-down32.9%
add-exp-log32.9%
Applied egg-rr33.6%
Taylor expanded in angle around 0 29.2%
associate-*r*29.2%
Simplified29.2%
Final simplification29.2%
x-scale_m = (fabs.f64 x-scale) y-scale_m = (fabs.f64 y-scale) (FPCore (a b angle x-scale_m y-scale_m) :precision binary64 (if (<= x-scale_m 7.5e-26) (* y-scale_m b) (* 0.25 (* (* x-scale_m a) (* (sqrt 8.0) (sqrt 2.0))))))
x-scale_m = fabs(x_45_scale);
y-scale_m = fabs(y_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
double tmp;
if (x_45_scale_m <= 7.5e-26) {
tmp = y_45_scale_m * b;
} else {
tmp = 0.25 * ((x_45_scale_m * a) * (sqrt(8.0) * sqrt(2.0)));
}
return tmp;
}
x-scale_m = abs(x_45scale)
y-scale_m = abs(y_45scale)
real(8) function code(a, b, angle, x_45scale_m, y_45scale_m)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale_m
real(8), intent (in) :: y_45scale_m
real(8) :: tmp
if (x_45scale_m <= 7.5d-26) then
tmp = y_45scale_m * b
else
tmp = 0.25d0 * ((x_45scale_m * a) * (sqrt(8.0d0) * sqrt(2.0d0)))
end if
code = tmp
end function
x-scale_m = Math.abs(x_45_scale);
y-scale_m = Math.abs(y_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
double tmp;
if (x_45_scale_m <= 7.5e-26) {
tmp = y_45_scale_m * b;
} else {
tmp = 0.25 * ((x_45_scale_m * a) * (Math.sqrt(8.0) * Math.sqrt(2.0)));
}
return tmp;
}
x-scale_m = math.fabs(x_45_scale) y-scale_m = math.fabs(y_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale_m): tmp = 0 if x_45_scale_m <= 7.5e-26: tmp = y_45_scale_m * b else: tmp = 0.25 * ((x_45_scale_m * a) * (math.sqrt(8.0) * math.sqrt(2.0))) return tmp
x-scale_m = abs(x_45_scale) y-scale_m = abs(y_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale_m) tmp = 0.0 if (x_45_scale_m <= 7.5e-26) tmp = Float64(y_45_scale_m * b); else tmp = Float64(0.25 * Float64(Float64(x_45_scale_m * a) * Float64(sqrt(8.0) * sqrt(2.0)))); end return tmp end
x-scale_m = abs(x_45_scale); y-scale_m = abs(y_45_scale); function tmp_2 = code(a, b, angle, x_45_scale_m, y_45_scale_m) tmp = 0.0; if (x_45_scale_m <= 7.5e-26) tmp = y_45_scale_m * b; else tmp = 0.25 * ((x_45_scale_m * a) * (sqrt(8.0) * sqrt(2.0))); end tmp_2 = tmp; end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision] y-scale_m = N[Abs[y$45$scale], $MachinePrecision] code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale$95$m_] := If[LessEqual[x$45$scale$95$m, 7.5e-26], N[(y$45$scale$95$m * b), $MachinePrecision], N[(0.25 * N[(N[(x$45$scale$95$m * a), $MachinePrecision] * N[(N[Sqrt[8.0], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
y-scale_m = \left|y-scale\right|
\\
\begin{array}{l}
\mathbf{if}\;x-scale\_m \leq 7.5 \cdot 10^{-26}:\\
\;\;\;\;y-scale\_m \cdot b\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(x-scale\_m \cdot a\right) \cdot \left(\sqrt{8} \cdot \sqrt{2}\right)\right)\\
\end{array}
\end{array}
if x-scale < 7.4999999999999994e-26Initial program 3.4%
Simplified3.4%
Taylor expanded in angle around 0 16.9%
*-commutative16.9%
Simplified16.9%
sqrt-unprod17.1%
metadata-eval17.1%
metadata-eval17.1%
Applied egg-rr17.1%
Taylor expanded in b around 0 17.1%
if 7.4999999999999994e-26 < x-scale Initial program 0.3%
Simplified0.3%
Taylor expanded in y-scale around 0 26.4%
Simplified29.2%
distribute-lft-in29.2%
unpow-prod-down29.2%
unpow-prod-down27.7%
add-exp-log27.5%
Applied egg-rr29.1%
Taylor expanded in angle around 0 26.6%
associate-*r*26.6%
Simplified26.6%
Final simplification19.8%
x-scale_m = (fabs.f64 x-scale) y-scale_m = (fabs.f64 y-scale) (FPCore (a b angle x-scale_m y-scale_m) :precision binary64 (if (<= x-scale_m 0.04) (* y-scale_m b) (log1p (expm1 (* 0.25 (* b (* y-scale_m 4.0)))))))
x-scale_m = fabs(x_45_scale);
y-scale_m = fabs(y_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
double tmp;
if (x_45_scale_m <= 0.04) {
tmp = y_45_scale_m * b;
} else {
tmp = log1p(expm1((0.25 * (b * (y_45_scale_m * 4.0)))));
}
return tmp;
}
x-scale_m = Math.abs(x_45_scale);
y-scale_m = Math.abs(y_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
double tmp;
if (x_45_scale_m <= 0.04) {
tmp = y_45_scale_m * b;
} else {
tmp = Math.log1p(Math.expm1((0.25 * (b * (y_45_scale_m * 4.0)))));
}
return tmp;
}
x-scale_m = math.fabs(x_45_scale) y-scale_m = math.fabs(y_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale_m): tmp = 0 if x_45_scale_m <= 0.04: tmp = y_45_scale_m * b else: tmp = math.log1p(math.expm1((0.25 * (b * (y_45_scale_m * 4.0))))) return tmp
x-scale_m = abs(x_45_scale) y-scale_m = abs(y_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale_m) tmp = 0.0 if (x_45_scale_m <= 0.04) tmp = Float64(y_45_scale_m * b); else tmp = log1p(expm1(Float64(0.25 * Float64(b * Float64(y_45_scale_m * 4.0))))); end return tmp end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision] y-scale_m = N[Abs[y$45$scale], $MachinePrecision] code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale$95$m_] := If[LessEqual[x$45$scale$95$m, 0.04], N[(y$45$scale$95$m * b), $MachinePrecision], N[Log[1 + N[(Exp[N[(0.25 * N[(b * N[(y$45$scale$95$m * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
y-scale_m = \left|y-scale\right|
\\
\begin{array}{l}
\mathbf{if}\;x-scale\_m \leq 0.04:\\
\;\;\;\;y-scale\_m \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(0.25 \cdot \left(b \cdot \left(y-scale\_m \cdot 4\right)\right)\right)\right)\\
\end{array}
\end{array}
if x-scale < 0.0400000000000000008Initial program 3.4%
Simplified3.3%
Taylor expanded in angle around 0 17.1%
*-commutative17.1%
Simplified17.1%
sqrt-unprod17.3%
metadata-eval17.3%
metadata-eval17.3%
Applied egg-rr17.3%
Taylor expanded in b around 0 17.3%
if 0.0400000000000000008 < x-scale Initial program 0.3%
Simplified0.3%
Taylor expanded in angle around 0 7.6%
*-commutative7.6%
Simplified7.6%
log1p-expm1-u22.3%
*-commutative22.3%
sqrt-unprod22.3%
metadata-eval22.3%
metadata-eval22.3%
Applied egg-rr22.3%
Final simplification18.7%
x-scale_m = (fabs.f64 x-scale) y-scale_m = (fabs.f64 y-scale) (FPCore (a b angle x-scale_m y-scale_m) :precision binary64 (* y-scale_m b))
x-scale_m = fabs(x_45_scale);
y-scale_m = fabs(y_45_scale);
double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
return y_45_scale_m * b;
}
x-scale_m = abs(x_45scale)
y-scale_m = abs(y_45scale)
real(8) function code(a, b, angle, x_45scale_m, y_45scale_m)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale_m
real(8), intent (in) :: y_45scale_m
code = y_45scale_m * b
end function
x-scale_m = Math.abs(x_45_scale);
y-scale_m = Math.abs(y_45_scale);
public static double code(double a, double b, double angle, double x_45_scale_m, double y_45_scale_m) {
return y_45_scale_m * b;
}
x-scale_m = math.fabs(x_45_scale) y-scale_m = math.fabs(y_45_scale) def code(a, b, angle, x_45_scale_m, y_45_scale_m): return y_45_scale_m * b
x-scale_m = abs(x_45_scale) y-scale_m = abs(y_45_scale) function code(a, b, angle, x_45_scale_m, y_45_scale_m) return Float64(y_45_scale_m * b) end
x-scale_m = abs(x_45_scale); y-scale_m = abs(y_45_scale); function tmp = code(a, b, angle, x_45_scale_m, y_45_scale_m) tmp = y_45_scale_m * b; end
x-scale_m = N[Abs[x$45$scale], $MachinePrecision] y-scale_m = N[Abs[y$45$scale], $MachinePrecision] code[a_, b_, angle_, x$45$scale$95$m_, y$45$scale$95$m_] := N[(y$45$scale$95$m * b), $MachinePrecision]
\begin{array}{l}
x-scale_m = \left|x-scale\right|
\\
y-scale_m = \left|y-scale\right|
\\
y-scale\_m \cdot b
\end{array}
Initial program 2.5%
Simplified2.5%
Taylor expanded in angle around 0 14.6%
*-commutative14.6%
Simplified14.6%
sqrt-unprod14.7%
metadata-eval14.7%
metadata-eval14.7%
Applied egg-rr14.7%
Taylor expanded in b around 0 14.7%
Final simplification14.7%
herbie shell --seed 2024105
(FPCore (a b angle x-scale y-scale)
:name "a from scale-rotated-ellipse"
:precision binary64
(/ (- (sqrt (* (* (* 2.0 (/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0))) (* (* b a) (* b (- a)))) (+ (+ (/ (/ (+ (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)) (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))))))) (/ (* 4.0 (* (* b a) (* b (- a)))) (pow (* x-scale y-scale) 2.0))))