
(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}
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}
Herbie found 12 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}
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}
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* b (fabs a)))
(t_1 (- (fabs a)))
(t_2 (* (* t_0 b) t_1))
(t_3 (pow (fabs y-scale) 2.0))
(t_4 (* x-scale (fabs y-scale)))
(t_5 (* (fabs y-scale) (fabs y-scale)))
(t_6 (/ (fabs a) t_5))
(t_7 (/ b (* x-scale x-scale)))
(t_8 (* 0.5 (cos (* 2.0 (* (* PI angle) 0.005555555555555556)))))
(t_9 (fma (- 0.5 t_8) (* (fabs a) (fabs a)) (* (+ 0.5 t_8) (* b b)))))
(if (<= (fabs y-scale) 4.7e-132)
(/
(/
(-
(sqrt
(*
(* t_2 (* (* 4.0 (/ t_2 (* (* t_5 x-scale) x-scale))) 2.0))
(fma
b
t_7
(fma (fabs a) t_6 (fabs (- (* (fabs a) t_6) (* b t_7))))))))
(/ (* t_0 4.0) t_4))
(* t_1 (/ b t_4)))
(if (<= (fabs y-scale) 96.0)
(*
0.25
(*
(fabs a)
(*
(pow x-scale 2.0)
(*
t_3
(sqrt
(*
8.0
(/
(+ (sqrt (/ 1.0 (pow (fabs y-scale) 4.0))) (/ 1.0 t_3))
(* (pow x-scale 2.0) t_3))))))))
(*
(/ 0.25 t_0)
(/
(*
(/
(sqrt (* 8.0 (* (pow t_0 4.0) (+ (fabs t_9) t_9))))
(fabs (fabs y-scale)))
t_5)
t_0))))))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = b * fabs(a);
double t_1 = -fabs(a);
double t_2 = (t_0 * b) * t_1;
double t_3 = pow(fabs(y_45_scale), 2.0);
double t_4 = x_45_scale * fabs(y_45_scale);
double t_5 = fabs(y_45_scale) * fabs(y_45_scale);
double t_6 = fabs(a) / t_5;
double t_7 = b / (x_45_scale * x_45_scale);
double t_8 = 0.5 * cos((2.0 * ((((double) M_PI) * angle) * 0.005555555555555556)));
double t_9 = fma((0.5 - t_8), (fabs(a) * fabs(a)), ((0.5 + t_8) * (b * b)));
double tmp;
if (fabs(y_45_scale) <= 4.7e-132) {
tmp = (-sqrt(((t_2 * ((4.0 * (t_2 / ((t_5 * x_45_scale) * x_45_scale))) * 2.0)) * fma(b, t_7, fma(fabs(a), t_6, fabs(((fabs(a) * t_6) - (b * t_7))))))) / ((t_0 * 4.0) / t_4)) / (t_1 * (b / t_4));
} else if (fabs(y_45_scale) <= 96.0) {
tmp = 0.25 * (fabs(a) * (pow(x_45_scale, 2.0) * (t_3 * sqrt((8.0 * ((sqrt((1.0 / pow(fabs(y_45_scale), 4.0))) + (1.0 / t_3)) / (pow(x_45_scale, 2.0) * t_3)))))));
} else {
tmp = (0.25 / t_0) * (((sqrt((8.0 * (pow(t_0, 4.0) * (fabs(t_9) + t_9)))) / fabs(fabs(y_45_scale))) * t_5) / t_0);
}
return tmp;
}
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(b * abs(a)) t_1 = Float64(-abs(a)) t_2 = Float64(Float64(t_0 * b) * t_1) t_3 = abs(y_45_scale) ^ 2.0 t_4 = Float64(x_45_scale * abs(y_45_scale)) t_5 = Float64(abs(y_45_scale) * abs(y_45_scale)) t_6 = Float64(abs(a) / t_5) t_7 = Float64(b / Float64(x_45_scale * x_45_scale)) t_8 = Float64(0.5 * cos(Float64(2.0 * Float64(Float64(pi * angle) * 0.005555555555555556)))) t_9 = fma(Float64(0.5 - t_8), Float64(abs(a) * abs(a)), Float64(Float64(0.5 + t_8) * Float64(b * b))) tmp = 0.0 if (abs(y_45_scale) <= 4.7e-132) tmp = Float64(Float64(Float64(-sqrt(Float64(Float64(t_2 * Float64(Float64(4.0 * Float64(t_2 / Float64(Float64(t_5 * x_45_scale) * x_45_scale))) * 2.0)) * fma(b, t_7, fma(abs(a), t_6, abs(Float64(Float64(abs(a) * t_6) - Float64(b * t_7)))))))) / Float64(Float64(t_0 * 4.0) / t_4)) / Float64(t_1 * Float64(b / t_4))); elseif (abs(y_45_scale) <= 96.0) tmp = Float64(0.25 * Float64(abs(a) * Float64((x_45_scale ^ 2.0) * Float64(t_3 * sqrt(Float64(8.0 * Float64(Float64(sqrt(Float64(1.0 / (abs(y_45_scale) ^ 4.0))) + Float64(1.0 / t_3)) / Float64((x_45_scale ^ 2.0) * t_3)))))))); else tmp = Float64(Float64(0.25 / t_0) * Float64(Float64(Float64(sqrt(Float64(8.0 * Float64((t_0 ^ 4.0) * Float64(abs(t_9) + t_9)))) / abs(abs(y_45_scale))) * t_5) / t_0)); end return tmp end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(b * N[Abs[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[Abs[a], $MachinePrecision])}, Block[{t$95$2 = N[(N[(t$95$0 * b), $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Abs[y$45$scale], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(x$45$scale * N[Abs[y$45$scale], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Abs[y$45$scale], $MachinePrecision] * N[Abs[y$45$scale], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[Abs[a], $MachinePrecision] / t$95$5), $MachinePrecision]}, Block[{t$95$7 = N[(b / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$8 = N[(0.5 * N[Cos[N[(2.0 * N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$9 = N[(N[(0.5 - t$95$8), $MachinePrecision] * N[(N[Abs[a], $MachinePrecision] * N[Abs[a], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 + t$95$8), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[y$45$scale], $MachinePrecision], 4.7e-132], N[(N[((-N[Sqrt[N[(N[(t$95$2 * N[(N[(4.0 * N[(t$95$2 / N[(N[(t$95$5 * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * N[(b * t$95$7 + N[(N[Abs[a], $MachinePrecision] * t$95$6 + N[Abs[N[(N[(N[Abs[a], $MachinePrecision] * t$95$6), $MachinePrecision] - N[(b * t$95$7), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(t$95$0 * 4.0), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 * N[(b / t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[y$45$scale], $MachinePrecision], 96.0], N[(0.25 * N[(N[Abs[a], $MachinePrecision] * N[(N[Power[x$45$scale, 2.0], $MachinePrecision] * N[(t$95$3 * N[Sqrt[N[(8.0 * N[(N[(N[Sqrt[N[(1.0 / N[Power[N[Abs[y$45$scale], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / t$95$3), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x$45$scale, 2.0], $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.25 / t$95$0), $MachinePrecision] * N[(N[(N[(N[Sqrt[N[(8.0 * N[(N[Power[t$95$0, 4.0], $MachinePrecision] * N[(N[Abs[t$95$9], $MachinePrecision] + t$95$9), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[N[Abs[y$45$scale], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$5), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]
\begin{array}{l}
t_0 := b \cdot \left|a\right|\\
t_1 := -\left|a\right|\\
t_2 := \left(t\_0 \cdot b\right) \cdot t\_1\\
t_3 := {\left(\left|y-scale\right|\right)}^{2}\\
t_4 := x-scale \cdot \left|y-scale\right|\\
t_5 := \left|y-scale\right| \cdot \left|y-scale\right|\\
t_6 := \frac{\left|a\right|}{t\_5}\\
t_7 := \frac{b}{x-scale \cdot x-scale}\\
t_8 := 0.5 \cdot \cos \left(2 \cdot \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)\\
t_9 := \mathsf{fma}\left(0.5 - t\_8, \left|a\right| \cdot \left|a\right|, \left(0.5 + t\_8\right) \cdot \left(b \cdot b\right)\right)\\
\mathbf{if}\;\left|y-scale\right| \leq 4.7 \cdot 10^{-132}:\\
\;\;\;\;\frac{\frac{-\sqrt{\left(t\_2 \cdot \left(\left(4 \cdot \frac{t\_2}{\left(t\_5 \cdot x-scale\right) \cdot x-scale}\right) \cdot 2\right)\right) \cdot \mathsf{fma}\left(b, t\_7, \mathsf{fma}\left(\left|a\right|, t\_6, \left|\left|a\right| \cdot t\_6 - b \cdot t\_7\right|\right)\right)}}{\frac{t\_0 \cdot 4}{t\_4}}}{t\_1 \cdot \frac{b}{t\_4}}\\
\mathbf{elif}\;\left|y-scale\right| \leq 96:\\
\;\;\;\;0.25 \cdot \left(\left|a\right| \cdot \left({x-scale}^{2} \cdot \left(t\_3 \cdot \sqrt{8 \cdot \frac{\sqrt{\frac{1}{{\left(\left|y-scale\right|\right)}^{4}}} + \frac{1}{t\_3}}{{x-scale}^{2} \cdot t\_3}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25}{t\_0} \cdot \frac{\frac{\sqrt{8 \cdot \left({t\_0}^{4} \cdot \left(\left|t\_9\right| + t\_9\right)\right)}}{\left|\left|y-scale\right|\right|} \cdot t\_5}{t\_0}\\
\end{array}
if y-scale < 4.7000000000000002e-132Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites4.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
Applied rewrites5.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
Applied rewrites7.6%
Applied rewrites6.6%
if 4.7000000000000002e-132 < y-scale < 96Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites0.4%
Taylor expanded in a around inf
lower-/.f64N/A
Applied rewrites0.8%
Taylor expanded in b around 0
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
Applied rewrites2.6%
if 96 < y-scale Initial program 2.7%
Taylor expanded in x-scale around 0
Applied rewrites1.1%
Applied rewrites17.0%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ b (* x-scale x-scale)))
(t_1 (* b (fabs a)))
(t_2 (- (fabs a)))
(t_3 (pow (fabs y-scale) 2.0))
(t_4 (* x-scale (fabs y-scale)))
(t_5 (* (* t_1 b) t_2))
(t_6 (* 0.5 (cos (* 2.0 (* (* PI angle) 0.005555555555555556)))))
(t_7 (* (fabs y-scale) (fabs y-scale)))
(t_8 (/ (fabs a) t_7))
(t_9 (fma (- 0.5 t_6) (* (fabs a) (fabs a)) (* (+ 0.5 t_6) (* b b)))))
(if (<= (fabs y-scale) 4.7e-132)
(/
(/
(-
(sqrt
(*
(* t_5 (* (* 4.0 (/ t_5 (* (* t_7 x-scale) x-scale))) 2.0))
(fma
b
t_0
(fma (fabs a) t_8 (fabs (- (* (fabs a) t_8) (* b t_0))))))))
(/ (* t_1 4.0) t_4))
(* t_2 (/ b t_4)))
(if (<= (fabs y-scale) 96.0)
(*
0.25
(*
(fabs a)
(*
(pow x-scale 2.0)
(*
t_3
(sqrt
(*
8.0
(/
(+ (sqrt (/ 1.0 (pow (fabs y-scale) 4.0))) (/ 1.0 t_3))
(* (pow x-scale 2.0) t_3))))))))
(*
0.25
(*
(/
(/
(sqrt (* 8.0 (* (pow t_1 4.0) (+ (fabs t_9) t_9))))
(fabs (fabs y-scale)))
t_1)
(/ t_7 t_1)))))))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = b / (x_45_scale * x_45_scale);
double t_1 = b * fabs(a);
double t_2 = -fabs(a);
double t_3 = pow(fabs(y_45_scale), 2.0);
double t_4 = x_45_scale * fabs(y_45_scale);
double t_5 = (t_1 * b) * t_2;
double t_6 = 0.5 * cos((2.0 * ((((double) M_PI) * angle) * 0.005555555555555556)));
double t_7 = fabs(y_45_scale) * fabs(y_45_scale);
double t_8 = fabs(a) / t_7;
double t_9 = fma((0.5 - t_6), (fabs(a) * fabs(a)), ((0.5 + t_6) * (b * b)));
double tmp;
if (fabs(y_45_scale) <= 4.7e-132) {
tmp = (-sqrt(((t_5 * ((4.0 * (t_5 / ((t_7 * x_45_scale) * x_45_scale))) * 2.0)) * fma(b, t_0, fma(fabs(a), t_8, fabs(((fabs(a) * t_8) - (b * t_0))))))) / ((t_1 * 4.0) / t_4)) / (t_2 * (b / t_4));
} else if (fabs(y_45_scale) <= 96.0) {
tmp = 0.25 * (fabs(a) * (pow(x_45_scale, 2.0) * (t_3 * sqrt((8.0 * ((sqrt((1.0 / pow(fabs(y_45_scale), 4.0))) + (1.0 / t_3)) / (pow(x_45_scale, 2.0) * t_3)))))));
} else {
tmp = 0.25 * (((sqrt((8.0 * (pow(t_1, 4.0) * (fabs(t_9) + t_9)))) / fabs(fabs(y_45_scale))) / t_1) * (t_7 / t_1));
}
return tmp;
}
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(b / Float64(x_45_scale * x_45_scale)) t_1 = Float64(b * abs(a)) t_2 = Float64(-abs(a)) t_3 = abs(y_45_scale) ^ 2.0 t_4 = Float64(x_45_scale * abs(y_45_scale)) t_5 = Float64(Float64(t_1 * b) * t_2) t_6 = Float64(0.5 * cos(Float64(2.0 * Float64(Float64(pi * angle) * 0.005555555555555556)))) t_7 = Float64(abs(y_45_scale) * abs(y_45_scale)) t_8 = Float64(abs(a) / t_7) t_9 = fma(Float64(0.5 - t_6), Float64(abs(a) * abs(a)), Float64(Float64(0.5 + t_6) * Float64(b * b))) tmp = 0.0 if (abs(y_45_scale) <= 4.7e-132) tmp = Float64(Float64(Float64(-sqrt(Float64(Float64(t_5 * Float64(Float64(4.0 * Float64(t_5 / Float64(Float64(t_7 * x_45_scale) * x_45_scale))) * 2.0)) * fma(b, t_0, fma(abs(a), t_8, abs(Float64(Float64(abs(a) * t_8) - Float64(b * t_0)))))))) / Float64(Float64(t_1 * 4.0) / t_4)) / Float64(t_2 * Float64(b / t_4))); elseif (abs(y_45_scale) <= 96.0) tmp = Float64(0.25 * Float64(abs(a) * Float64((x_45_scale ^ 2.0) * Float64(t_3 * sqrt(Float64(8.0 * Float64(Float64(sqrt(Float64(1.0 / (abs(y_45_scale) ^ 4.0))) + Float64(1.0 / t_3)) / Float64((x_45_scale ^ 2.0) * t_3)))))))); else tmp = Float64(0.25 * Float64(Float64(Float64(sqrt(Float64(8.0 * Float64((t_1 ^ 4.0) * Float64(abs(t_9) + t_9)))) / abs(abs(y_45_scale))) / t_1) * Float64(t_7 / t_1))); end return tmp end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(b / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(b * N[Abs[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-N[Abs[a], $MachinePrecision])}, Block[{t$95$3 = N[Power[N[Abs[y$45$scale], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(x$45$scale * N[Abs[y$45$scale], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$1 * b), $MachinePrecision] * t$95$2), $MachinePrecision]}, Block[{t$95$6 = N[(0.5 * N[Cos[N[(2.0 * N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(N[Abs[y$45$scale], $MachinePrecision] * N[Abs[y$45$scale], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$8 = N[(N[Abs[a], $MachinePrecision] / t$95$7), $MachinePrecision]}, Block[{t$95$9 = N[(N[(0.5 - t$95$6), $MachinePrecision] * N[(N[Abs[a], $MachinePrecision] * N[Abs[a], $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 + t$95$6), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[y$45$scale], $MachinePrecision], 4.7e-132], N[(N[((-N[Sqrt[N[(N[(t$95$5 * N[(N[(4.0 * N[(t$95$5 / N[(N[(t$95$7 * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * N[(b * t$95$0 + N[(N[Abs[a], $MachinePrecision] * t$95$8 + N[Abs[N[(N[(N[Abs[a], $MachinePrecision] * t$95$8), $MachinePrecision] - N[(b * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(t$95$1 * 4.0), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 * N[(b / t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[y$45$scale], $MachinePrecision], 96.0], N[(0.25 * N[(N[Abs[a], $MachinePrecision] * N[(N[Power[x$45$scale, 2.0], $MachinePrecision] * N[(t$95$3 * N[Sqrt[N[(8.0 * N[(N[(N[Sqrt[N[(1.0 / N[Power[N[Abs[y$45$scale], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / t$95$3), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x$45$scale, 2.0], $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(N[(N[Sqrt[N[(8.0 * N[(N[Power[t$95$1, 4.0], $MachinePrecision] * N[(N[Abs[t$95$9], $MachinePrecision] + t$95$9), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[N[Abs[y$45$scale], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] * N[(t$95$7 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]
\begin{array}{l}
t_0 := \frac{b}{x-scale \cdot x-scale}\\
t_1 := b \cdot \left|a\right|\\
t_2 := -\left|a\right|\\
t_3 := {\left(\left|y-scale\right|\right)}^{2}\\
t_4 := x-scale \cdot \left|y-scale\right|\\
t_5 := \left(t\_1 \cdot b\right) \cdot t\_2\\
t_6 := 0.5 \cdot \cos \left(2 \cdot \left(\left(\pi \cdot angle\right) \cdot 0.005555555555555556\right)\right)\\
t_7 := \left|y-scale\right| \cdot \left|y-scale\right|\\
t_8 := \frac{\left|a\right|}{t\_7}\\
t_9 := \mathsf{fma}\left(0.5 - t\_6, \left|a\right| \cdot \left|a\right|, \left(0.5 + t\_6\right) \cdot \left(b \cdot b\right)\right)\\
\mathbf{if}\;\left|y-scale\right| \leq 4.7 \cdot 10^{-132}:\\
\;\;\;\;\frac{\frac{-\sqrt{\left(t\_5 \cdot \left(\left(4 \cdot \frac{t\_5}{\left(t\_7 \cdot x-scale\right) \cdot x-scale}\right) \cdot 2\right)\right) \cdot \mathsf{fma}\left(b, t\_0, \mathsf{fma}\left(\left|a\right|, t\_8, \left|\left|a\right| \cdot t\_8 - b \cdot t\_0\right|\right)\right)}}{\frac{t\_1 \cdot 4}{t\_4}}}{t\_2 \cdot \frac{b}{t\_4}}\\
\mathbf{elif}\;\left|y-scale\right| \leq 96:\\
\;\;\;\;0.25 \cdot \left(\left|a\right| \cdot \left({x-scale}^{2} \cdot \left(t\_3 \cdot \sqrt{8 \cdot \frac{\sqrt{\frac{1}{{\left(\left|y-scale\right|\right)}^{4}}} + \frac{1}{t\_3}}{{x-scale}^{2} \cdot t\_3}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\frac{\frac{\sqrt{8 \cdot \left({t\_1}^{4} \cdot \left(\left|t\_9\right| + t\_9\right)\right)}}{\left|\left|y-scale\right|\right|}}{t\_1} \cdot \frac{t\_7}{t\_1}\right)\\
\end{array}
if y-scale < 4.7000000000000002e-132Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites4.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
Applied rewrites5.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
Applied rewrites7.6%
Applied rewrites6.6%
if 4.7000000000000002e-132 < y-scale < 96Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites0.4%
Taylor expanded in a around inf
lower-/.f64N/A
Applied rewrites0.8%
Taylor expanded in b around 0
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
Applied rewrites2.6%
if 96 < y-scale Initial program 2.7%
Taylor expanded in x-scale around 0
Applied rewrites1.1%
Applied rewrites15.8%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (* PI angle) 0.005555555555555556))
(t_1 (* (fabs b) (fabs a)))
(t_2 (* (fabs a) (fabs a)))
(t_3 (* 0.5 (cos (* 2.0 t_0))))
(t_4 (- 0.5 t_3))
(t_5 (fma t_4 t_2 (* (+ 0.5 t_3) (* (fabs b) (fabs b))))))
(if (<= (fabs a) 9e-42)
(*
(*
(* y-scale y-scale)
(/
(/ (sqrt (* 8.0 (* (pow t_1 4.0) (+ (fabs t_5) t_5)))) (fabs y-scale))
(* (* t_2 (fabs b)) (fabs b))))
0.25)
(if (<= (fabs a) 4.6e+182)
(*
(/
(*
(*
(/
(sqrt (* 8.0 (* (pow (fabs b) 4.0) (pow (fabs a) 6.0))))
(fabs (fabs x-scale)))
(fabs x-scale))
(fabs x-scale))
t_1)
(/ 0.25 t_1))
(*
(/ 0.25 (fabs a))
(/
(*
(*
(* (* (* y-scale y-scale) (fabs x-scale)) (fabs x-scale))
(/
(/
(sqrt
(*
8.0
(*
(+
(/ t_4 (* y-scale y-scale))
(sqrt
(/
(pow (sin t_0) 4.0)
(* (* y-scale y-scale) (* y-scale y-scale)))))
(pow (fabs a) 4.0))))
(fabs y-scale))
(fabs x-scale)))
(fabs b))
(fabs a)))))))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (((double) M_PI) * angle) * 0.005555555555555556;
double t_1 = fabs(b) * fabs(a);
double t_2 = fabs(a) * fabs(a);
double t_3 = 0.5 * cos((2.0 * t_0));
double t_4 = 0.5 - t_3;
double t_5 = fma(t_4, t_2, ((0.5 + t_3) * (fabs(b) * fabs(b))));
double tmp;
if (fabs(a) <= 9e-42) {
tmp = ((y_45_scale * y_45_scale) * ((sqrt((8.0 * (pow(t_1, 4.0) * (fabs(t_5) + t_5)))) / fabs(y_45_scale)) / ((t_2 * fabs(b)) * fabs(b)))) * 0.25;
} else if (fabs(a) <= 4.6e+182) {
tmp = ((((sqrt((8.0 * (pow(fabs(b), 4.0) * pow(fabs(a), 6.0)))) / fabs(fabs(x_45_scale))) * fabs(x_45_scale)) * fabs(x_45_scale)) / t_1) * (0.25 / t_1);
} else {
tmp = (0.25 / fabs(a)) * ((((((y_45_scale * y_45_scale) * fabs(x_45_scale)) * fabs(x_45_scale)) * ((sqrt((8.0 * (((t_4 / (y_45_scale * y_45_scale)) + sqrt((pow(sin(t_0), 4.0) / ((y_45_scale * y_45_scale) * (y_45_scale * y_45_scale))))) * pow(fabs(a), 4.0)))) / fabs(y_45_scale)) / fabs(x_45_scale))) * fabs(b)) / fabs(a));
}
return tmp;
}
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(pi * angle) * 0.005555555555555556) t_1 = Float64(abs(b) * abs(a)) t_2 = Float64(abs(a) * abs(a)) t_3 = Float64(0.5 * cos(Float64(2.0 * t_0))) t_4 = Float64(0.5 - t_3) t_5 = fma(t_4, t_2, Float64(Float64(0.5 + t_3) * Float64(abs(b) * abs(b)))) tmp = 0.0 if (abs(a) <= 9e-42) tmp = Float64(Float64(Float64(y_45_scale * y_45_scale) * Float64(Float64(sqrt(Float64(8.0 * Float64((t_1 ^ 4.0) * Float64(abs(t_5) + t_5)))) / abs(y_45_scale)) / Float64(Float64(t_2 * abs(b)) * abs(b)))) * 0.25); elseif (abs(a) <= 4.6e+182) tmp = Float64(Float64(Float64(Float64(Float64(sqrt(Float64(8.0 * Float64((abs(b) ^ 4.0) * (abs(a) ^ 6.0)))) / abs(abs(x_45_scale))) * abs(x_45_scale)) * abs(x_45_scale)) / t_1) * Float64(0.25 / t_1)); else tmp = Float64(Float64(0.25 / abs(a)) * Float64(Float64(Float64(Float64(Float64(Float64(y_45_scale * y_45_scale) * abs(x_45_scale)) * abs(x_45_scale)) * Float64(Float64(sqrt(Float64(8.0 * Float64(Float64(Float64(t_4 / Float64(y_45_scale * y_45_scale)) + sqrt(Float64((sin(t_0) ^ 4.0) / Float64(Float64(y_45_scale * y_45_scale) * Float64(y_45_scale * y_45_scale))))) * (abs(a) ^ 4.0)))) / abs(y_45_scale)) / abs(x_45_scale))) * abs(b)) / abs(a))); end return tmp end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(Pi * angle), $MachinePrecision] * 0.005555555555555556), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[b], $MachinePrecision] * N[Abs[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[a], $MachinePrecision] * N[Abs[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(0.5 * N[Cos[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(0.5 - t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 * t$95$2 + N[(N[(0.5 + t$95$3), $MachinePrecision] * N[(N[Abs[b], $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[a], $MachinePrecision], 9e-42], N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * N[(N[(N[Sqrt[N[(8.0 * N[(N[Power[t$95$1, 4.0], $MachinePrecision] * N[(N[Abs[t$95$5], $MachinePrecision] + t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[y$45$scale], $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$2 * N[Abs[b], $MachinePrecision]), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision], If[LessEqual[N[Abs[a], $MachinePrecision], 4.6e+182], N[(N[(N[(N[(N[(N[Sqrt[N[(8.0 * N[(N[Power[N[Abs[b], $MachinePrecision], 4.0], $MachinePrecision] * N[Power[N[Abs[a], $MachinePrecision], 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[N[Abs[x$45$scale], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] * N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] * N[(0.25 / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(0.25 / N[Abs[a], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] * N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[N[(8.0 * N[(N[(N[(t$95$4 / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[Power[N[Sin[t$95$0], $MachinePrecision], 4.0], $MachinePrecision] / N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Power[N[Abs[a], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[y$45$scale], $MachinePrecision]), $MachinePrecision] / N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[b], $MachinePrecision]), $MachinePrecision] / N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := \left(\pi \cdot angle\right) \cdot 0.005555555555555556\\
t_1 := \left|b\right| \cdot \left|a\right|\\
t_2 := \left|a\right| \cdot \left|a\right|\\
t_3 := 0.5 \cdot \cos \left(2 \cdot t\_0\right)\\
t_4 := 0.5 - t\_3\\
t_5 := \mathsf{fma}\left(t\_4, t\_2, \left(0.5 + t\_3\right) \cdot \left(\left|b\right| \cdot \left|b\right|\right)\right)\\
\mathbf{if}\;\left|a\right| \leq 9 \cdot 10^{-42}:\\
\;\;\;\;\left(\left(y-scale \cdot y-scale\right) \cdot \frac{\frac{\sqrt{8 \cdot \left({t\_1}^{4} \cdot \left(\left|t\_5\right| + t\_5\right)\right)}}{\left|y-scale\right|}}{\left(t\_2 \cdot \left|b\right|\right) \cdot \left|b\right|}\right) \cdot 0.25\\
\mathbf{elif}\;\left|a\right| \leq 4.6 \cdot 10^{+182}:\\
\;\;\;\;\frac{\left(\frac{\sqrt{8 \cdot \left({\left(\left|b\right|\right)}^{4} \cdot {\left(\left|a\right|\right)}^{6}\right)}}{\left|\left|x-scale\right|\right|} \cdot \left|x-scale\right|\right) \cdot \left|x-scale\right|}{t\_1} \cdot \frac{0.25}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25}{\left|a\right|} \cdot \frac{\left(\left(\left(\left(y-scale \cdot y-scale\right) \cdot \left|x-scale\right|\right) \cdot \left|x-scale\right|\right) \cdot \frac{\frac{\sqrt{8 \cdot \left(\left(\frac{t\_4}{y-scale \cdot y-scale} + \sqrt{\frac{{\sin t\_0}^{4}}{\left(y-scale \cdot y-scale\right) \cdot \left(y-scale \cdot y-scale\right)}}\right) \cdot {\left(\left|a\right|\right)}^{4}\right)}}{\left|y-scale\right|}}{\left|x-scale\right|}\right) \cdot \left|b\right|}{\left|a\right|}\\
\end{array}
if a < 9.0000000000000002e-42Initial program 2.7%
Taylor expanded in x-scale around 0
Applied rewrites1.1%
Applied rewrites8.1%
if 9.0000000000000002e-42 < a < 4.6000000000000001e182Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites0.4%
Applied rewrites0.6%
Taylor expanded in y-scale around 0
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-pow.f640.9%
Applied rewrites0.9%
Applied rewrites10.7%
if 4.6000000000000001e182 < a Initial program 2.7%
Taylor expanded in b around inf
Applied rewrites0.8%
Taylor expanded in x-scale around inf
lower-/.f64N/A
Applied rewrites1.4%
Applied rewrites3.5%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* (fabs b) a))
(t_1 (/ a (* y-scale y-scale)))
(t_2
(*
(/ (* 4.0 (* a (fabs b))) (* y-scale x-scale))
(/ (* (- a) (fabs b)) (* y-scale x-scale))))
(t_3 (* (* t_0 (fabs b)) (- a)))
(t_4 (/ (fabs b) (* x-scale x-scale)))
(t_5
(fma (fabs b) t_4 (fma a t_1 (fabs (- (* a t_1) (* (fabs b) t_4)))))))
(if (<= (fabs b) 2.45e-145)
(/
(/
(-
(sqrt
(*
(*
t_3
(* (* 4.0 (/ t_3 (* (* (* y-scale y-scale) x-scale) x-scale))) 2.0))
t_5)))
(/ (* t_0 4.0) (* x-scale y-scale)))
(* (- a) (/ (fabs b) (* x-scale y-scale))))
(if (<= (fabs b) 9.8e+213)
(*
(/
(*
(*
(/ (sqrt (* 8.0 (* (pow (fabs b) 4.0) (pow a 6.0)))) (fabs x-scale))
x-scale)
x-scale)
t_0)
(/ 0.25 t_0))
(/
(- (sqrt (* (* (* 2.0 t_2) (* t_0 (* (fabs b) (- a)))) t_5)))
t_2)))))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = fabs(b) * a;
double t_1 = a / (y_45_scale * y_45_scale);
double t_2 = ((4.0 * (a * fabs(b))) / (y_45_scale * x_45_scale)) * ((-a * fabs(b)) / (y_45_scale * x_45_scale));
double t_3 = (t_0 * fabs(b)) * -a;
double t_4 = fabs(b) / (x_45_scale * x_45_scale);
double t_5 = fma(fabs(b), t_4, fma(a, t_1, fabs(((a * t_1) - (fabs(b) * t_4)))));
double tmp;
if (fabs(b) <= 2.45e-145) {
tmp = (-sqrt(((t_3 * ((4.0 * (t_3 / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale))) * 2.0)) * t_5)) / ((t_0 * 4.0) / (x_45_scale * y_45_scale))) / (-a * (fabs(b) / (x_45_scale * y_45_scale)));
} else if (fabs(b) <= 9.8e+213) {
tmp = ((((sqrt((8.0 * (pow(fabs(b), 4.0) * pow(a, 6.0)))) / fabs(x_45_scale)) * x_45_scale) * x_45_scale) / t_0) * (0.25 / t_0);
} else {
tmp = -sqrt((((2.0 * t_2) * (t_0 * (fabs(b) * -a))) * t_5)) / t_2;
}
return tmp;
}
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(abs(b) * a) t_1 = Float64(a / Float64(y_45_scale * y_45_scale)) t_2 = Float64(Float64(Float64(4.0 * Float64(a * abs(b))) / Float64(y_45_scale * x_45_scale)) * Float64(Float64(Float64(-a) * abs(b)) / Float64(y_45_scale * x_45_scale))) t_3 = Float64(Float64(t_0 * abs(b)) * Float64(-a)) t_4 = Float64(abs(b) / Float64(x_45_scale * x_45_scale)) t_5 = fma(abs(b), t_4, fma(a, t_1, abs(Float64(Float64(a * t_1) - Float64(abs(b) * t_4))))) tmp = 0.0 if (abs(b) <= 2.45e-145) tmp = Float64(Float64(Float64(-sqrt(Float64(Float64(t_3 * Float64(Float64(4.0 * Float64(t_3 / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale) * x_45_scale))) * 2.0)) * t_5))) / Float64(Float64(t_0 * 4.0) / Float64(x_45_scale * y_45_scale))) / Float64(Float64(-a) * Float64(abs(b) / Float64(x_45_scale * y_45_scale)))); elseif (abs(b) <= 9.8e+213) tmp = Float64(Float64(Float64(Float64(Float64(sqrt(Float64(8.0 * Float64((abs(b) ^ 4.0) * (a ^ 6.0)))) / abs(x_45_scale)) * x_45_scale) * x_45_scale) / t_0) * Float64(0.25 / t_0)); else tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * t_2) * Float64(t_0 * Float64(abs(b) * Float64(-a)))) * t_5))) / t_2); end return tmp end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[Abs[b], $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$1 = N[(a / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(4.0 * N[(a * N[Abs[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[((-a) * N[Abs[b], $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$0 * N[Abs[b], $MachinePrecision]), $MachinePrecision] * (-a)), $MachinePrecision]}, Block[{t$95$4 = N[(N[Abs[b], $MachinePrecision] / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Abs[b], $MachinePrecision] * t$95$4 + N[(a * t$95$1 + N[Abs[N[(N[(a * t$95$1), $MachinePrecision] - N[(N[Abs[b], $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[b], $MachinePrecision], 2.45e-145], N[(N[((-N[Sqrt[N[(N[(t$95$3 * N[(N[(4.0 * N[(t$95$3 / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * t$95$5), $MachinePrecision]], $MachinePrecision]) / N[(N[(t$95$0 * 4.0), $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[((-a) * N[(N[Abs[b], $MachinePrecision] / N[(x$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[b], $MachinePrecision], 9.8e+213], N[(N[(N[(N[(N[(N[Sqrt[N[(8.0 * N[(N[Power[N[Abs[b], $MachinePrecision], 4.0], $MachinePrecision] * N[Power[a, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(0.25 / t$95$0), $MachinePrecision]), $MachinePrecision], N[((-N[Sqrt[N[(N[(N[(2.0 * t$95$2), $MachinePrecision] * N[(t$95$0 * N[(N[Abs[b], $MachinePrecision] * (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$5), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := \left|b\right| \cdot a\\
t_1 := \frac{a}{y-scale \cdot y-scale}\\
t_2 := \frac{4 \cdot \left(a \cdot \left|b\right|\right)}{y-scale \cdot x-scale} \cdot \frac{\left(-a\right) \cdot \left|b\right|}{y-scale \cdot x-scale}\\
t_3 := \left(t\_0 \cdot \left|b\right|\right) \cdot \left(-a\right)\\
t_4 := \frac{\left|b\right|}{x-scale \cdot x-scale}\\
t_5 := \mathsf{fma}\left(\left|b\right|, t\_4, \mathsf{fma}\left(a, t\_1, \left|a \cdot t\_1 - \left|b\right| \cdot t\_4\right|\right)\right)\\
\mathbf{if}\;\left|b\right| \leq 2.45 \cdot 10^{-145}:\\
\;\;\;\;\frac{\frac{-\sqrt{\left(t\_3 \cdot \left(\left(4 \cdot \frac{t\_3}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\right) \cdot x-scale}\right) \cdot 2\right)\right) \cdot t\_5}}{\frac{t\_0 \cdot 4}{x-scale \cdot y-scale}}}{\left(-a\right) \cdot \frac{\left|b\right|}{x-scale \cdot y-scale}}\\
\mathbf{elif}\;\left|b\right| \leq 9.8 \cdot 10^{+213}:\\
\;\;\;\;\frac{\left(\frac{\sqrt{8 \cdot \left({\left(\left|b\right|\right)}^{4} \cdot {a}^{6}\right)}}{\left|x-scale\right|} \cdot x-scale\right) \cdot x-scale}{t\_0} \cdot \frac{0.25}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot t\_2\right) \cdot \left(t\_0 \cdot \left(\left|b\right| \cdot \left(-a\right)\right)\right)\right) \cdot t\_5}}{t\_2}\\
\end{array}
if b < 2.4499999999999998e-145Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites4.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
Applied rewrites5.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
Applied rewrites7.6%
Applied rewrites6.6%
if 2.4499999999999998e-145 < b < 9.7999999999999999e213Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites0.4%
Applied rewrites0.6%
Taylor expanded in y-scale around 0
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-pow.f640.9%
Applied rewrites0.9%
Applied rewrites10.7%
if 9.7999999999999999e213 < b Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites4.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
Applied rewrites5.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
Applied rewrites7.6%
Applied rewrites9.7%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ (* b b) (* (fabs x-scale) (fabs x-scale))))
(t_1 (/ (/ (* a a) y-scale) y-scale))
(t_2 (* y-scale (fabs x-scale)))
(t_3 (* (/ (* 4.0 (* a b)) t_2) (/ (* (- a) b) t_2))))
(if (<= (fabs x-scale) 1.5e+169)
(/
(-
(sqrt
(*
(* (* 2.0 t_3) (* (* b a) (* b (- a))))
(+ (sqrt (pow (- t_0 t_1) 2.0)) (+ t_1 t_0)))))
t_3)
(*
(/
(*
(*
(/ (sqrt (* 8.0 (* (pow b 4.0) (pow a 6.0)))) (fabs (fabs x-scale)))
(fabs x-scale))
(fabs x-scale))
(* b a))
(/ 0.25 (* b a))))))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (b * b) / (fabs(x_45_scale) * fabs(x_45_scale));
double t_1 = ((a * a) / y_45_scale) / y_45_scale;
double t_2 = y_45_scale * fabs(x_45_scale);
double t_3 = ((4.0 * (a * b)) / t_2) * ((-a * b) / t_2);
double tmp;
if (fabs(x_45_scale) <= 1.5e+169) {
tmp = -sqrt((((2.0 * t_3) * ((b * a) * (b * -a))) * (sqrt(pow((t_0 - t_1), 2.0)) + (t_1 + t_0)))) / t_3;
} else {
tmp = ((((sqrt((8.0 * (pow(b, 4.0) * pow(a, 6.0)))) / fabs(fabs(x_45_scale))) * fabs(x_45_scale)) * fabs(x_45_scale)) / (b * a)) * (0.25 / (b * a));
}
return tmp;
}
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, b, angle, x_45scale, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
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
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (b * b) / (abs(x_45scale) * abs(x_45scale))
t_1 = ((a * a) / y_45scale) / y_45scale
t_2 = y_45scale * abs(x_45scale)
t_3 = ((4.0d0 * (a * b)) / t_2) * ((-a * b) / t_2)
if (abs(x_45scale) <= 1.5d+169) then
tmp = -sqrt((((2.0d0 * t_3) * ((b * a) * (b * -a))) * (sqrt(((t_0 - t_1) ** 2.0d0)) + (t_1 + t_0)))) / t_3
else
tmp = ((((sqrt((8.0d0 * ((b ** 4.0d0) * (a ** 6.0d0)))) / abs(abs(x_45scale))) * abs(x_45scale)) * abs(x_45scale)) / (b * a)) * (0.25d0 / (b * a))
end if
code = tmp
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = (b * b) / (Math.abs(x_45_scale) * Math.abs(x_45_scale));
double t_1 = ((a * a) / y_45_scale) / y_45_scale;
double t_2 = y_45_scale * Math.abs(x_45_scale);
double t_3 = ((4.0 * (a * b)) / t_2) * ((-a * b) / t_2);
double tmp;
if (Math.abs(x_45_scale) <= 1.5e+169) {
tmp = -Math.sqrt((((2.0 * t_3) * ((b * a) * (b * -a))) * (Math.sqrt(Math.pow((t_0 - t_1), 2.0)) + (t_1 + t_0)))) / t_3;
} else {
tmp = ((((Math.sqrt((8.0 * (Math.pow(b, 4.0) * Math.pow(a, 6.0)))) / Math.abs(Math.abs(x_45_scale))) * Math.abs(x_45_scale)) * Math.abs(x_45_scale)) / (b * a)) * (0.25 / (b * a));
}
return tmp;
}
def code(a, b, angle, x_45_scale, y_45_scale): t_0 = (b * b) / (math.fabs(x_45_scale) * math.fabs(x_45_scale)) t_1 = ((a * a) / y_45_scale) / y_45_scale t_2 = y_45_scale * math.fabs(x_45_scale) t_3 = ((4.0 * (a * b)) / t_2) * ((-a * b) / t_2) tmp = 0 if math.fabs(x_45_scale) <= 1.5e+169: tmp = -math.sqrt((((2.0 * t_3) * ((b * a) * (b * -a))) * (math.sqrt(math.pow((t_0 - t_1), 2.0)) + (t_1 + t_0)))) / t_3 else: tmp = ((((math.sqrt((8.0 * (math.pow(b, 4.0) * math.pow(a, 6.0)))) / math.fabs(math.fabs(x_45_scale))) * math.fabs(x_45_scale)) * math.fabs(x_45_scale)) / (b * a)) * (0.25 / (b * a)) return tmp
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(Float64(b * b) / Float64(abs(x_45_scale) * abs(x_45_scale))) t_1 = Float64(Float64(Float64(a * a) / y_45_scale) / y_45_scale) t_2 = Float64(y_45_scale * abs(x_45_scale)) t_3 = Float64(Float64(Float64(4.0 * Float64(a * b)) / t_2) * Float64(Float64(Float64(-a) * b) / t_2)) tmp = 0.0 if (abs(x_45_scale) <= 1.5e+169) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * t_3) * Float64(Float64(b * a) * Float64(b * Float64(-a)))) * Float64(sqrt((Float64(t_0 - t_1) ^ 2.0)) + Float64(t_1 + t_0))))) / t_3); else tmp = Float64(Float64(Float64(Float64(Float64(sqrt(Float64(8.0 * Float64((b ^ 4.0) * (a ^ 6.0)))) / abs(abs(x_45_scale))) * abs(x_45_scale)) * abs(x_45_scale)) / Float64(b * a)) * Float64(0.25 / Float64(b * a))); end return tmp end
function tmp_2 = code(a, b, angle, x_45_scale, y_45_scale) t_0 = (b * b) / (abs(x_45_scale) * abs(x_45_scale)); t_1 = ((a * a) / y_45_scale) / y_45_scale; t_2 = y_45_scale * abs(x_45_scale); t_3 = ((4.0 * (a * b)) / t_2) * ((-a * b) / t_2); tmp = 0.0; if (abs(x_45_scale) <= 1.5e+169) tmp = -sqrt((((2.0 * t_3) * ((b * a) * (b * -a))) * (sqrt(((t_0 - t_1) ^ 2.0)) + (t_1 + t_0)))) / t_3; else tmp = ((((sqrt((8.0 * ((b ^ 4.0) * (a ^ 6.0)))) / abs(abs(x_45_scale))) * abs(x_45_scale)) * abs(x_45_scale)) / (b * a)) * (0.25 / (b * a)); end tmp_2 = tmp; end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[(b * b), $MachinePrecision] / N[(N[Abs[x$45$scale], $MachinePrecision] * N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(a * a), $MachinePrecision] / y$45$scale), $MachinePrecision] / y$45$scale), $MachinePrecision]}, Block[{t$95$2 = N[(y$45$scale * N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(4.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision] * N[(N[((-a) * b), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[x$45$scale], $MachinePrecision], 1.5e+169], N[((-N[Sqrt[N[(N[(N[(2.0 * t$95$3), $MachinePrecision] * N[(N[(b * a), $MachinePrecision] * N[(b * (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[Power[N[(t$95$0 - t$95$1), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision] + N[(t$95$1 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$3), $MachinePrecision], N[(N[(N[(N[(N[(N[Sqrt[N[(8.0 * N[(N[Power[b, 4.0], $MachinePrecision] * N[Power[a, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[N[Abs[x$45$scale], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] * N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision] * N[(0.25 / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \frac{b \cdot b}{\left|x-scale\right| \cdot \left|x-scale\right|}\\
t_1 := \frac{\frac{a \cdot a}{y-scale}}{y-scale}\\
t_2 := y-scale \cdot \left|x-scale\right|\\
t_3 := \frac{4 \cdot \left(a \cdot b\right)}{t\_2} \cdot \frac{\left(-a\right) \cdot b}{t\_2}\\
\mathbf{if}\;\left|x-scale\right| \leq 1.5 \cdot 10^{+169}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot t\_3\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \left(\sqrt{{\left(t\_0 - t\_1\right)}^{2}} + \left(t\_1 + t\_0\right)\right)}}{t\_3}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{\sqrt{8 \cdot \left({b}^{4} \cdot {a}^{6}\right)}}{\left|\left|x-scale\right|\right|} \cdot \left|x-scale\right|\right) \cdot \left|x-scale\right|}{b \cdot a} \cdot \frac{0.25}{b \cdot a}\\
\end{array}
if x-scale < 1.5e169Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites4.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
Applied rewrites5.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
Applied rewrites7.6%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f647.6%
lift-pow.f64N/A
pow2N/A
lift-*.f647.6%
Applied rewrites7.6%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f648.3%
lift-pow.f64N/A
pow2N/A
lift-*.f648.3%
Applied rewrites8.3%
lift-pow.f64N/A
pow2N/A
lift-*.f648.3%
lift-pow.f64N/A
pow2N/A
lift-*.f648.3%
Applied rewrites8.3%
lift-pow.f64N/A
pow2N/A
lift-*.f648.3%
lift-pow.f64N/A
pow2N/A
lift-*.f648.3%
Applied rewrites8.3%
if 1.5e169 < x-scale Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites0.4%
Applied rewrites0.6%
Taylor expanded in y-scale around 0
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-pow.f640.9%
Applied rewrites0.9%
Applied rewrites10.7%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ a (* y-scale y-scale)))
(t_1 (* y-scale (fabs x-scale)))
(t_2 (* (/ (* 4.0 (* a b)) t_1) (/ (* (- a) b) t_1)))
(t_3 (/ b (* (fabs x-scale) (fabs x-scale)))))
(if (<= (fabs x-scale) 1.5e+169)
(/
(-
(sqrt
(*
(* (* 2.0 t_2) (* (* b a) (* b (- a))))
(fma b t_3 (fma a t_0 (fabs (- (* a t_0) (* b t_3))))))))
t_2)
(*
(/
(*
(*
(/ (sqrt (* 8.0 (* (pow b 4.0) (pow a 6.0)))) (fabs (fabs x-scale)))
(fabs x-scale))
(fabs x-scale))
(* b a))
(/ 0.25 (* b a))))))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = a / (y_45_scale * y_45_scale);
double t_1 = y_45_scale * fabs(x_45_scale);
double t_2 = ((4.0 * (a * b)) / t_1) * ((-a * b) / t_1);
double t_3 = b / (fabs(x_45_scale) * fabs(x_45_scale));
double tmp;
if (fabs(x_45_scale) <= 1.5e+169) {
tmp = -sqrt((((2.0 * t_2) * ((b * a) * (b * -a))) * fma(b, t_3, fma(a, t_0, fabs(((a * t_0) - (b * t_3))))))) / t_2;
} else {
tmp = ((((sqrt((8.0 * (pow(b, 4.0) * pow(a, 6.0)))) / fabs(fabs(x_45_scale))) * fabs(x_45_scale)) * fabs(x_45_scale)) / (b * a)) * (0.25 / (b * a));
}
return tmp;
}
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(a / Float64(y_45_scale * y_45_scale)) t_1 = Float64(y_45_scale * abs(x_45_scale)) t_2 = Float64(Float64(Float64(4.0 * Float64(a * b)) / t_1) * Float64(Float64(Float64(-a) * b) / t_1)) t_3 = Float64(b / Float64(abs(x_45_scale) * abs(x_45_scale))) tmp = 0.0 if (abs(x_45_scale) <= 1.5e+169) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * t_2) * Float64(Float64(b * a) * Float64(b * Float64(-a)))) * fma(b, t_3, fma(a, t_0, abs(Float64(Float64(a * t_0) - Float64(b * t_3)))))))) / t_2); else tmp = Float64(Float64(Float64(Float64(Float64(sqrt(Float64(8.0 * Float64((b ^ 4.0) * (a ^ 6.0)))) / abs(abs(x_45_scale))) * abs(x_45_scale)) * abs(x_45_scale)) / Float64(b * a)) * Float64(0.25 / Float64(b * a))); end return tmp end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(a / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y$45$scale * N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(4.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] * N[(N[((-a) * b), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(b / N[(N[Abs[x$45$scale], $MachinePrecision] * N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[x$45$scale], $MachinePrecision], 1.5e+169], N[((-N[Sqrt[N[(N[(N[(2.0 * t$95$2), $MachinePrecision] * N[(N[(b * a), $MachinePrecision] * N[(b * (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b * t$95$3 + N[(a * t$95$0 + N[Abs[N[(N[(a * t$95$0), $MachinePrecision] - N[(b * t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], N[(N[(N[(N[(N[(N[Sqrt[N[(8.0 * N[(N[Power[b, 4.0], $MachinePrecision] * N[Power[a, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[N[Abs[x$45$scale], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] * N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision] * N[(0.25 / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \frac{a}{y-scale \cdot y-scale}\\
t_1 := y-scale \cdot \left|x-scale\right|\\
t_2 := \frac{4 \cdot \left(a \cdot b\right)}{t\_1} \cdot \frac{\left(-a\right) \cdot b}{t\_1}\\
t_3 := \frac{b}{\left|x-scale\right| \cdot \left|x-scale\right|}\\
\mathbf{if}\;\left|x-scale\right| \leq 1.5 \cdot 10^{+169}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot t\_2\right) \cdot \left(\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)\right)\right) \cdot \mathsf{fma}\left(b, t\_3, \mathsf{fma}\left(a, t\_0, \left|a \cdot t\_0 - b \cdot t\_3\right|\right)\right)}}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{\sqrt{8 \cdot \left({b}^{4} \cdot {a}^{6}\right)}}{\left|\left|x-scale\right|\right|} \cdot \left|x-scale\right|\right) \cdot \left|x-scale\right|}{b \cdot a} \cdot \frac{0.25}{b \cdot a}\\
\end{array}
if x-scale < 1.5e169Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites4.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
Applied rewrites5.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
Applied rewrites7.6%
Applied rewrites9.7%
if 1.5e169 < x-scale Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites0.4%
Applied rewrites0.6%
Taylor expanded in y-scale around 0
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-pow.f640.9%
Applied rewrites0.9%
Applied rewrites10.7%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (/ (fabs a) (* y-scale y-scale)))
(t_1 (- (fabs a)))
(t_2 (* b (fabs a)))
(t_3
(*
(/ (* 4.0 (* (fabs a) b)) (* y-scale x-scale))
(/ (* t_1 b) (* y-scale x-scale))))
(t_4 (/ b (* x-scale x-scale))))
(if (<= (fabs a) 1.45e-42)
(/
(-
(sqrt
(*
(* (* 2.0 t_3) (* t_2 (* b t_1)))
(fma t_4 b (fma t_0 (fabs a) (- (* t_4 b) (* t_0 (fabs a))))))))
t_3)
(*
(/
(*
(*
(/ (sqrt (* 8.0 (* (pow b 4.0) (pow (fabs a) 6.0)))) (fabs x-scale))
x-scale)
x-scale)
t_2)
(/ 0.25 t_2)))))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = fabs(a) / (y_45_scale * y_45_scale);
double t_1 = -fabs(a);
double t_2 = b * fabs(a);
double t_3 = ((4.0 * (fabs(a) * b)) / (y_45_scale * x_45_scale)) * ((t_1 * b) / (y_45_scale * x_45_scale));
double t_4 = b / (x_45_scale * x_45_scale);
double tmp;
if (fabs(a) <= 1.45e-42) {
tmp = -sqrt((((2.0 * t_3) * (t_2 * (b * t_1))) * fma(t_4, b, fma(t_0, fabs(a), ((t_4 * b) - (t_0 * fabs(a))))))) / t_3;
} else {
tmp = ((((sqrt((8.0 * (pow(b, 4.0) * pow(fabs(a), 6.0)))) / fabs(x_45_scale)) * x_45_scale) * x_45_scale) / t_2) * (0.25 / t_2);
}
return tmp;
}
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(abs(a) / Float64(y_45_scale * y_45_scale)) t_1 = Float64(-abs(a)) t_2 = Float64(b * abs(a)) t_3 = Float64(Float64(Float64(4.0 * Float64(abs(a) * b)) / Float64(y_45_scale * x_45_scale)) * Float64(Float64(t_1 * b) / Float64(y_45_scale * x_45_scale))) t_4 = Float64(b / Float64(x_45_scale * x_45_scale)) tmp = 0.0 if (abs(a) <= 1.45e-42) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(2.0 * t_3) * Float64(t_2 * Float64(b * t_1))) * fma(t_4, b, fma(t_0, abs(a), Float64(Float64(t_4 * b) - Float64(t_0 * abs(a)))))))) / t_3); else tmp = Float64(Float64(Float64(Float64(Float64(sqrt(Float64(8.0 * Float64((b ^ 4.0) * (abs(a) ^ 6.0)))) / abs(x_45_scale)) * x_45_scale) * x_45_scale) / t_2) * Float64(0.25 / t_2)); end return tmp end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(N[Abs[a], $MachinePrecision] / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[Abs[a], $MachinePrecision])}, Block[{t$95$2 = N[(b * N[Abs[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(4.0 * N[(N[Abs[a], $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * b), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(b / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[a], $MachinePrecision], 1.45e-42], N[((-N[Sqrt[N[(N[(N[(2.0 * t$95$3), $MachinePrecision] * N[(t$95$2 * N[(b * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$4 * b + N[(t$95$0 * N[Abs[a], $MachinePrecision] + N[(N[(t$95$4 * b), $MachinePrecision] - N[(t$95$0 * N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$3), $MachinePrecision], N[(N[(N[(N[(N[(N[Sqrt[N[(8.0 * N[(N[Power[b, 4.0], $MachinePrecision] * N[Power[N[Abs[a], $MachinePrecision], 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] / t$95$2), $MachinePrecision] * N[(0.25 / t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \frac{\left|a\right|}{y-scale \cdot y-scale}\\
t_1 := -\left|a\right|\\
t_2 := b \cdot \left|a\right|\\
t_3 := \frac{4 \cdot \left(\left|a\right| \cdot b\right)}{y-scale \cdot x-scale} \cdot \frac{t\_1 \cdot b}{y-scale \cdot x-scale}\\
t_4 := \frac{b}{x-scale \cdot x-scale}\\
\mathbf{if}\;\left|a\right| \leq 1.45 \cdot 10^{-42}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(2 \cdot t\_3\right) \cdot \left(t\_2 \cdot \left(b \cdot t\_1\right)\right)\right) \cdot \mathsf{fma}\left(t\_4, b, \mathsf{fma}\left(t\_0, \left|a\right|, t\_4 \cdot b - t\_0 \cdot \left|a\right|\right)\right)}}{t\_3}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{\sqrt{8 \cdot \left({b}^{4} \cdot {\left(\left|a\right|\right)}^{6}\right)}}{\left|x-scale\right|} \cdot x-scale\right) \cdot x-scale}{t\_2} \cdot \frac{0.25}{t\_2}\\
\end{array}
if a < 1.4500000000000001e-42Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites4.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
Applied rewrites5.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
Applied rewrites7.6%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f647.6%
lift-pow.f64N/A
pow2N/A
lift-*.f647.6%
Applied rewrites7.6%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f648.3%
lift-pow.f64N/A
pow2N/A
lift-*.f648.3%
Applied rewrites8.3%
Applied rewrites5.4%
if 1.4500000000000001e-42 < a Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites0.4%
Applied rewrites0.6%
Taylor expanded in y-scale around 0
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-pow.f640.9%
Applied rewrites0.9%
Applied rewrites10.7%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(let* ((t_0 (* b (fabs a)))
(t_1 (- (fabs a)))
(t_2 (/ b (* x-scale x-scale)))
(t_3 (* (* t_0 b) t_1))
(t_4 (/ (fabs a) (* y-scale y-scale))))
(if (<= (fabs a) 1.06e-184)
(/
(-
(sqrt
(*
(* (* 4.0 (/ t_3 (* (* (* y-scale y-scale) x-scale) x-scale))) 2.0)
(*
t_3
(fma t_2 b (fma t_4 (fabs a) (- (* t_2 b) (* t_4 (fabs a)))))))))
(*
(/ (* 4.0 (* (fabs a) b)) (* y-scale x-scale))
(/ (* t_1 b) (* y-scale x-scale))))
(*
(/
(*
(*
(/ (sqrt (* 8.0 (* (pow b 4.0) (pow (fabs a) 6.0)))) (fabs x-scale))
x-scale)
x-scale)
t_0)
(/ 0.25 t_0)))))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
double t_0 = b * fabs(a);
double t_1 = -fabs(a);
double t_2 = b / (x_45_scale * x_45_scale);
double t_3 = (t_0 * b) * t_1;
double t_4 = fabs(a) / (y_45_scale * y_45_scale);
double tmp;
if (fabs(a) <= 1.06e-184) {
tmp = -sqrt((((4.0 * (t_3 / (((y_45_scale * y_45_scale) * x_45_scale) * x_45_scale))) * 2.0) * (t_3 * fma(t_2, b, fma(t_4, fabs(a), ((t_2 * b) - (t_4 * fabs(a)))))))) / (((4.0 * (fabs(a) * b)) / (y_45_scale * x_45_scale)) * ((t_1 * b) / (y_45_scale * x_45_scale)));
} else {
tmp = ((((sqrt((8.0 * (pow(b, 4.0) * pow(fabs(a), 6.0)))) / fabs(x_45_scale)) * x_45_scale) * x_45_scale) / t_0) * (0.25 / t_0);
}
return tmp;
}
function code(a, b, angle, x_45_scale, y_45_scale) t_0 = Float64(b * abs(a)) t_1 = Float64(-abs(a)) t_2 = Float64(b / Float64(x_45_scale * x_45_scale)) t_3 = Float64(Float64(t_0 * b) * t_1) t_4 = Float64(abs(a) / Float64(y_45_scale * y_45_scale)) tmp = 0.0 if (abs(a) <= 1.06e-184) tmp = Float64(Float64(-sqrt(Float64(Float64(Float64(4.0 * Float64(t_3 / Float64(Float64(Float64(y_45_scale * y_45_scale) * x_45_scale) * x_45_scale))) * 2.0) * Float64(t_3 * fma(t_2, b, fma(t_4, abs(a), Float64(Float64(t_2 * b) - Float64(t_4 * abs(a))))))))) / Float64(Float64(Float64(4.0 * Float64(abs(a) * b)) / Float64(y_45_scale * x_45_scale)) * Float64(Float64(t_1 * b) / Float64(y_45_scale * x_45_scale)))); else tmp = Float64(Float64(Float64(Float64(Float64(sqrt(Float64(8.0 * Float64((b ^ 4.0) * (abs(a) ^ 6.0)))) / abs(x_45_scale)) * x_45_scale) * x_45_scale) / t_0) * Float64(0.25 / t_0)); end return tmp end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := Block[{t$95$0 = N[(b * N[Abs[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[Abs[a], $MachinePrecision])}, Block[{t$95$2 = N[(b / N[(x$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$0 * b), $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(N[Abs[a], $MachinePrecision] / N[(y$45$scale * y$45$scale), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[a], $MachinePrecision], 1.06e-184], N[((-N[Sqrt[N[(N[(N[(4.0 * N[(t$95$3 / N[(N[(N[(y$45$scale * y$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] * N[(t$95$3 * N[(t$95$2 * b + N[(t$95$4 * N[Abs[a], $MachinePrecision] + N[(N[(t$95$2 * b), $MachinePrecision] - N[(t$95$4 * N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(N[(4.0 * N[(N[Abs[a], $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * b), $MachinePrecision] / N[(y$45$scale * x$45$scale), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[Sqrt[N[(8.0 * N[(N[Power[b, 4.0], $MachinePrecision] * N[Power[N[Abs[a], $MachinePrecision], 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(0.25 / t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := b \cdot \left|a\right|\\
t_1 := -\left|a\right|\\
t_2 := \frac{b}{x-scale \cdot x-scale}\\
t_3 := \left(t\_0 \cdot b\right) \cdot t\_1\\
t_4 := \frac{\left|a\right|}{y-scale \cdot y-scale}\\
\mathbf{if}\;\left|a\right| \leq 1.06 \cdot 10^{-184}:\\
\;\;\;\;\frac{-\sqrt{\left(\left(4 \cdot \frac{t\_3}{\left(\left(y-scale \cdot y-scale\right) \cdot x-scale\right) \cdot x-scale}\right) \cdot 2\right) \cdot \left(t\_3 \cdot \mathsf{fma}\left(t\_2, b, \mathsf{fma}\left(t\_4, \left|a\right|, t\_2 \cdot b - t\_4 \cdot \left|a\right|\right)\right)\right)}}{\frac{4 \cdot \left(\left|a\right| \cdot b\right)}{y-scale \cdot x-scale} \cdot \frac{t\_1 \cdot b}{y-scale \cdot x-scale}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{\sqrt{8 \cdot \left({b}^{4} \cdot {\left(\left|a\right|\right)}^{6}\right)}}{\left|x-scale\right|} \cdot x-scale\right) \cdot x-scale}{t\_0} \cdot \frac{0.25}{t\_0}\\
\end{array}
if a < 1.0599999999999999e-184Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites4.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f645.1%
Applied rewrites5.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
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f647.6%
Applied rewrites7.6%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f647.6%
lift-pow.f64N/A
pow2N/A
lift-*.f647.6%
Applied rewrites7.6%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f648.3%
lift-pow.f64N/A
pow2N/A
lift-*.f648.3%
Applied rewrites8.3%
Applied rewrites1.7%
if 1.0599999999999999e-184 < a Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites0.4%
Applied rewrites0.6%
Taylor expanded in y-scale around 0
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-pow.f640.9%
Applied rewrites0.9%
Applied rewrites10.7%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(*
(/
(*
(* (/ (sqrt (* 8.0 (* (pow b 4.0) (pow a 6.0)))) (fabs x-scale)) x-scale)
x-scale)
(* b a))
(/ 0.25 (* b a))))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return ((((sqrt((8.0 * (pow(b, 4.0) * pow(a, 6.0)))) / fabs(x_45_scale)) * x_45_scale) * x_45_scale) / (b * a)) * (0.25 / (b * a));
}
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, b, angle, x_45scale, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = ((((sqrt((8.0d0 * ((b ** 4.0d0) * (a ** 6.0d0)))) / abs(x_45scale)) * x_45scale) * x_45scale) / (b * a)) * (0.25d0 / (b * a))
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return ((((Math.sqrt((8.0 * (Math.pow(b, 4.0) * Math.pow(a, 6.0)))) / Math.abs(x_45_scale)) * x_45_scale) * x_45_scale) / (b * a)) * (0.25 / (b * a));
}
def code(a, b, angle, x_45_scale, y_45_scale): return ((((math.sqrt((8.0 * (math.pow(b, 4.0) * math.pow(a, 6.0)))) / math.fabs(x_45_scale)) * x_45_scale) * x_45_scale) / (b * a)) * (0.25 / (b * a))
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(Float64(Float64(sqrt(Float64(8.0 * Float64((b ^ 4.0) * (a ^ 6.0)))) / abs(x_45_scale)) * x_45_scale) * x_45_scale) / Float64(b * a)) * Float64(0.25 / Float64(b * a))) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = ((((sqrt((8.0 * ((b ^ 4.0) * (a ^ 6.0)))) / abs(x_45_scale)) * x_45_scale) * x_45_scale) / (b * a)) * (0.25 / (b * a)); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(N[(N[(N[Sqrt[N[(8.0 * N[(N[Power[b, 4.0], $MachinePrecision] * N[Power[a, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] / N[(b * a), $MachinePrecision]), $MachinePrecision] * N[(0.25 / N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\left(\frac{\sqrt{8 \cdot \left({b}^{4} \cdot {a}^{6}\right)}}{\left|x-scale\right|} \cdot x-scale\right) \cdot x-scale}{b \cdot a} \cdot \frac{0.25}{b \cdot a}
Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites0.4%
Applied rewrites0.6%
Taylor expanded in y-scale around 0
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-pow.f640.9%
Applied rewrites0.9%
Applied rewrites10.7%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(*
(/ 0.25 a)
(/
(*
(* (/ (sqrt (* 8.0 (* (pow b 4.0) (pow a 6.0)))) (fabs x-scale)) x-scale)
x-scale)
(* a (* b b)))))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (0.25 / a) * ((((sqrt((8.0 * (pow(b, 4.0) * pow(a, 6.0)))) / fabs(x_45_scale)) * x_45_scale) * x_45_scale) / (a * (b * b)));
}
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, b, angle, x_45scale, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = (0.25d0 / a) * ((((sqrt((8.0d0 * ((b ** 4.0d0) * (a ** 6.0d0)))) / abs(x_45scale)) * x_45scale) * x_45scale) / (a * (b * b)))
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (0.25 / a) * ((((Math.sqrt((8.0 * (Math.pow(b, 4.0) * Math.pow(a, 6.0)))) / Math.abs(x_45_scale)) * x_45_scale) * x_45_scale) / (a * (b * b)));
}
def code(a, b, angle, x_45_scale, y_45_scale): return (0.25 / a) * ((((math.sqrt((8.0 * (math.pow(b, 4.0) * math.pow(a, 6.0)))) / math.fabs(x_45_scale)) * x_45_scale) * x_45_scale) / (a * (b * b)))
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(0.25 / a) * Float64(Float64(Float64(Float64(sqrt(Float64(8.0 * Float64((b ^ 4.0) * (a ^ 6.0)))) / abs(x_45_scale)) * x_45_scale) * x_45_scale) / Float64(a * Float64(b * b)))) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = (0.25 / a) * ((((sqrt((8.0 * ((b ^ 4.0) * (a ^ 6.0)))) / abs(x_45_scale)) * x_45_scale) * x_45_scale) / (a * (b * b))); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(0.25 / a), $MachinePrecision] * N[(N[(N[(N[(N[Sqrt[N[(8.0 * N[(N[Power[b, 4.0], $MachinePrecision] * N[Power[a, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] / N[(a * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{0.25}{a} \cdot \frac{\left(\frac{\sqrt{8 \cdot \left({b}^{4} \cdot {a}^{6}\right)}}{\left|x-scale\right|} \cdot x-scale\right) \cdot x-scale}{a \cdot \left(b \cdot b\right)}
Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites0.4%
Applied rewrites0.6%
Taylor expanded in y-scale around 0
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-pow.f640.9%
Applied rewrites0.9%
Applied rewrites5.8%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(/
(*
(*
(* (/ (sqrt (* 8.0 (* (pow b 4.0) (pow a 6.0)))) (fabs x-scale)) x-scale)
x-scale)
0.25)
(* (* (* a a) b) b)))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return ((((sqrt((8.0 * (pow(b, 4.0) * pow(a, 6.0)))) / fabs(x_45_scale)) * x_45_scale) * x_45_scale) * 0.25) / (((a * a) * b) * b);
}
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, b, angle, x_45scale, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = ((((sqrt((8.0d0 * ((b ** 4.0d0) * (a ** 6.0d0)))) / abs(x_45scale)) * x_45scale) * x_45scale) * 0.25d0) / (((a * a) * b) * b)
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return ((((Math.sqrt((8.0 * (Math.pow(b, 4.0) * Math.pow(a, 6.0)))) / Math.abs(x_45_scale)) * x_45_scale) * x_45_scale) * 0.25) / (((a * a) * b) * b);
}
def code(a, b, angle, x_45_scale, y_45_scale): return ((((math.sqrt((8.0 * (math.pow(b, 4.0) * math.pow(a, 6.0)))) / math.fabs(x_45_scale)) * x_45_scale) * x_45_scale) * 0.25) / (((a * a) * b) * b)
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(Float64(Float64(Float64(sqrt(Float64(8.0 * Float64((b ^ 4.0) * (a ^ 6.0)))) / abs(x_45_scale)) * x_45_scale) * x_45_scale) * 0.25) / Float64(Float64(Float64(a * a) * b) * b)) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = ((((sqrt((8.0 * ((b ^ 4.0) * (a ^ 6.0)))) / abs(x_45_scale)) * x_45_scale) * x_45_scale) * 0.25) / (((a * a) * b) * b); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(N[(N[(N[(N[Sqrt[N[(8.0 * N[(N[Power[b, 4.0], $MachinePrecision] * N[Power[a, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] * x$45$scale), $MachinePrecision] * x$45$scale), $MachinePrecision] * 0.25), $MachinePrecision] / N[(N[(N[(a * a), $MachinePrecision] * b), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\frac{\left(\left(\frac{\sqrt{8 \cdot \left({b}^{4} \cdot {a}^{6}\right)}}{\left|x-scale\right|} \cdot x-scale\right) \cdot x-scale\right) \cdot 0.25}{\left(\left(a \cdot a\right) \cdot b\right) \cdot b}
Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites0.4%
Applied rewrites0.6%
Taylor expanded in y-scale around 0
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-pow.f640.9%
Applied rewrites0.9%
Applied rewrites2.6%
(FPCore (a b angle x-scale y-scale)
:precision binary64
(/
(*
0.25
(*
(/ (sqrt (* 8.0 (* (pow a 6.0) (pow b 4.0)))) (fabs x-scale))
(* (fabs x-scale) (fabs x-scale))))
(* (* a a) (* b b))))double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (0.25 * ((sqrt((8.0 * (pow(a, 6.0) * pow(b, 4.0)))) / fabs(x_45_scale)) * (fabs(x_45_scale) * fabs(x_45_scale)))) / ((a * a) * (b * b));
}
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, b, angle, x_45scale, y_45scale)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle
real(8), intent (in) :: x_45scale
real(8), intent (in) :: y_45scale
code = (0.25d0 * ((sqrt((8.0d0 * ((a ** 6.0d0) * (b ** 4.0d0)))) / abs(x_45scale)) * (abs(x_45scale) * abs(x_45scale)))) / ((a * a) * (b * b))
end function
public static double code(double a, double b, double angle, double x_45_scale, double y_45_scale) {
return (0.25 * ((Math.sqrt((8.0 * (Math.pow(a, 6.0) * Math.pow(b, 4.0)))) / Math.abs(x_45_scale)) * (Math.abs(x_45_scale) * Math.abs(x_45_scale)))) / ((a * a) * (b * b));
}
def code(a, b, angle, x_45_scale, y_45_scale): return (0.25 * ((math.sqrt((8.0 * (math.pow(a, 6.0) * math.pow(b, 4.0)))) / math.fabs(x_45_scale)) * (math.fabs(x_45_scale) * math.fabs(x_45_scale)))) / ((a * a) * (b * b))
function code(a, b, angle, x_45_scale, y_45_scale) return Float64(Float64(0.25 * Float64(Float64(sqrt(Float64(8.0 * Float64((a ^ 6.0) * (b ^ 4.0)))) / abs(x_45_scale)) * Float64(abs(x_45_scale) * abs(x_45_scale)))) / Float64(Float64(a * a) * Float64(b * b))) end
function tmp = code(a, b, angle, x_45_scale, y_45_scale) tmp = (0.25 * ((sqrt((8.0 * ((a ^ 6.0) * (b ^ 4.0)))) / abs(x_45_scale)) * (abs(x_45_scale) * abs(x_45_scale)))) / ((a * a) * (b * b)); end
code[a_, b_, angle_, x$45$scale_, y$45$scale_] := N[(N[(0.25 * N[(N[(N[Sqrt[N[(8.0 * N[(N[Power[a, 6.0], $MachinePrecision] * N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[x$45$scale], $MachinePrecision] * N[Abs[x$45$scale], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(a * a), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{0.25 \cdot \left(\frac{\sqrt{8 \cdot \left({a}^{6} \cdot {b}^{4}\right)}}{\left|x-scale\right|} \cdot \left(\left|x-scale\right| \cdot \left|x-scale\right|\right)\right)}{\left(a \cdot a\right) \cdot \left(b \cdot b\right)}
Initial program 2.7%
Taylor expanded in angle around 0
Applied rewrites0.4%
Applied rewrites0.6%
Taylor expanded in y-scale around 0
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-pow.f640.9%
Applied rewrites0.9%
Taylor expanded in x-scale around 0
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f641.1%
Applied rewrites1.1%
herbie shell --seed 2025191
(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))))