
(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}
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 (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}
a_m = (fabs.f64 a)
b_m = (fabs.f64 b)
(FPCore (a_m b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ (/ b_m x-scale) x-scale))
(t_1 (* (* PI angle) 0.005555555555555556))
(t_2 (* 0.5 (cos (* 2.0 t_1))))
(t_3 (/ (+ 0.5 t_2) (* x-scale x-scale)))
(t_4 (/ (- 0.5 t_2) (* y-scale y-scale)))
(t_5
(*
(/ (* (* a_m b_m) 4.0) (* y-scale x-scale))
(/ (* (- a_m) b_m) (* y-scale x-scale))))
(t_6 (/ a_m (* y-scale y-scale)))
(t_7 (* (* (* x-scale y-scale) x-scale) y-scale)))
(if (<= a_m 1.46e+162)
(/
(-
(sqrt
(*
(* (* 2.0 t_5) (* (* b_m a_m) (* b_m (- a_m))))
(fma a_m t_6 (fma b_m t_0 (fabs (- (* a_m t_6) (* b_m t_0))))))))
t_5)
(*
(*
0.25
(*
(/
(sqrt
(*
(/
(*
(+
(+
(sqrt
(fma
4.0
(/ (pow (* (sin t_1) (cos t_1)) 2.0) t_7)
(pow (- t_3 t_4) 2.0)))
t_3)
t_4)
(* (* a_m a_m) (* a_m a_m)))
t_7)
8.0))
a_m)
(/ b_m a_m)))
t_7))))a_m = fabs(a);
b_m = fabs(b);
double code(double a_m, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (b_m / x_45_scale) / x_45_scale;
double t_1 = (((double) M_PI) * angle) * 0.005555555555555556;
double t_2 = 0.5 * cos((2.0 * t_1));
double t_3 = (0.5 + t_2) / (x_45_scale * x_45_scale);
double t_4 = (0.5 - t_2) / (y_45_scale * y_45_scale);
double t_5 = (((a_m * b_m) * 4.0) / (y_45_scale * x_45_scale)) * ((-a_m * b_m) / (y_45_scale * x_45_scale));
double t_6 = a_m / (y_45_scale * y_45_scale);
double t_7 = ((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale;
double tmp;
if (a_m <= 1.46e+162) {
tmp = -sqrt((((2.0 * t_5) * ((b_m * a_m) * (b_m * -a_m))) * fma(a_m, t_6, fma(b_m, t_0, fabs(((a_m * t_6) - (b_m * t_0))))))) / t_5;
} else {
tmp = (0.25 * ((sqrt((((((sqrt(fma(4.0, (pow((sin(t_1) * cos(t_1)), 2.0) / t_7), pow((t_3 - t_4), 2.0))) + t_3) + t_4) * ((a_m * a_m) * (a_m * a_m))) / t_7) * 8.0)) / a_m) * (b_m / a_m))) * t_7;
}
return tmp;
}
a_m = abs(a) b_m = abs(b) function code(a_m, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(b_m / x_45_scale) / x_45_scale) t_1 = Float64(Float64(pi * angle) * 0.005555555555555556) t_2 = Float64(0.5 * cos(Float64(2.0 * t_1))) t_3 = Float64(Float64(0.5 + t_2) / Float64(x_45_scale * x_45_scale)) t_4 = Float64(Float64(0.5 - t_2) / Float64(y_45_scale * y_45_scale)) t_5 = Float64(Float64(Float64(Float64(a_m * b_m) * 4.0) / Float64(y_45_scale * x_45_scale)) * Float64(Float64(Float64(-a_m) * b_m) / Float64(y_45_scale * x_45_scale))) t_6 = Float64(a_m / Float64(y_45_scale * y_45_scale)) t_7 = Float64(Float64(Float64(x_45_scale * y_45_scale) * x_45_scale) * y_45_scale) tmp = 0.0 if (a_m <= 1.46e+162) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * t_5) * Float64(Float64(b_m * a_m) * Float64(b_m * Float64(-a_m)))) * fma(a_m, t_6, fma(b_m, t_0, abs(Float64(Float64(a_m * t_6) - Float64(b_m * t_0)))))))) / t_5); else tmp = Float64(Float64(0.25 * Float64(Float64(sqrt(Float64(Float64(Float64(Float64(Float64(sqrt(fma(4.0, Float64((Float64(sin(t_1) * cos(t_1)) ^ 2.0) / t_7), (Float64(t_3 - t_4) ^ 2.0))) + t_3) + t_4) * Float64(Float64(a_m * a_m) * Float64(a_m * a_m))) / t_7) * 8.0)) / a_m) * Float64(b_m / a_m))) * t_7); end return tmp end
a_m = N[Abs[a], $MachinePrecision]
b_m = N[Abs[b], $MachinePrecision]
code[a$95$m_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(b$95$m / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]}, Block[{t$95$1 = N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[Cos[N[(2.0 * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(0.5 + t$95$2), $MachinePrecision] / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(0.5 - t$95$2), $MachinePrecision] / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(N[(a$95$m * b$95$m), $MachinePrecision] * 4.0), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[((-a$95$m) * b$95$m), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(a$95$m / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]}, If[LessEqual[a$95$m, 1.46e+162], N[((-N[Sqrt[N[(N[(N[(2.0 * t$95$5), $MachinePrecision] * N[(N[(b$95$m * a$95$m), $MachinePrecision] * N[(b$95$m * (-a$95$m)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a$95$m * t$95$6 + N[(b$95$m * t$95$0 + N[Abs[N[(N[(a$95$m * t$95$6), $MachinePrecision] - N[(b$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$5), $MachinePrecision], N[(N[(0.25 * N[(N[(N[Sqrt[N[(N[(N[(N[(N[(N[Sqrt[N[(4.0 * N[(N[Power[N[(N[Sin[t$95$1], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / t$95$7), $MachinePrecision] + N[Power[N[(t$95$3 - t$95$4), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$3), $MachinePrecision] + t$95$4), $MachinePrecision] * N[(N[(a$95$m * a$95$m), $MachinePrecision] * N[(a$95$m * a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$7), $MachinePrecision] * 8.0), $MachinePrecision]], $MachinePrecision] / a$95$m), $MachinePrecision] * N[(b$95$m / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$7), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \frac{\frac{b\_m}{x-scale}}{x-scale}\\
t_1 := \left(\pi \cdot angle\right) \cdot 0.005555555555555556\\
t_2 := 0.5 \cdot \cos \left(2 \cdot t\_1\right)\\
t_3 := \frac{0.5 + t\_2}{x-scale \cdot x-scale}\\
t_4 := \frac{0.5 - t\_2}{y-scale \cdot y-scale}\\
t_5 := \frac{\left(a\_m \cdot b\_m\right) \cdot 4}{y-scale \cdot x-scale} \cdot \frac{\left(-a\_m\right) \cdot b\_m}{y-scale \cdot x-scale}\\
t_6 := \frac{a\_m}{y-scale \cdot y-scale}\\
t_7 := \left(\left(x-scale \cdot y-scale\right) \cdot x-scale\right) \cdot y-scale\\
\mathbf{if}\;a\_m \leq 1.46 \cdot 10^{+162}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot t\_5\right) \cdot \left(\left(b\_m \cdot a\_m\right) \cdot \left(b\_m \cdot \left(-a\_m\right)\right)\right)\right) \cdot \mathsf{fma}\left(a\_m, t\_6, \mathsf{fma}\left(b\_m, t\_0, \left|a\_m \cdot t\_6 - b\_m \cdot t\_0\right|\right)\right)}}{t\_5}\\
\mathbf{else}:\\
\;\;\;\;\left(0.25 \cdot \left(\frac{\sqrt{\frac{\left(\left(\sqrt{\mathsf{fma}\left(4, \frac{{\left(\sin t\_1 \cdot \cos t\_1\right)}^{2}}{t\_7}, {\left(t\_3 - t\_4\right)}^{2}\right)} + t\_3\right) + t\_4\right) \cdot \left(\left(a\_m \cdot a\_m\right) \cdot \left(a\_m \cdot a\_m\right)\right)}{t\_7} \cdot 8}}{a\_m} \cdot \frac{b\_m}{a\_m}\right)\right) \cdot t\_7\\
\end{array}
\end{array}
if a < 1.4599999999999999e162Initial program 2.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f643.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f643.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f643.1
Applied rewrites3.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f644.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f644.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f644.7
Applied rewrites4.7%
Taylor expanded in angle around 0
Applied rewrites7.6%
Applied rewrites10.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6410.1
Applied rewrites10.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6410.1
Applied rewrites10.1%
if 1.4599999999999999e162 < a Initial program 2.5%
Taylor expanded in angle around 0
Applied rewrites3.8%
Applied rewrites4.0%
Taylor expanded in b around inf
Applied rewrites1.6%
Applied rewrites6.8%
a_m = (fabs.f64 a)
b_m = (fabs.f64 b)
(FPCore (a_m b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (- a_m) b_m))
(t_1 (/ a_m (* y-scale y-scale)))
(t_2 (* a_m t_1))
(t_3 (/ (/ b_m x-scale) x-scale))
(t_4 (/ b_m (* x-scale x-scale)))
(t_5
(*
(/ (* (* a_m b_m) 4.0) (* y-scale x-scale))
(/ t_0 (* y-scale x-scale)))))
(if (<= y-scale 5.5e-27)
(*
(/
(/
(-
(sqrt
(*
(*
(*
(*
(*
(* (* b_m a_m) b_m)
(/ (- a_m) (* (* (* y-scale y-scale) x-scale) x-scale)))
4.0)
2.0)
(* (* t_0 b_m) a_m))
(fma a_m t_1 (fma b_m t_4 (fabs (- t_2 (* b_m t_4))))))))
(* (* b_m a_m) 4.0))
t_0)
(* (* (* x-scale y-scale) x-scale) y-scale))
(/
(-
(sqrt
(*
(* (* 2.0 t_5) (* (* b_m a_m) (* b_m (- a_m))))
(fma a_m t_1 (fma b_m t_3 (fabs (- t_2 (* b_m t_3))))))))
t_5))))a_m = fabs(a);
b_m = fabs(b);
double code(double a_m, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = -a_m * b_m;
double t_1 = a_m / (y_45_scale * y_45_scale);
double t_2 = a_m * t_1;
double t_3 = (b_m / x_45_scale) / x_45_scale;
double t_4 = b_m / (x_45_scale * x_45_scale);
double t_5 = (((a_m * b_m) * 4.0) / (y_45_scale * x_45_scale)) * (t_0 / (y_45_scale * x_45_scale));
double tmp;
if (y_45_scale <= 5.5e-27) {
tmp = ((-sqrt((((((((b_m * a_m) * b_m) * (-a_m / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale))) * 4.0) * 2.0) * ((t_0 * b_m) * a_m)) * fma(a_m, t_1, fma(b_m, t_4, fabs((t_2 - (b_m * t_4))))))) / ((b_m * a_m) * 4.0)) / t_0) * (((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale);
} else {
tmp = -sqrt((((2.0 * t_5) * ((b_m * a_m) * (b_m * -a_m))) * fma(a_m, t_1, fma(b_m, t_3, fabs((t_2 - (b_m * t_3))))))) / t_5;
}
return tmp;
}
a_m = abs(a) b_m = abs(b) function code(a_m, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(-a_m) * b_m) t_1 = Float64(a_m / Float64(y_45_scale * y_45_scale)) t_2 = Float64(a_m * t_1) t_3 = Float64(Float64(b_m / x_45_scale) / x_45_scale) t_4 = Float64(b_m / Float64(x_45_scale * x_45_scale)) t_5 = Float64(Float64(Float64(Float64(a_m * b_m) * 4.0) / Float64(y_45_scale * x_45_scale)) * Float64(t_0 / Float64(y_45_scale * x_45_scale))) tmp = 0.0 if (y_45_scale <= 5.5e-27) tmp = Float64(Float64(Float64(Float64(-sqrt(Float64(Float64(Float64(Float64(Float64(Float64(Float64(b_m * a_m) * b_m) * Float64(Float64(-a_m) / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale) * x_45_scale))) * 4.0) * 2.0) * Float64(Float64(t_0 * b_m) * a_m)) * fma(a_m, t_1, fma(b_m, t_4, abs(Float64(t_2 - Float64(b_m * t_4)))))))) / Float64(Float64(b_m * a_m) * 4.0)) / t_0) * Float64(Float64(Float64(x_45_scale * y_45_scale) * x_45_scale) * y_45_scale)); else tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * t_5) * Float64(Float64(b_m * a_m) * Float64(b_m * Float64(-a_m)))) * fma(a_m, t_1, fma(b_m, t_3, abs(Float64(t_2 - Float64(b_m * t_3)))))))) / t_5); end return tmp end
a_m = N[Abs[a], $MachinePrecision]
b_m = N[Abs[b], $MachinePrecision]
code[a$95$m_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[((-a$95$m) * b$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(a$95$m / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a$95$m * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(b$95$m / x$45$scale), $MachinePrecision] / x$45$scale), $MachinePrecision]}, Block[{t$95$4 = N[(b$95$m / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(N[(a$95$m * b$95$m), $MachinePrecision] * 4.0), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$45$scale, 5.5e-27], N[(N[(N[((-N[Sqrt[N[(N[(N[(N[(N[(N[(N[(b$95$m * a$95$m), $MachinePrecision] * b$95$m), $MachinePrecision] * N[((-a$95$m) / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 4.0), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(t$95$0 * b$95$m), $MachinePrecision] * a$95$m), $MachinePrecision]), $MachinePrecision] * N[(a$95$m * t$95$1 + N[(b$95$m * t$95$4 + N[Abs[N[(t$95$2 - N[(b$95$m * t$95$4), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(b$95$m * a$95$m), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision], N[((-N[Sqrt[N[(N[(N[(2.0 * t$95$5), $MachinePrecision] * N[(N[(b$95$m * a$95$m), $MachinePrecision] * N[(b$95$m * (-a$95$m)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(a$95$m * t$95$1 + N[(b$95$m * t$95$3 + N[Abs[N[(t$95$2 - N[(b$95$m * t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$5), $MachinePrecision]]]]]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \left(-a\_m\right) \cdot b\_m\\
t_1 := \frac{a\_m}{y-scale \cdot y-scale}\\
t_2 := a\_m \cdot t\_1\\
t_3 := \frac{\frac{b\_m}{x-scale}}{x-scale}\\
t_4 := \frac{b\_m}{x-scale \cdot x-scale}\\
t_5 := \frac{\left(a\_m \cdot b\_m\right) \cdot 4}{y-scale \cdot x-scale} \cdot \frac{t\_0}{y-scale \cdot x-scale}\\
\mathbf{if}\;y-scale \leq 5.5 \cdot 10^{-27}:\\
\;\;\;\;\frac{\frac{-\sqrt{\left(\left(\left(\left(\left(\left(b\_m \cdot a\_m\right) \cdot b\_m\right) \cdot \frac{-a\_m}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\right) \cdot x-scale}\right) \cdot 4\right) \cdot 2\right) \cdot \left(\left(t\_0 \cdot b\_m\right) \cdot a\_m\right)\right) \cdot \mathsf{fma}\left(a\_m, t\_1, \mathsf{fma}\left(b\_m, t\_4, \left|t\_2 - b\_m \cdot t\_4\right|\right)\right)}}{\left(b\_m \cdot a\_m\right) \cdot 4}}{t\_0} \cdot \left(\left(\left(x-scale \cdot y-scale\right) \cdot x-scale\right) \cdot y-scale\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot t\_5\right) \cdot \left(\left(b\_m \cdot a\_m\right) \cdot \left(b\_m \cdot \left(-a\_m\right)\right)\right)\right) \cdot \mathsf{fma}\left(a\_m, t\_1, \mathsf{fma}\left(b\_m, t\_3, \left|t\_2 - b\_m \cdot t\_3\right|\right)\right)}}{t\_5}\\
\end{array}
\end{array}
if y-scale < 5.5000000000000002e-27Initial program 2.5%
Taylor expanded in angle around 0
Applied rewrites3.8%
Applied rewrites4.0%
Applied rewrites6.5%
if 5.5000000000000002e-27 < y-scale Initial program 2.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f643.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f643.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f643.1
Applied rewrites3.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f644.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f644.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f644.7
Applied rewrites4.7%
Taylor expanded in angle around 0
Applied rewrites7.6%
Applied rewrites10.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6410.1
Applied rewrites10.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6410.1
Applied rewrites10.1%
a_m = (fabs.f64 a)
b_m = (fabs.f64 b)
(FPCore (a_m b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (- a_m) b_m))
(t_1 (/ a_m (* y-scale y-scale)))
(t_2 (/ b_m (* x-scale x-scale)))
(t_3 (fma a_m t_1 (fma b_m t_2 (fabs (- (* a_m t_1) (* b_m t_2))))))
(t_4
(*
(/ (* (* a_m b_m) 4.0) (* y-scale x-scale))
(/ t_0 (* y-scale x-scale)))))
(if (<= y-scale 1.05e-25)
(*
(/
(/
(-
(sqrt
(*
(*
(*
(*
(*
(* (* b_m a_m) b_m)
(/ (- a_m) (* (* (* y-scale y-scale) x-scale) x-scale)))
4.0)
2.0)
(* (* t_0 b_m) a_m))
t_3)))
(* (* b_m a_m) 4.0))
t_0)
(* (* (* x-scale y-scale) x-scale) y-scale))
(/
(- (sqrt (* (* (* 2.0 t_4) (* (* b_m a_m) (* b_m (- a_m)))) t_3)))
t_4))))a_m = fabs(a);
b_m = fabs(b);
double code(double a_m, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = -a_m * b_m;
double t_1 = a_m / (y_45_scale * y_45_scale);
double t_2 = b_m / (x_45_scale * x_45_scale);
double t_3 = fma(a_m, t_1, fma(b_m, t_2, fabs(((a_m * t_1) - (b_m * t_2)))));
double t_4 = (((a_m * b_m) * 4.0) / (y_45_scale * x_45_scale)) * (t_0 / (y_45_scale * x_45_scale));
double tmp;
if (y_45_scale <= 1.05e-25) {
tmp = ((-sqrt((((((((b_m * a_m) * b_m) * (-a_m / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale))) * 4.0) * 2.0) * ((t_0 * b_m) * a_m)) * t_3)) / ((b_m * a_m) * 4.0)) / t_0) * (((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale);
} else {
tmp = -sqrt((((2.0 * t_4) * ((b_m * a_m) * (b_m * -a_m))) * t_3)) / t_4;
}
return tmp;
}
a_m = abs(a) b_m = abs(b) function code(a_m, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(-a_m) * b_m) t_1 = Float64(a_m / Float64(y_45_scale * y_45_scale)) t_2 = Float64(b_m / Float64(x_45_scale * x_45_scale)) t_3 = fma(a_m, t_1, fma(b_m, t_2, abs(Float64(Float64(a_m * t_1) - Float64(b_m * t_2))))) t_4 = Float64(Float64(Float64(Float64(a_m * b_m) * 4.0) / Float64(y_45_scale * x_45_scale)) * Float64(t_0 / Float64(y_45_scale * x_45_scale))) tmp = 0.0 if (y_45_scale <= 1.05e-25) tmp = Float64(Float64(Float64(Float64(-sqrt(Float64(Float64(Float64(Float64(Float64(Float64(Float64(b_m * a_m) * b_m) * Float64(Float64(-a_m) / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale) * x_45_scale))) * 4.0) * 2.0) * Float64(Float64(t_0 * b_m) * a_m)) * t_3))) / Float64(Float64(b_m * a_m) * 4.0)) / t_0) * Float64(Float64(Float64(x_45_scale * y_45_scale) * x_45_scale) * y_45_scale)); else tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * t_4) * Float64(Float64(b_m * a_m) * Float64(b_m * Float64(-a_m)))) * t_3))) / t_4); end return tmp end
a_m = N[Abs[a], $MachinePrecision]
b_m = N[Abs[b], $MachinePrecision]
code[a$95$m_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[((-a$95$m) * b$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(a$95$m / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b$95$m / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(a$95$m * t$95$1 + N[(b$95$m * t$95$2 + N[Abs[N[(N[(a$95$m * t$95$1), $MachinePrecision] - N[(b$95$m * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(N[(a$95$m * b$95$m), $MachinePrecision] * 4.0), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$45$scale, 1.05e-25], N[(N[(N[((-N[Sqrt[N[(N[(N[(N[(N[(N[(N[(b$95$m * a$95$m), $MachinePrecision] * b$95$m), $MachinePrecision] * N[((-a$95$m) / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 4.0), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(t$95$0 * b$95$m), $MachinePrecision] * a$95$m), $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]], $MachinePrecision]) / N[(N[(b$95$m * a$95$m), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision], N[((-N[Sqrt[N[(N[(N[(2.0 * t$95$4), $MachinePrecision] * N[(N[(b$95$m * a$95$m), $MachinePrecision] * N[(b$95$m * (-a$95$m)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]], $MachinePrecision]) / t$95$4), $MachinePrecision]]]]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \left(-a\_m\right) \cdot b\_m\\
t_1 := \frac{a\_m}{y-scale \cdot y-scale}\\
t_2 := \frac{b\_m}{x-scale \cdot x-scale}\\
t_3 := \mathsf{fma}\left(a\_m, t\_1, \mathsf{fma}\left(b\_m, t\_2, \left|a\_m \cdot t\_1 - b\_m \cdot t\_2\right|\right)\right)\\
t_4 := \frac{\left(a\_m \cdot b\_m\right) \cdot 4}{y-scale \cdot x-scale} \cdot \frac{t\_0}{y-scale \cdot x-scale}\\
\mathbf{if}\;y-scale \leq 1.05 \cdot 10^{-25}:\\
\;\;\;\;\frac{\frac{-\sqrt{\left(\left(\left(\left(\left(\left(b\_m \cdot a\_m\right) \cdot b\_m\right) \cdot \frac{-a\_m}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\right) \cdot x-scale}\right) \cdot 4\right) \cdot 2\right) \cdot \left(\left(t\_0 \cdot b\_m\right) \cdot a\_m\right)\right) \cdot t\_3}}{\left(b\_m \cdot a\_m\right) \cdot 4}}{t\_0} \cdot \left(\left(\left(x-scale \cdot y-scale\right) \cdot x-scale\right) \cdot y-scale\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot t\_4\right) \cdot \left(\left(b\_m \cdot a\_m\right) \cdot \left(b\_m \cdot \left(-a\_m\right)\right)\right)\right) \cdot t\_3}}{t\_4}\\
\end{array}
\end{array}
if y-scale < 1.05000000000000001e-25Initial program 2.5%
Taylor expanded in angle around 0
Applied rewrites3.8%
Applied rewrites4.0%
Applied rewrites6.5%
if 1.05000000000000001e-25 < y-scale Initial program 2.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f643.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f643.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f643.1
Applied rewrites3.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f644.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f644.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f644.7
Applied rewrites4.7%
Taylor expanded in angle around 0
Applied rewrites7.6%
Applied rewrites10.0%
a_m = (fabs.f64 a)
b_m = (fabs.f64 b)
(FPCore (a_m b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (- a_m) b_m))
(t_1 (/ a_m (* y-scale y-scale)))
(t_2 (* (* b_m a_m) 4.0))
(t_3 (/ b_m (* x-scale x-scale)))
(t_4 (fma a_m t_1 (fma b_m t_3 (fabs (- (* a_m t_1) (* b_m t_3))))))
(t_5 (* (/ t_2 (* y-scale (* x-scale y-scale))) (/ t_0 x-scale))))
(if (<= y-scale 1.05e-25)
(*
(/
(/
(-
(sqrt
(*
(*
(*
(*
(*
(* (* b_m a_m) b_m)
(/ (- a_m) (* (* (* y-scale y-scale) x-scale) x-scale)))
4.0)
2.0)
(* (* t_0 b_m) a_m))
t_4)))
t_2)
t_0)
(* (* (* x-scale y-scale) x-scale) y-scale))
(/
(- (sqrt (* (* (* 2.0 t_5) (* (* b_m a_m) (* b_m (- a_m)))) t_4)))
t_5))))a_m = fabs(a);
b_m = fabs(b);
double code(double a_m, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = -a_m * b_m;
double t_1 = a_m / (y_45_scale * y_45_scale);
double t_2 = (b_m * a_m) * 4.0;
double t_3 = b_m / (x_45_scale * x_45_scale);
double t_4 = fma(a_m, t_1, fma(b_m, t_3, fabs(((a_m * t_1) - (b_m * t_3)))));
double t_5 = (t_2 / (y_45_scale * (x_45_scale * y_45_scale))) * (t_0 / x_45_scale);
double tmp;
if (y_45_scale <= 1.05e-25) {
tmp = ((-sqrt((((((((b_m * a_m) * b_m) * (-a_m / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale))) * 4.0) * 2.0) * ((t_0 * b_m) * a_m)) * t_4)) / t_2) / t_0) * (((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale);
} else {
tmp = -sqrt((((2.0 * t_5) * ((b_m * a_m) * (b_m * -a_m))) * t_4)) / t_5;
}
return tmp;
}
a_m = abs(a) b_m = abs(b) function code(a_m, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(-a_m) * b_m) t_1 = Float64(a_m / Float64(y_45_scale * y_45_scale)) t_2 = Float64(Float64(b_m * a_m) * 4.0) t_3 = Float64(b_m / Float64(x_45_scale * x_45_scale)) t_4 = fma(a_m, t_1, fma(b_m, t_3, abs(Float64(Float64(a_m * t_1) - Float64(b_m * t_3))))) t_5 = Float64(Float64(t_2 / Float64(y_45_scale * Float64(x_45_scale * y_45_scale))) * Float64(t_0 / x_45_scale)) tmp = 0.0 if (y_45_scale <= 1.05e-25) tmp = Float64(Float64(Float64(Float64(-sqrt(Float64(Float64(Float64(Float64(Float64(Float64(Float64(b_m * a_m) * b_m) * Float64(Float64(-a_m) / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale) * x_45_scale))) * 4.0) * 2.0) * Float64(Float64(t_0 * b_m) * a_m)) * t_4))) / t_2) / t_0) * Float64(Float64(Float64(x_45_scale * y_45_scale) * x_45_scale) * y_45_scale)); else tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * t_5) * Float64(Float64(b_m * a_m) * Float64(b_m * Float64(-a_m)))) * t_4))) / t_5); end return tmp end
a_m = N[Abs[a], $MachinePrecision]
b_m = N[Abs[b], $MachinePrecision]
code[a$95$m_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[((-a$95$m) * b$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(a$95$m / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b$95$m * a$95$m), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$3 = N[(b$95$m / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(a$95$m * t$95$1 + N[(b$95$m * t$95$3 + N[Abs[N[(N[(a$95$m * t$95$1), $MachinePrecision] - N[(b$95$m * t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$2 / N[(y$45$scale * N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / x$45$scale), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$45$scale, 1.05e-25], N[(N[(N[((-N[Sqrt[N[(N[(N[(N[(N[(N[(N[(b$95$m * a$95$m), $MachinePrecision] * b$95$m), $MachinePrecision] * N[((-a$95$m) / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 4.0), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(t$95$0 * b$95$m), $MachinePrecision] * a$95$m), $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision], N[((-N[Sqrt[N[(N[(N[(2.0 * t$95$5), $MachinePrecision] * N[(N[(b$95$m * a$95$m), $MachinePrecision] * N[(b$95$m * (-a$95$m)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision]], $MachinePrecision]) / t$95$5), $MachinePrecision]]]]]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \left(-a\_m\right) \cdot b\_m\\
t_1 := \frac{a\_m}{y-scale \cdot y-scale}\\
t_2 := \left(b\_m \cdot a\_m\right) \cdot 4\\
t_3 := \frac{b\_m}{x-scale \cdot x-scale}\\
t_4 := \mathsf{fma}\left(a\_m, t\_1, \mathsf{fma}\left(b\_m, t\_3, \left|a\_m \cdot t\_1 - b\_m \cdot t\_3\right|\right)\right)\\
t_5 := \frac{t\_2}{y-scale \cdot \left(x-scale \cdot y-scale\right)} \cdot \frac{t\_0}{x-scale}\\
\mathbf{if}\;y-scale \leq 1.05 \cdot 10^{-25}:\\
\;\;\;\;\frac{\frac{-\sqrt{\left(\left(\left(\left(\left(\left(b\_m \cdot a\_m\right) \cdot b\_m\right) \cdot \frac{-a\_m}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\right) \cdot x-scale}\right) \cdot 4\right) \cdot 2\right) \cdot \left(\left(t\_0 \cdot b\_m\right) \cdot a\_m\right)\right) \cdot t\_4}}{t\_2}}{t\_0} \cdot \left(\left(\left(x-scale \cdot y-scale\right) \cdot x-scale\right) \cdot y-scale\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot t\_5\right) \cdot \left(\left(b\_m \cdot a\_m\right) \cdot \left(b\_m \cdot \left(-a\_m\right)\right)\right)\right) \cdot t\_4}}{t\_5}\\
\end{array}
\end{array}
if y-scale < 1.05000000000000001e-25Initial program 2.5%
Taylor expanded in angle around 0
Applied rewrites3.8%
Applied rewrites4.0%
Applied rewrites6.5%
if 1.05000000000000001e-25 < y-scale Initial program 2.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f643.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f643.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f643.1
Applied rewrites3.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f644.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f644.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f644.7
Applied rewrites4.7%
Taylor expanded in angle around 0
Applied rewrites7.6%
Applied rewrites10.0%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
pow2N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites7.0%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
pow2N/A
lift-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites6.1%
a_m = (fabs.f64 a)
b_m = (fabs.f64 b)
(FPCore (a_m b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (- a_m) b_m))
(t_1 (/ a_m (* y-scale y-scale)))
(t_2 (/ b_m (* x-scale x-scale)))
(t_3 (* (* x-scale y-scale) x-scale))
(t_4 (* t_3 y-scale))
(t_5 (* (* b_m a_m) b_m))
(t_6 (* t_0 b_m)))
(if (<= x-scale 3.6e+15)
(*
(*
(/
(/
(-
(sqrt
(*
(* (* (* (* (/ (- a_m) t_4) t_5) 8.0) t_6) a_m)
(fma
t_1
a_m
(fma
t_2
b_m
(fabs
(-
(/ (* b_m b_m) (* x-scale x-scale))
(/ (* a_m a_m) (* y-scale y-scale)))))))))
(* b_m a_m))
(* t_0 4.0))
t_3)
y-scale)
(*
(/
(/
(-
(sqrt
(*
(*
(*
(*
(* t_5 (/ (- a_m) (* (* (* y-scale y-scale) x-scale) x-scale)))
4.0)
2.0)
(* t_6 a_m))
(fma a_m t_1 (fma b_m t_2 (fabs (- (* a_m t_1) (* b_m t_2))))))))
(* (* b_m a_m) 4.0))
t_0)
t_4))))a_m = fabs(a);
b_m = fabs(b);
double code(double a_m, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = -a_m * b_m;
double t_1 = a_m / (y_45_scale * y_45_scale);
double t_2 = b_m / (x_45_scale * x_45_scale);
double t_3 = (x_45_scale * y_45_scale) * x_45_scale;
double t_4 = t_3 * y_45_scale;
double t_5 = (b_m * a_m) * b_m;
double t_6 = t_0 * b_m;
double tmp;
if (x_45_scale <= 3.6e+15) {
tmp = (((-sqrt(((((((-a_m / t_4) * t_5) * 8.0) * t_6) * a_m) * fma(t_1, a_m, fma(t_2, b_m, fabs((((b_m * b_m) / (x_45_scale * x_45_scale)) - ((a_m * a_m) / (y_45_scale * y_45_scale)))))))) / (b_m * a_m)) / (t_0 * 4.0)) * t_3) * y_45_scale;
} else {
tmp = ((-sqrt((((((t_5 * (-a_m / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale))) * 4.0) * 2.0) * (t_6 * a_m)) * fma(a_m, t_1, fma(b_m, t_2, fabs(((a_m * t_1) - (b_m * t_2))))))) / ((b_m * a_m) * 4.0)) / t_0) * t_4;
}
return tmp;
}
a_m = abs(a) b_m = abs(b) function code(a_m, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(-a_m) * b_m) t_1 = Float64(a_m / Float64(y_45_scale * y_45_scale)) t_2 = Float64(b_m / Float64(x_45_scale * x_45_scale)) t_3 = Float64(Float64(x_45_scale * y_45_scale) * x_45_scale) t_4 = Float64(t_3 * y_45_scale) t_5 = Float64(Float64(b_m * a_m) * b_m) t_6 = Float64(t_0 * b_m) tmp = 0.0 if (x_45_scale <= 3.6e+15) tmp = Float64(Float64(Float64(Float64(Float64(-sqrt(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-a_m) / t_4) * t_5) * 8.0) * t_6) * a_m) * fma(t_1, a_m, fma(t_2, b_m, abs(Float64(Float64(Float64(b_m * b_m) / Float64(x_45_scale * x_45_scale)) - Float64(Float64(a_m * a_m) / Float64(y_45_scale * y_45_scale))))))))) / Float64(b_m * a_m)) / Float64(t_0 * 4.0)) * t_3) * y_45_scale); else tmp = Float64(Float64(Float64(Float64(-sqrt(Float64(Float64(Float64(Float64(Float64(t_5 * Float64(Float64(-a_m) / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale) * x_45_scale))) * 4.0) * 2.0) * Float64(t_6 * a_m)) * fma(a_m, t_1, fma(b_m, t_2, abs(Float64(Float64(a_m * t_1) - Float64(b_m * t_2)))))))) / Float64(Float64(b_m * a_m) * 4.0)) / t_0) * t_4); end return tmp end
a_m = N[Abs[a], $MachinePrecision]
b_m = N[Abs[b], $MachinePrecision]
code[a$95$m_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[((-a$95$m) * b$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(a$95$m / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b$95$m / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * y$45$scale), $MachinePrecision]}, Block[{t$95$5 = N[(N[(b$95$m * a$95$m), $MachinePrecision] * b$95$m), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$0 * b$95$m), $MachinePrecision]}, If[LessEqual[x$45$scale, 3.6e+15], N[(N[(N[(N[((-N[Sqrt[N[(N[(N[(N[(N[(N[((-a$95$m) / t$95$4), $MachinePrecision] * t$95$5), $MachinePrecision] * 8.0), $MachinePrecision] * t$95$6), $MachinePrecision] * a$95$m), $MachinePrecision] * N[(t$95$1 * a$95$m + N[(t$95$2 * b$95$m + N[Abs[N[(N[(N[(b$95$m * b$95$m), $MachinePrecision] / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] - N[(N[(a$95$m * a$95$m), $MachinePrecision] / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(b$95$m * a$95$m), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * 4.0), $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision] * y$45$scale), $MachinePrecision], N[(N[(N[((-N[Sqrt[N[(N[(N[(N[(N[(t$95$5 * N[((-a$95$m) / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 4.0), $MachinePrecision] * 2.0), $MachinePrecision] * N[(t$95$6 * a$95$m), $MachinePrecision]), $MachinePrecision] * N[(a$95$m * t$95$1 + N[(b$95$m * t$95$2 + N[Abs[N[(N[(a$95$m * t$95$1), $MachinePrecision] - N[(b$95$m * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(b$95$m * a$95$m), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] * t$95$4), $MachinePrecision]]]]]]]]]
\begin{array}{l}
a_m = \left|a\right|
\\
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \left(-a\_m\right) \cdot b\_m\\
t_1 := \frac{a\_m}{y-scale \cdot y-scale}\\
t_2 := \frac{b\_m}{x-scale \cdot x-scale}\\
t_3 := \left(x-scale \cdot y-scale\right) \cdot x-scale\\
t_4 := t\_3 \cdot y-scale\\
t_5 := \left(b\_m \cdot a\_m\right) \cdot b\_m\\
t_6 := t\_0 \cdot b\_m\\
\mathbf{if}\;x-scale \leq 3.6 \cdot 10^{+15}:\\
\;\;\;\;\left(\frac{\frac{-\sqrt{\left(\left(\left(\left(\frac{-a\_m}{t\_4} \cdot t\_5\right) \cdot 8\right) \cdot t\_6\right) \cdot a\_m\right) \cdot \mathsf{fma}\left(t\_1, a\_m, \mathsf{fma}\left(t\_2, b\_m, \left|\frac{b\_m \cdot b\_m}{x-scale \cdot x-scale} - \frac{a\_m \cdot a\_m}{y-scale \cdot y-scale}\right|\right)\right)}}{b\_m \cdot a\_m}}{t\_0 \cdot 4} \cdot t\_3\right) \cdot y-scale\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-\sqrt{\left(\left(\left(\left(t\_5 \cdot \frac{-a\_m}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\right) \cdot x-scale}\right) \cdot 4\right) \cdot 2\right) \cdot \left(t\_6 \cdot a\_m\right)\right) \cdot \mathsf{fma}\left(a\_m, t\_1, \mathsf{fma}\left(b\_m, t\_2, \left|a\_m \cdot t\_1 - b\_m \cdot t\_2\right|\right)\right)}}{\left(b\_m \cdot a\_m\right) \cdot 4}}{t\_0} \cdot t\_4\\
\end{array}
\end{array}
if x-scale < 3.6e15Initial program 2.5%
Taylor expanded in angle around 0
Applied rewrites3.8%
Applied rewrites4.0%
Applied rewrites4.0%
Applied rewrites6.1%
if 3.6e15 < x-scale Initial program 2.5%
Taylor expanded in angle around 0
Applied rewrites3.8%
Applied rewrites4.0%
Applied rewrites6.5%
a_m = (fabs.f64 a)
b_m = (fabs.f64 b)
(FPCore (a_m b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* x-scale y-scale) x-scale)) (t_1 (* (- a_m) b_m)))
(*
(*
(/
(/
(-
(sqrt
(*
(*
(*
(* (* (/ (- a_m) (* t_0 y-scale)) (* (* b_m a_m) b_m)) 8.0)
(* t_1 b_m))
a_m)
(fma
(/ a_m (* y-scale y-scale))
a_m
(fma
(/ b_m (* x-scale x-scale))
b_m
(fabs
(-
(/ (* b_m b_m) (* x-scale x-scale))
(/ (* a_m a_m) (* y-scale y-scale)))))))))
(* b_m a_m))
(* t_1 4.0))
t_0)
y-scale)))a_m = fabs(a);
b_m = fabs(b);
double code(double a_m, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (x_45_scale * y_45_scale) * x_45_scale;
double t_1 = -a_m * b_m;
return (((-sqrt(((((((-a_m / (t_0 * y_45_scale)) * ((b_m * a_m) * b_m)) * 8.0) * (t_1 * b_m)) * a_m) * fma((a_m / (y_45_scale * y_45_scale)), a_m, fma((b_m / (x_45_scale * x_45_scale)), b_m, fabs((((b_m * b_m) / (x_45_scale * x_45_scale)) - ((a_m * a_m) / (y_45_scale * y_45_scale)))))))) / (b_m * a_m)) / (t_1 * 4.0)) * t_0) * y_45_scale;
}
a_m = abs(a) b_m = abs(b) function code(a_m, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(x_45_scale * y_45_scale) * x_45_scale) t_1 = Float64(Float64(-a_m) * b_m) return Float64(Float64(Float64(Float64(Float64(-sqrt(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-a_m) / Float64(t_0 * y_45_scale)) * Float64(Float64(b_m * a_m) * b_m)) * 8.0) * Float64(t_1 * b_m)) * a_m) * fma(Float64(a_m / Float64(y_45_scale * y_45_scale)), a_m, fma(Float64(b_m / Float64(x_45_scale * x_45_scale)), b_m, abs(Float64(Float64(Float64(b_m * b_m) / Float64(x_45_scale * x_45_scale)) - Float64(Float64(a_m * a_m) / Float64(y_45_scale * y_45_scale))))))))) / Float64(b_m * a_m)) / Float64(t_1 * 4.0)) * t_0) * y_45_scale) end
a_m = N[Abs[a], $MachinePrecision]
b_m = N[Abs[b], $MachinePrecision]
code[a$95$m_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]}, Block[{t$95$1 = N[((-a$95$m) * b$95$m), $MachinePrecision]}, N[(N[(N[(N[((-N[Sqrt[N[(N[(N[(N[(N[(N[((-a$95$m) / N[(t$95$0 * y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(b$95$m * a$95$m), $MachinePrecision] * b$95$m), $MachinePrecision]), $MachinePrecision] * 8.0), $MachinePrecision] * N[(t$95$1 * b$95$m), $MachinePrecision]), $MachinePrecision] * a$95$m), $MachinePrecision] * N[(N[(a$95$m / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] * a$95$m + N[(N[(b$95$m / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * b$95$m + N[Abs[N[(N[(N[(b$95$m * b$95$m), $MachinePrecision] / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] - N[(N[(a$95$m * a$95$m), $MachinePrecision] / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(b$95$m * a$95$m), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 * 4.0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * y$45$scale), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \left(x-scale \cdot y-scale\right) \cdot x-scale\\
t_1 := \left(-a\_m\right) \cdot b\_m\\
\left(\frac{\frac{-\sqrt{\left(\left(\left(\left(\frac{-a\_m}{t\_0 \cdot y-scale} \cdot \left(\left(b\_m \cdot a\_m\right) \cdot b\_m\right)\right) \cdot 8\right) \cdot \left(t\_1 \cdot b\_m\right)\right) \cdot a\_m\right) \cdot \mathsf{fma}\left(\frac{a\_m}{y-scale \cdot y-scale}, a\_m, \mathsf{fma}\left(\frac{b\_m}{x-scale \cdot x-scale}, b\_m, \left|\frac{b\_m \cdot b\_m}{x-scale \cdot x-scale} - \frac{a\_m \cdot a\_m}{y-scale \cdot y-scale}\right|\right)\right)}}{b\_m \cdot a\_m}}{t\_1 \cdot 4} \cdot t\_0\right) \cdot y-scale
\end{array}
\end{array}
Initial program 2.5%
Taylor expanded in angle around 0
Applied rewrites3.8%
Applied rewrites4.0%
Applied rewrites4.0%
Applied rewrites6.1%
a_m = (fabs.f64 a)
b_m = (fabs.f64 b)
(FPCore (a_m b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* x-scale y-scale) x-scale)) (t_1 (* (- a_m) b_m)))
(*
(*
(/
(-
(sqrt
(*
(*
(*
(* (* (/ (- a_m) (* t_0 y-scale)) (* (* b_m a_m) b_m)) 8.0)
(* t_1 b_m))
a_m)
(fma
(/ a_m (* y-scale y-scale))
a_m
(fma
(/ b_m (* x-scale x-scale))
b_m
(fabs
(-
(/ (* b_m b_m) (* x-scale x-scale))
(/ (* a_m a_m) (* y-scale y-scale)))))))))
(* t_1 4.0))
(/ t_0 (* b_m a_m)))
y-scale)))a_m = fabs(a);
b_m = fabs(b);
double code(double a_m, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (x_45_scale * y_45_scale) * x_45_scale;
double t_1 = -a_m * b_m;
return ((-sqrt(((((((-a_m / (t_0 * y_45_scale)) * ((b_m * a_m) * b_m)) * 8.0) * (t_1 * b_m)) * a_m) * fma((a_m / (y_45_scale * y_45_scale)), a_m, fma((b_m / (x_45_scale * x_45_scale)), b_m, fabs((((b_m * b_m) / (x_45_scale * x_45_scale)) - ((a_m * a_m) / (y_45_scale * y_45_scale)))))))) / (t_1 * 4.0)) * (t_0 / (b_m * a_m))) * y_45_scale;
}
a_m = abs(a) b_m = abs(b) function code(a_m, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(x_45_scale * y_45_scale) * x_45_scale) t_1 = Float64(Float64(-a_m) * b_m) return Float64(Float64(Float64(Float64(-sqrt(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-a_m) / Float64(t_0 * y_45_scale)) * Float64(Float64(b_m * a_m) * b_m)) * 8.0) * Float64(t_1 * b_m)) * a_m) * fma(Float64(a_m / Float64(y_45_scale * y_45_scale)), a_m, fma(Float64(b_m / Float64(x_45_scale * x_45_scale)), b_m, abs(Float64(Float64(Float64(b_m * b_m) / Float64(x_45_scale * x_45_scale)) - Float64(Float64(a_m * a_m) / Float64(y_45_scale * y_45_scale))))))))) / Float64(t_1 * 4.0)) * Float64(t_0 / Float64(b_m * a_m))) * y_45_scale) end
a_m = N[Abs[a], $MachinePrecision]
b_m = N[Abs[b], $MachinePrecision]
code[a$95$m_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]}, Block[{t$95$1 = N[((-a$95$m) * b$95$m), $MachinePrecision]}, N[(N[(N[((-N[Sqrt[N[(N[(N[(N[(N[(N[((-a$95$m) / N[(t$95$0 * y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(b$95$m * a$95$m), $MachinePrecision] * b$95$m), $MachinePrecision]), $MachinePrecision] * 8.0), $MachinePrecision] * N[(t$95$1 * b$95$m), $MachinePrecision]), $MachinePrecision] * a$95$m), $MachinePrecision] * N[(N[(a$95$m / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] * a$95$m + N[(N[(b$95$m / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * b$95$m + N[Abs[N[(N[(N[(b$95$m * b$95$m), $MachinePrecision] / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] - N[(N[(a$95$m * a$95$m), $MachinePrecision] / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(t$95$1 * 4.0), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[(b$95$m * a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y$45$scale), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \left(x-scale \cdot y-scale\right) \cdot x-scale\\
t_1 := \left(-a\_m\right) \cdot b\_m\\
\left(\frac{-\sqrt{\left(\left(\left(\left(\frac{-a\_m}{t\_0 \cdot y-scale} \cdot \left(\left(b\_m \cdot a\_m\right) \cdot b\_m\right)\right) \cdot 8\right) \cdot \left(t\_1 \cdot b\_m\right)\right) \cdot a\_m\right) \cdot \mathsf{fma}\left(\frac{a\_m}{y-scale \cdot y-scale}, a\_m, \mathsf{fma}\left(\frac{b\_m}{x-scale \cdot x-scale}, b\_m, \left|\frac{b\_m \cdot b\_m}{x-scale \cdot x-scale} - \frac{a\_m \cdot a\_m}{y-scale \cdot y-scale}\right|\right)\right)}}{t\_1 \cdot 4} \cdot \frac{t\_0}{b\_m \cdot a\_m}\right) \cdot y-scale
\end{array}
\end{array}
Initial program 2.5%
Taylor expanded in angle around 0
Applied rewrites3.8%
Applied rewrites4.0%
Applied rewrites4.0%
Applied rewrites5.0%
a_m = (fabs.f64 a)
b_m = (fabs.f64 b)
(FPCore (a_m b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* (- a_m) b_m) b_m)))
(*
(*
(*
(/
(-
(sqrt
(*
(*
(*
(*
(*
(/ (- a_m) (* (* (* x-scale y-scale) x-scale) y-scale))
(* (* b_m a_m) b_m))
8.0)
t_0)
a_m)
(fma
(/ a_m (* y-scale y-scale))
a_m
(fma
(/ b_m (* x-scale x-scale))
b_m
(fabs
(-
(/ (* b_m b_m) (* x-scale x-scale))
(/ (* a_m a_m) (* y-scale y-scale)))))))))
(* (* t_0 a_m) 4.0))
(* x-scale y-scale))
x-scale)
y-scale)))a_m = fabs(a);
b_m = fabs(b);
double code(double a_m, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (-a_m * b_m) * b_m;
return (((-sqrt(((((((-a_m / (((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale)) * ((b_m * a_m) * b_m)) * 8.0) * t_0) * a_m) * fma((a_m / (y_45_scale * y_45_scale)), a_m, fma((b_m / (x_45_scale * x_45_scale)), b_m, fabs((((b_m * b_m) / (x_45_scale * x_45_scale)) - ((a_m * a_m) / (y_45_scale * y_45_scale)))))))) / ((t_0 * a_m) * 4.0)) * (x_45_scale * y_45_scale)) * x_45_scale) * y_45_scale;
}
a_m = abs(a) b_m = abs(b) function code(a_m, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(Float64(-a_m) * b_m) * b_m) return Float64(Float64(Float64(Float64(Float64(-sqrt(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-a_m) / Float64(Float64(Float64(x_45_scale * y_45_scale) * x_45_scale) * y_45_scale)) * Float64(Float64(b_m * a_m) * b_m)) * 8.0) * t_0) * a_m) * fma(Float64(a_m / Float64(y_45_scale * y_45_scale)), a_m, fma(Float64(b_m / Float64(x_45_scale * x_45_scale)), b_m, abs(Float64(Float64(Float64(b_m * b_m) / Float64(x_45_scale * x_45_scale)) - Float64(Float64(a_m * a_m) / Float64(y_45_scale * y_45_scale))))))))) / Float64(Float64(t_0 * a_m) * 4.0)) * Float64(x_45_scale * y_45_scale)) * x_45_scale) * y_45_scale) end
a_m = N[Abs[a], $MachinePrecision]
b_m = N[Abs[b], $MachinePrecision]
code[a$95$m_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[((-a$95$m) * b$95$m), $MachinePrecision] * b$95$m), $MachinePrecision]}, N[(N[(N[(N[((-N[Sqrt[N[(N[(N[(N[(N[(N[((-a$95$m) / N[(N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(b$95$m * a$95$m), $MachinePrecision] * b$95$m), $MachinePrecision]), $MachinePrecision] * 8.0), $MachinePrecision] * t$95$0), $MachinePrecision] * a$95$m), $MachinePrecision] * N[(N[(a$95$m / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] * a$95$m + N[(N[(b$95$m / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * b$95$m + N[Abs[N[(N[(N[(b$95$m * b$95$m), $MachinePrecision] / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] - N[(N[(a$95$m * a$95$m), $MachinePrecision] / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(t$95$0 * a$95$m), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] * N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \left(\left(-a\_m\right) \cdot b\_m\right) \cdot b\_m\\
\left(\left(\frac{-\sqrt{\left(\left(\left(\left(\frac{-a\_m}{\left(\left(x-scale \cdot y-scale\right) \cdot x-scale\right) \cdot y-scale} \cdot \left(\left(b\_m \cdot a\_m\right) \cdot b\_m\right)\right) \cdot 8\right) \cdot t\_0\right) \cdot a\_m\right) \cdot \mathsf{fma}\left(\frac{a\_m}{y-scale \cdot y-scale}, a\_m, \mathsf{fma}\left(\frac{b\_m}{x-scale \cdot x-scale}, b\_m, \left|\frac{b\_m \cdot b\_m}{x-scale \cdot x-scale} - \frac{a\_m \cdot a\_m}{y-scale \cdot y-scale}\right|\right)\right)}}{\left(t\_0 \cdot a\_m\right) \cdot 4} \cdot \left(x-scale \cdot y-scale\right)\right) \cdot x-scale\right) \cdot y-scale
\end{array}
\end{array}
Initial program 2.5%
Taylor expanded in angle around 0
Applied rewrites3.8%
Applied rewrites4.0%
Applied rewrites4.0%
Applied rewrites3.5%
a_m = (fabs.f64 a)
b_m = (fabs.f64 b)
(FPCore (a_m b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ 1.0 (* x-scale x-scale)))
(t_1 (* (* (* x-scale y-scale) x-scale) y-scale)))
(*
-0.25
(*
(/
(*
t_1
(sqrt (* (/ (* (+ t_0 t_0) (* (* a_m a_m) (* a_m a_m))) t_1) 8.0)))
a_m)
(/ b_m a_m)))))a_m = fabs(a);
b_m = fabs(b);
double code(double a_m, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 1.0 / (x_45_scale * x_45_scale);
double t_1 = ((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale;
return -0.25 * (((t_1 * sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / t_1) * 8.0))) / a_m) * (b_m / a_m));
}
a_m = private
b_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a_m, b_m, angle, x_45scale, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a_m
real(8), intent (in) :: b_m
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
real(8) :: t_1
t_0 = 1.0d0 / (x_45scale * x_45scale)
t_1 = ((x_45scale * y_45scale) * x_45scale) * y_45scale
code = (-0.25d0) * (((t_1 * sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / t_1) * 8.0d0))) / a_m) * (b_m / a_m))
end function
a_m = Math.abs(a);
b_m = Math.abs(b);
public static double code(double a_m, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 1.0 / (x_45_scale * x_45_scale);
double t_1 = ((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale;
return -0.25 * (((t_1 * Math.sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / t_1) * 8.0))) / a_m) * (b_m / a_m));
}
a_m = math.fabs(a) b_m = math.fabs(b) def code(a_m, b_m, angle, x_45_scale, y_45_scale): t_0 = 1.0 / (x_45_scale * x_45_scale) t_1 = ((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale return -0.25 * (((t_1 * math.sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / t_1) * 8.0))) / a_m) * (b_m / a_m))
a_m = abs(a) b_m = abs(b) function code(a_m, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(1.0 / Float64(x_45_scale * x_45_scale)) t_1 = Float64(Float64(Float64(x_45_scale * y_45_scale) * x_45_scale) * y_45_scale) return Float64(-0.25 * Float64(Float64(Float64(t_1 * sqrt(Float64(Float64(Float64(Float64(t_0 + t_0) * Float64(Float64(a_m * a_m) * Float64(a_m * a_m))) / t_1) * 8.0))) / a_m) * Float64(b_m / a_m))) end
a_m = abs(a); b_m = abs(b); function tmp = code(a_m, b_m, angle, x_45_scale, y_45_scale) t_0 = 1.0 / (x_45_scale * x_45_scale); t_1 = ((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale; tmp = -0.25 * (((t_1 * sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / t_1) * 8.0))) / a_m) * (b_m / a_m)); end
a_m = N[Abs[a], $MachinePrecision]
b_m = N[Abs[b], $MachinePrecision]
code[a$95$m_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(1.0 / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]}, N[(-0.25 * N[(N[(N[(t$95$1 * N[Sqrt[N[(N[(N[(N[(t$95$0 + t$95$0), $MachinePrecision] * N[(N[(a$95$m * a$95$m), $MachinePrecision] * N[(a$95$m * a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] * 8.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision] * N[(b$95$m / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \frac{1}{x-scale \cdot x-scale}\\
t_1 := \left(\left(x-scale \cdot y-scale\right) \cdot x-scale\right) \cdot y-scale\\
-0.25 \cdot \left(\frac{t\_1 \cdot \sqrt{\frac{\left(t\_0 + t\_0\right) \cdot \left(\left(a\_m \cdot a\_m\right) \cdot \left(a\_m \cdot a\_m\right)\right)}{t\_1} \cdot 8}}{a\_m} \cdot \frac{b\_m}{a\_m}\right)
\end{array}
\end{array}
Initial program 2.5%
Taylor expanded in b around -inf
Applied rewrites0.1%
Taylor expanded in angle around 0
lower-+.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lower-pow.f640.2
Applied rewrites0.2%
Applied rewrites0.4%
a_m = (fabs.f64 a)
b_m = (fabs.f64 b)
(FPCore (a_m b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ 1.0 (* x-scale x-scale)))
(t_1 (* (* (* x-scale y-scale) x-scale) y-scale)))
(*
-0.25
(*
b_m
(/
(*
t_1
(sqrt (* (/ (* (+ t_0 t_0) (* (* a_m a_m) (* a_m a_m))) t_1) 8.0)))
(* a_m a_m))))))a_m = fabs(a);
b_m = fabs(b);
double code(double a_m, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 1.0 / (x_45_scale * x_45_scale);
double t_1 = ((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale;
return -0.25 * (b_m * ((t_1 * sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / t_1) * 8.0))) / (a_m * a_m)));
}
a_m = private
b_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a_m, b_m, angle, x_45scale, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a_m
real(8), intent (in) :: b_m
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
real(8) :: t_1
t_0 = 1.0d0 / (x_45scale * x_45scale)
t_1 = ((x_45scale * y_45scale) * x_45scale) * y_45scale
code = (-0.25d0) * (b_m * ((t_1 * sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / t_1) * 8.0d0))) / (a_m * a_m)))
end function
a_m = Math.abs(a);
b_m = Math.abs(b);
public static double code(double a_m, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 1.0 / (x_45_scale * x_45_scale);
double t_1 = ((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale;
return -0.25 * (b_m * ((t_1 * Math.sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / t_1) * 8.0))) / (a_m * a_m)));
}
a_m = math.fabs(a) b_m = math.fabs(b) def code(a_m, b_m, angle, x_45_scale, y_45_scale): t_0 = 1.0 / (x_45_scale * x_45_scale) t_1 = ((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale return -0.25 * (b_m * ((t_1 * math.sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / t_1) * 8.0))) / (a_m * a_m)))
a_m = abs(a) b_m = abs(b) function code(a_m, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(1.0 / Float64(x_45_scale * x_45_scale)) t_1 = Float64(Float64(Float64(x_45_scale * y_45_scale) * x_45_scale) * y_45_scale) return Float64(-0.25 * Float64(b_m * Float64(Float64(t_1 * sqrt(Float64(Float64(Float64(Float64(t_0 + t_0) * Float64(Float64(a_m * a_m) * Float64(a_m * a_m))) / t_1) * 8.0))) / Float64(a_m * a_m)))) end
a_m = abs(a); b_m = abs(b); function tmp = code(a_m, b_m, angle, x_45_scale, y_45_scale) t_0 = 1.0 / (x_45_scale * x_45_scale); t_1 = ((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale; tmp = -0.25 * (b_m * ((t_1 * sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / t_1) * 8.0))) / (a_m * a_m))); end
a_m = N[Abs[a], $MachinePrecision]
b_m = N[Abs[b], $MachinePrecision]
code[a$95$m_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(1.0 / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]}, N[(-0.25 * N[(b$95$m * N[(N[(t$95$1 * N[Sqrt[N[(N[(N[(N[(t$95$0 + t$95$0), $MachinePrecision] * N[(N[(a$95$m * a$95$m), $MachinePrecision] * N[(a$95$m * a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] * 8.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(a$95$m * a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
a_m = \left|a\right|
\\
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \frac{1}{x-scale \cdot x-scale}\\
t_1 := \left(\left(x-scale \cdot y-scale\right) \cdot x-scale\right) \cdot y-scale\\
-0.25 \cdot \left(b\_m \cdot \frac{t\_1 \cdot \sqrt{\frac{\left(t\_0 + t\_0\right) \cdot \left(\left(a\_m \cdot a\_m\right) \cdot \left(a\_m \cdot a\_m\right)\right)}{t\_1} \cdot 8}}{a\_m \cdot a\_m}\right)
\end{array}
\end{array}
Initial program 2.5%
Taylor expanded in b around -inf
Applied rewrites0.1%
Taylor expanded in angle around 0
lower-+.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lower-pow.f640.2
Applied rewrites0.2%
Applied rewrites0.2%
a_m = (fabs.f64 a)
b_m = (fabs.f64 b)
(FPCore (a_m b_m angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ 1.0 (* x-scale x-scale))))
(/
(*
-0.25
(*
(* b_m (* x-scale x-scale))
(*
(sqrt
(*
(/
(* (+ t_0 t_0) (* (* a_m a_m) (* a_m a_m)))
(* (* (* x-scale y-scale) x-scale) y-scale))
8.0))
(* y-scale y-scale))))
(* a_m a_m))))a_m = fabs(a);
b_m = fabs(b);
double code(double a_m, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 1.0 / (x_45_scale * x_45_scale);
return (-0.25 * ((b_m * (x_45_scale * x_45_scale)) * (sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / (((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale)) * 8.0)) * (y_45_scale * y_45_scale)))) / (a_m * a_m);
}
a_m = private
b_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a_m, b_m, angle, x_45scale, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a_m
real(8), intent (in) :: b_m
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
real(8) :: t_0
t_0 = 1.0d0 / (x_45scale * x_45scale)
code = ((-0.25d0) * ((b_m * (x_45scale * x_45scale)) * (sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / (((x_45scale * y_45scale) * x_45scale) * y_45scale)) * 8.0d0)) * (y_45scale * y_45scale)))) / (a_m * a_m)
end function
a_m = Math.abs(a);
b_m = Math.abs(b);
public static double code(double a_m, double b_m, double angle, double x_45_scale, double y_45_scale) {
double t_0 = 1.0 / (x_45_scale * x_45_scale);
return (-0.25 * ((b_m * (x_45_scale * x_45_scale)) * (Math.sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / (((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale)) * 8.0)) * (y_45_scale * y_45_scale)))) / (a_m * a_m);
}
a_m = math.fabs(a) b_m = math.fabs(b) def code(a_m, b_m, angle, x_45_scale, y_45_scale): t_0 = 1.0 / (x_45_scale * x_45_scale) return (-0.25 * ((b_m * (x_45_scale * x_45_scale)) * (math.sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / (((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale)) * 8.0)) * (y_45_scale * y_45_scale)))) / (a_m * a_m)
a_m = abs(a) b_m = abs(b) function code(a_m, b_m, angle, x_45_scale, y_45_scale) t_0 = Float64(1.0 / Float64(x_45_scale * x_45_scale)) return Float64(Float64(-0.25 * Float64(Float64(b_m * Float64(x_45_scale * x_45_scale)) * Float64(sqrt(Float64(Float64(Float64(Float64(t_0 + t_0) * Float64(Float64(a_m * a_m) * Float64(a_m * a_m))) / Float64(Float64(Float64(x_45_scale * y_45_scale) * x_45_scale) * y_45_scale)) * 8.0)) * Float64(y_45_scale * y_45_scale)))) / Float64(a_m * a_m)) end
a_m = abs(a); b_m = abs(b); function tmp = code(a_m, b_m, angle, x_45_scale, y_45_scale) t_0 = 1.0 / (x_45_scale * x_45_scale); tmp = (-0.25 * ((b_m * (x_45_scale * x_45_scale)) * (sqrt(((((t_0 + t_0) * ((a_m * a_m) * (a_m * a_m))) / (((x_45_scale * y_45_scale) * x_45_scale) * y_45_scale)) * 8.0)) * (y_45_scale * y_45_scale)))) / (a_m * a_m); end
a_m = N[Abs[a], $MachinePrecision]
b_m = N[Abs[b], $MachinePrecision]
code[a$95$m_, b$95$m_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(1.0 / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, N[(N[(-0.25 * N[(N[(b$95$m * N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(N[(N[(N[(t$95$0 + t$95$0), $MachinePrecision] * N[(N[(a$95$m * a$95$m), $MachinePrecision] * N[(a$95$m * a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(x$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * y$45$scale), $MachinePrecision]), $MachinePrecision] * 8.0), $MachinePrecision]], $MachinePrecision] * N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a$95$m * a$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
b_m = \left|b\right|
\\
\begin{array}{l}
t_0 := \frac{1}{x-scale \cdot x-scale}\\
\frac{-0.25 \cdot \left(\left(b\_m \cdot \left(x-scale \cdot x-scale\right)\right) \cdot \left(\sqrt{\frac{\left(t\_0 + t\_0\right) \cdot \left(\left(a\_m \cdot a\_m\right) \cdot \left(a\_m \cdot a\_m\right)\right)}{\left(\left(x-scale \cdot y-scale\right) \cdot x-scale\right) \cdot y-scale} \cdot 8} \cdot \left(y-scale \cdot y-scale\right)\right)\right)}{a\_m \cdot a\_m}
\end{array}
\end{array}
Initial program 2.5%
Taylor expanded in b around -inf
Applied rewrites0.1%
Taylor expanded in angle around 0
lower-+.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lower-pow.f640.2
Applied rewrites0.2%
Applied rewrites0.2%
herbie shell --seed 2025151
(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))))