
(FPCore (c0 w h D d M) :precision binary64 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))) (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) end
function tmp = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (c0 w h D d M) :precision binary64 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))) (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) end
function tmp = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)
\end{array}
\end{array}
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (pow (/ d D) 2.0))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (/ (/ c0 w) h))
(t_3 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_4 (* t_1 (+ t_3 (sqrt (- (* t_3 t_3) (* M M))))))
(t_5 (* t_0 t_2))
(t_6 (/ (* t_0 (/ c0 w)) h)))
(if (<= t_4 (- INFINITY))
(*
t_1
(fma
(pow (pow (fma (/ c0 (* w h)) t_0 M) 0.25) 2.0)
(sqrt (- t_5 M))
t_5))
(if (<= t_4 0.0)
(* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
(if (<= t_4 INFINITY)
(* t_1 (+ t_6 (* (sqrt (fma t_2 t_0 M)) (sqrt (- t_6 M)))))
(* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = pow((d / D), 2.0);
double t_1 = c0 / (2.0 * w);
double t_2 = (c0 / w) / h;
double t_3 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_4 = t_1 * (t_3 + sqrt(((t_3 * t_3) - (M * M))));
double t_5 = t_0 * t_2;
double t_6 = (t_0 * (c0 / w)) / h;
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = t_1 * fma(pow(pow(fma((c0 / (w * h)), t_0, M), 0.25), 2.0), sqrt((t_5 - M)), t_5);
} else if (t_4 <= 0.0) {
tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_1 * (t_6 + (sqrt(fma(t_2, t_0, M)) * sqrt((t_6 - M))));
} else {
tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(d / D) ^ 2.0 t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(Float64(c0 / w) / h) t_3 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) t_4 = Float64(t_1 * Float64(t_3 + sqrt(Float64(Float64(t_3 * t_3) - Float64(M * M))))) t_5 = Float64(t_0 * t_2) t_6 = Float64(Float64(t_0 * Float64(c0 / w)) / h) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = Float64(t_1 * fma(((fma(Float64(c0 / Float64(w * h)), t_0, M) ^ 0.25) ^ 2.0), sqrt(Float64(t_5 - M)), t_5)); elseif (t_4 <= 0.0) tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h))); elseif (t_4 <= Inf) tmp = Float64(t_1 * Float64(t_6 + Float64(sqrt(fma(t_2, t_0, M)) * sqrt(Float64(t_6 - M))))); else tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0)))); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * N[(t$95$3 + N[Sqrt[N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$0 * t$95$2), $MachinePrecision]}, Block[{t$95$6 = N[(N[(t$95$0 * N[(c0 / w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(t$95$1 * N[(N[Power[N[Power[N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * t$95$0 + M), $MachinePrecision], 0.25], $MachinePrecision], 2.0], $MachinePrecision] * N[Sqrt[N[(t$95$5 - M), $MachinePrecision]], $MachinePrecision] + t$95$5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(t$95$1 * N[(t$95$6 + N[(N[Sqrt[N[(t$95$2 * t$95$0 + M), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$6 - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{2}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{\frac{c0}{w}}{h}\\
t_3 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_4 := t\_1 \cdot \left(t\_3 + \sqrt{t\_3 \cdot t\_3 - M \cdot M}\right)\\
t_5 := t\_0 \cdot t\_2\\
t_6 := \frac{t\_0 \cdot \frac{c0}{w}}{h}\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left({\left({\left(\mathsf{fma}\left(\frac{c0}{w \cdot h}, t\_0, M\right)\right)}^{0.25}\right)}^{2}, \sqrt{t\_5 - M}, t\_5\right)\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_1 \cdot \left(t\_6 + \sqrt{\mathsf{fma}\left(t\_2, t\_0, M\right)} \cdot \sqrt{t\_6 - M}\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0Initial program 74.9%
+-commutative74.9%
+-commutative74.9%
times-frac74.9%
fma-neg74.9%
Simplified74.9%
Applied egg-rr87.0%
associate-/r*87.0%
associate-/r*87.1%
associate-/r*87.0%
Simplified87.0%
fma-udef87.0%
associate-/r*87.0%
*-commutative87.0%
Applied egg-rr87.0%
add-sqr-sqrt87.1%
pow287.1%
pow1/287.1%
sqrt-pow187.2%
*-commutative87.2%
fma-def87.2%
metadata-eval87.2%
Applied egg-rr87.2%
if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0Initial program 68.5%
+-commutative68.5%
+-commutative68.5%
times-frac48.6%
fma-neg48.6%
Simplified67.9%
Taylor expanded in c0 around -inf 67.5%
fma-def67.5%
distribute-lft1-in67.5%
metadata-eval67.5%
associate-/r*60.8%
times-frac60.5%
associate-*r*60.6%
Simplified60.6%
Taylor expanded in c0 around 0 87.3%
associate-/l*87.2%
associate-/r*81.0%
Simplified81.0%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod34.4%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod40.7%
add-sqr-sqrt87.4%
Applied egg-rr87.4%
if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 73.8%
+-commutative73.8%
+-commutative73.8%
times-frac71.2%
fma-neg71.2%
Simplified71.2%
associate-/r*71.3%
frac-times71.2%
*-commutative71.2%
associate-*r/71.2%
pow271.2%
Applied egg-rr71.2%
Applied egg-rr79.9%
*-commutative79.9%
associate-/r*79.9%
associate-/r*82.0%
Simplified82.0%
associate-*l/82.1%
Applied egg-rr82.1%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified3.9%
Taylor expanded in c0 around -inf 1.4%
fma-def1.4%
distribute-lft1-in1.4%
metadata-eval1.4%
associate-/r*1.4%
times-frac2.1%
associate-*r*2.1%
Simplified2.1%
Taylor expanded in c0 around 0 44.8%
associate-/l*44.2%
associate-/r*44.8%
Simplified44.8%
associate-/r/45.5%
add-sqr-sqrt45.5%
pow245.5%
sqrt-div45.5%
unpow245.5%
sqrt-prod26.7%
add-sqr-sqrt53.7%
unpow253.7%
sqrt-prod31.5%
add-sqr-sqrt59.7%
Applied egg-rr59.7%
Final simplification69.2%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (/ c0 w) h))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_3 (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))))
(t_4 (pow (/ d D) 2.0)))
(if (<= t_3 (- INFINITY))
(*
(/ (/ c0 w) 2.0)
(fma t_0 (* (/ d D) (/ d D)) (fma (/ c0 (* w h)) t_4 M)))
(if (<= t_3 0.0)
(* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
(if (<= t_3 INFINITY)
(*
t_1
(+
(/ (* t_4 (/ c0 w)) h)
(* (sqrt (- (* t_4 t_0) M)) (sqrt (fma t_0 t_4 M)))))
(* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / w) / h;
double t_1 = c0 / (2.0 * w);
double t_2 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_3 = t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))));
double t_4 = pow((d / D), 2.0);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = ((c0 / w) / 2.0) * fma(t_0, ((d / D) * (d / D)), fma((c0 / (w * h)), t_4, M));
} else if (t_3 <= 0.0) {
tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_1 * (((t_4 * (c0 / w)) / h) + (sqrt(((t_4 * t_0) - M)) * sqrt(fma(t_0, t_4, M))));
} else {
tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 / w) / h) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) t_3 = Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))))) t_4 = Float64(d / D) ^ 2.0 tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(Float64(Float64(c0 / w) / 2.0) * fma(t_0, Float64(Float64(d / D) * Float64(d / D)), fma(Float64(c0 / Float64(w * h)), t_4, M))); elseif (t_3 <= 0.0) tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h))); elseif (t_3 <= Inf) tmp = Float64(t_1 * Float64(Float64(Float64(t_4 * Float64(c0 / w)) / h) + Float64(sqrt(Float64(Float64(t_4 * t_0) - M)) * sqrt(fma(t_0, t_4, M))))); else tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0)))); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] + N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * t$95$4 + M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(t$95$1 * N[(N[(N[(t$95$4 * N[(c0 / w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] + N[(N[Sqrt[N[(N[(t$95$4 * t$95$0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$0 * t$95$4 + M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{c0}{w}}{h}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_3 := t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\
t_4 := {\left(\frac{d}{D}\right)}^{2}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(t\_0, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(\frac{c0}{w \cdot h}, t\_4, M\right)\right)\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_1 \cdot \left(\frac{t\_4 \cdot \frac{c0}{w}}{h} + \sqrt{t\_4 \cdot t\_0 - M} \cdot \sqrt{\mathsf{fma}\left(t\_0, t\_4, M\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0Initial program 74.9%
Simplified74.5%
times-frac74.4%
Applied egg-rr74.4%
sqrt-prod79.2%
pow279.2%
associate-/l/79.2%
frac-times79.3%
unpow279.3%
add-sqr-sqrt47.7%
sqrt-unprod79.3%
sqr-neg79.3%
sqrt-prod31.6%
add-sqr-sqrt79.3%
Applied egg-rr79.3%
Simplified87.2%
if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0Initial program 68.5%
+-commutative68.5%
+-commutative68.5%
times-frac48.6%
fma-neg48.6%
Simplified67.9%
Taylor expanded in c0 around -inf 67.5%
fma-def67.5%
distribute-lft1-in67.5%
metadata-eval67.5%
associate-/r*60.8%
times-frac60.5%
associate-*r*60.6%
Simplified60.6%
Taylor expanded in c0 around 0 87.3%
associate-/l*87.2%
associate-/r*81.0%
Simplified81.0%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod34.4%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod40.7%
add-sqr-sqrt87.4%
Applied egg-rr87.4%
if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 73.8%
+-commutative73.8%
+-commutative73.8%
times-frac71.2%
fma-neg71.2%
Simplified71.2%
associate-/r*71.3%
frac-times71.2%
*-commutative71.2%
associate-*r/71.2%
pow271.2%
Applied egg-rr71.2%
Applied egg-rr79.9%
*-commutative79.9%
associate-/r*79.9%
associate-/r*82.0%
Simplified82.0%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified3.9%
Taylor expanded in c0 around -inf 1.4%
fma-def1.4%
distribute-lft1-in1.4%
metadata-eval1.4%
associate-/r*1.4%
times-frac2.1%
associate-*r*2.1%
Simplified2.1%
Taylor expanded in c0 around 0 44.8%
associate-/l*44.2%
associate-/r*44.8%
Simplified44.8%
associate-/r/45.5%
add-sqr-sqrt45.5%
pow245.5%
sqrt-div45.5%
unpow245.5%
sqrt-prod26.7%
add-sqr-sqrt53.7%
unpow253.7%
sqrt-prod31.5%
add-sqr-sqrt59.7%
Applied egg-rr59.7%
Final simplification69.2%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (/ c0 w) h))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_3 (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))))
(t_4 (pow (/ d D) 2.0))
(t_5 (/ (* t_4 (/ c0 w)) h)))
(if (<= t_3 (- INFINITY))
(*
(/ (/ c0 w) 2.0)
(fma t_0 (* (/ d D) (/ d D)) (fma (/ c0 (* w h)) t_4 M)))
(if (<= t_3 0.0)
(* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
(if (<= t_3 INFINITY)
(* t_1 (+ t_5 (* (sqrt (fma t_0 t_4 M)) (sqrt (- t_5 M)))))
(* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / w) / h;
double t_1 = c0 / (2.0 * w);
double t_2 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_3 = t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))));
double t_4 = pow((d / D), 2.0);
double t_5 = (t_4 * (c0 / w)) / h;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = ((c0 / w) / 2.0) * fma(t_0, ((d / D) * (d / D)), fma((c0 / (w * h)), t_4, M));
} else if (t_3 <= 0.0) {
tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_1 * (t_5 + (sqrt(fma(t_0, t_4, M)) * sqrt((t_5 - M))));
} else {
tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 / w) / h) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) t_3 = Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))))) t_4 = Float64(d / D) ^ 2.0 t_5 = Float64(Float64(t_4 * Float64(c0 / w)) / h) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(Float64(Float64(c0 / w) / 2.0) * fma(t_0, Float64(Float64(d / D) * Float64(d / D)), fma(Float64(c0 / Float64(w * h)), t_4, M))); elseif (t_3 <= 0.0) tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h))); elseif (t_3 <= Inf) tmp = Float64(t_1 * Float64(t_5 + Float64(sqrt(fma(t_0, t_4, M)) * sqrt(Float64(t_5 - M))))); else tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0)))); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$4 * N[(c0 / w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] + N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * t$95$4 + M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(t$95$1 * N[(t$95$5 + N[(N[Sqrt[N[(t$95$0 * t$95$4 + M), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$5 - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{c0}{w}}{h}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_3 := t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\
t_4 := {\left(\frac{d}{D}\right)}^{2}\\
t_5 := \frac{t\_4 \cdot \frac{c0}{w}}{h}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(t\_0, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(\frac{c0}{w \cdot h}, t\_4, M\right)\right)\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_1 \cdot \left(t\_5 + \sqrt{\mathsf{fma}\left(t\_0, t\_4, M\right)} \cdot \sqrt{t\_5 - M}\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0Initial program 74.9%
Simplified74.5%
times-frac74.4%
Applied egg-rr74.4%
sqrt-prod79.2%
pow279.2%
associate-/l/79.2%
frac-times79.3%
unpow279.3%
add-sqr-sqrt47.7%
sqrt-unprod79.3%
sqr-neg79.3%
sqrt-prod31.6%
add-sqr-sqrt79.3%
Applied egg-rr79.3%
Simplified87.2%
if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0Initial program 68.5%
+-commutative68.5%
+-commutative68.5%
times-frac48.6%
fma-neg48.6%
Simplified67.9%
Taylor expanded in c0 around -inf 67.5%
fma-def67.5%
distribute-lft1-in67.5%
metadata-eval67.5%
associate-/r*60.8%
times-frac60.5%
associate-*r*60.6%
Simplified60.6%
Taylor expanded in c0 around 0 87.3%
associate-/l*87.2%
associate-/r*81.0%
Simplified81.0%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod34.4%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod40.7%
add-sqr-sqrt87.4%
Applied egg-rr87.4%
if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 73.8%
+-commutative73.8%
+-commutative73.8%
times-frac71.2%
fma-neg71.2%
Simplified71.2%
associate-/r*71.3%
frac-times71.2%
*-commutative71.2%
associate-*r/71.2%
pow271.2%
Applied egg-rr71.2%
Applied egg-rr79.9%
*-commutative79.9%
associate-/r*79.9%
associate-/r*82.0%
Simplified82.0%
associate-*l/82.1%
Applied egg-rr82.1%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified3.9%
Taylor expanded in c0 around -inf 1.4%
fma-def1.4%
distribute-lft1-in1.4%
metadata-eval1.4%
associate-/r*1.4%
times-frac2.1%
associate-*r*2.1%
Simplified2.1%
Taylor expanded in c0 around 0 44.8%
associate-/l*44.2%
associate-/r*44.8%
Simplified44.8%
associate-/r/45.5%
add-sqr-sqrt45.5%
pow245.5%
sqrt-div45.5%
unpow245.5%
sqrt-prod26.7%
add-sqr-sqrt53.7%
unpow253.7%
sqrt-prod31.5%
add-sqr-sqrt59.7%
Applied egg-rr59.7%
Final simplification69.2%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (/ c0 w) h))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_3 (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))))
(t_4 (pow (/ d D) 2.0)))
(if (<= t_3 (- INFINITY))
(*
(/ (/ c0 w) 2.0)
(fma t_0 (* (/ d D) (/ d D)) (fma (/ c0 (* w h)) t_4 M)))
(if (<= t_3 0.0)
(* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
(if (<= t_3 INFINITY)
(*
t_1
(fma
(sqrt (fma t_0 t_4 M))
(* (/ d D) (/ 1.0 (sqrt (/ h (/ c0 w)))))
(/ (* t_4 (/ c0 w)) h)))
(* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / w) / h;
double t_1 = c0 / (2.0 * w);
double t_2 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_3 = t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))));
double t_4 = pow((d / D), 2.0);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = ((c0 / w) / 2.0) * fma(t_0, ((d / D) * (d / D)), fma((c0 / (w * h)), t_4, M));
} else if (t_3 <= 0.0) {
tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_1 * fma(sqrt(fma(t_0, t_4, M)), ((d / D) * (1.0 / sqrt((h / (c0 / w))))), ((t_4 * (c0 / w)) / h));
} else {
tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 / w) / h) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) t_3 = Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))))) t_4 = Float64(d / D) ^ 2.0 tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(Float64(Float64(c0 / w) / 2.0) * fma(t_0, Float64(Float64(d / D) * Float64(d / D)), fma(Float64(c0 / Float64(w * h)), t_4, M))); elseif (t_3 <= 0.0) tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h))); elseif (t_3 <= Inf) tmp = Float64(t_1 * fma(sqrt(fma(t_0, t_4, M)), Float64(Float64(d / D) * Float64(1.0 / sqrt(Float64(h / Float64(c0 / w))))), Float64(Float64(t_4 * Float64(c0 / w)) / h))); else tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0)))); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] + N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * t$95$4 + M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(t$95$1 * N[(N[Sqrt[N[(t$95$0 * t$95$4 + M), $MachinePrecision]], $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / N[(c0 / w), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$4 * N[(c0 / w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{c0}{w}}{h}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_3 := t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\
t_4 := {\left(\frac{d}{D}\right)}^{2}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(t\_0, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(\frac{c0}{w \cdot h}, t\_4, M\right)\right)\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(t\_0, t\_4, M\right)}, \frac{d}{D} \cdot \frac{1}{\sqrt{\frac{h}{\frac{c0}{w}}}}, \frac{t\_4 \cdot \frac{c0}{w}}{h}\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0Initial program 74.9%
Simplified74.5%
times-frac74.4%
Applied egg-rr74.4%
sqrt-prod79.2%
pow279.2%
associate-/l/79.2%
frac-times79.3%
unpow279.3%
add-sqr-sqrt47.7%
sqrt-unprod79.3%
sqr-neg79.3%
sqrt-prod31.6%
add-sqr-sqrt79.3%
Applied egg-rr79.3%
Simplified87.2%
if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0Initial program 68.5%
+-commutative68.5%
+-commutative68.5%
times-frac48.6%
fma-neg48.6%
Simplified67.9%
Taylor expanded in c0 around -inf 67.5%
fma-def67.5%
distribute-lft1-in67.5%
metadata-eval67.5%
associate-/r*60.8%
times-frac60.5%
associate-*r*60.6%
Simplified60.6%
Taylor expanded in c0 around 0 87.3%
associate-/l*87.2%
associate-/r*81.0%
Simplified81.0%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod34.4%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod40.7%
add-sqr-sqrt87.4%
Applied egg-rr87.4%
if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 73.8%
+-commutative73.8%
+-commutative73.8%
times-frac71.2%
fma-neg71.2%
Simplified71.2%
Applied egg-rr79.8%
associate-/r*79.9%
associate-/r*79.9%
associate-/r*82.0%
Simplified82.0%
associate-*l/82.1%
Applied egg-rr82.0%
Taylor expanded in d around inf 40.0%
clear-num40.0%
sqrt-div39.8%
metadata-eval39.8%
Applied egg-rr39.8%
associate-/l*40.0%
Simplified40.0%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified3.9%
Taylor expanded in c0 around -inf 1.4%
fma-def1.4%
distribute-lft1-in1.4%
metadata-eval1.4%
associate-/r*1.4%
times-frac2.1%
associate-*r*2.1%
Simplified2.1%
Taylor expanded in c0 around 0 44.8%
associate-/l*44.2%
associate-/r*44.8%
Simplified44.8%
associate-/r/45.5%
add-sqr-sqrt45.5%
pow245.5%
sqrt-div45.5%
unpow245.5%
sqrt-prod26.7%
add-sqr-sqrt53.7%
unpow253.7%
sqrt-prod31.5%
add-sqr-sqrt59.7%
Applied egg-rr59.7%
Final simplification62.0%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* w h)))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (pow (/ d D) 2.0))
(t_3 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_4 (* t_1 (+ t_3 (sqrt (- (* t_3 t_3) (* M M))))))
(t_5 (* (/ d D) (sqrt t_0))))
(if (<= t_4 (- INFINITY))
(*
(/ (/ c0 w) 2.0)
(fma (/ (/ c0 w) h) (* (/ d D) (/ d D)) (fma t_0 t_2 M)))
(if (<= t_4 0.0)
(* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
(if (<= t_4 INFINITY)
(*
t_1
(fma
(+ (* 0.5 (* (/ (* D M) d) (sqrt (/ (* w h) c0)))) t_5)
t_5
(/ (* t_2 (/ c0 w)) h)))
(* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (w * h);
double t_1 = c0 / (2.0 * w);
double t_2 = pow((d / D), 2.0);
double t_3 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_4 = t_1 * (t_3 + sqrt(((t_3 * t_3) - (M * M))));
double t_5 = (d / D) * sqrt(t_0);
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = ((c0 / w) / 2.0) * fma(((c0 / w) / h), ((d / D) * (d / D)), fma(t_0, t_2, M));
} else if (t_4 <= 0.0) {
tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_1 * fma(((0.5 * (((D * M) / d) * sqrt(((w * h) / c0)))) + t_5), t_5, ((t_2 * (c0 / w)) / h));
} else {
tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(w * h)) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(d / D) ^ 2.0 t_3 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) t_4 = Float64(t_1 * Float64(t_3 + sqrt(Float64(Float64(t_3 * t_3) - Float64(M * M))))) t_5 = Float64(Float64(d / D) * sqrt(t_0)) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = Float64(Float64(Float64(c0 / w) / 2.0) * fma(Float64(Float64(c0 / w) / h), Float64(Float64(d / D) * Float64(d / D)), fma(t_0, t_2, M))); elseif (t_4 <= 0.0) tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h))); elseif (t_4 <= Inf) tmp = Float64(t_1 * fma(Float64(Float64(0.5 * Float64(Float64(Float64(D * M) / d) * sqrt(Float64(Float64(w * h) / c0)))) + t_5), t_5, Float64(Float64(t_2 * Float64(c0 / w)) / h))); else tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0)))); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * N[(t$95$3 + N[Sqrt[N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(d / D), $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * t$95$2 + M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(t$95$1 * N[(N[(N[(0.5 * N[(N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(N[(w * h), $MachinePrecision] / c0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$5), $MachinePrecision] * t$95$5 + N[(N[(t$95$2 * N[(c0 / w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := {\left(\frac{d}{D}\right)}^{2}\\
t_3 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_4 := t\_1 \cdot \left(t\_3 + \sqrt{t\_3 \cdot t\_3 - M \cdot M}\right)\\
t_5 := \frac{d}{D} \cdot \sqrt{t\_0}\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(t\_0, t\_2, M\right)\right)\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(0.5 \cdot \left(\frac{D \cdot M}{d} \cdot \sqrt{\frac{w \cdot h}{c0}}\right) + t\_5, t\_5, \frac{t\_2 \cdot \frac{c0}{w}}{h}\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0Initial program 74.9%
Simplified74.5%
times-frac74.4%
Applied egg-rr74.4%
sqrt-prod79.2%
pow279.2%
associate-/l/79.2%
frac-times79.3%
unpow279.3%
add-sqr-sqrt47.7%
sqrt-unprod79.3%
sqr-neg79.3%
sqrt-prod31.6%
add-sqr-sqrt79.3%
Applied egg-rr79.3%
Simplified87.2%
if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0Initial program 68.5%
+-commutative68.5%
+-commutative68.5%
times-frac48.6%
fma-neg48.6%
Simplified67.9%
Taylor expanded in c0 around -inf 67.5%
fma-def67.5%
distribute-lft1-in67.5%
metadata-eval67.5%
associate-/r*60.8%
times-frac60.5%
associate-*r*60.6%
Simplified60.6%
Taylor expanded in c0 around 0 87.3%
associate-/l*87.2%
associate-/r*81.0%
Simplified81.0%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod34.4%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod40.7%
add-sqr-sqrt87.4%
Applied egg-rr87.4%
if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 73.8%
+-commutative73.8%
+-commutative73.8%
times-frac71.2%
fma-neg71.2%
Simplified71.2%
Applied egg-rr79.8%
associate-/r*79.9%
associate-/r*79.9%
associate-/r*82.0%
Simplified82.0%
associate-*l/82.1%
Applied egg-rr82.0%
Taylor expanded in d around inf 40.0%
Taylor expanded in d around inf 80.1%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified3.9%
Taylor expanded in c0 around -inf 1.4%
fma-def1.4%
distribute-lft1-in1.4%
metadata-eval1.4%
associate-/r*1.4%
times-frac2.1%
associate-*r*2.1%
Simplified2.1%
Taylor expanded in c0 around 0 44.8%
associate-/l*44.2%
associate-/r*44.8%
Simplified44.8%
associate-/r/45.5%
add-sqr-sqrt45.5%
pow245.5%
sqrt-div45.5%
unpow245.5%
sqrt-prod26.7%
add-sqr-sqrt53.7%
unpow253.7%
sqrt-prod31.5%
add-sqr-sqrt59.7%
Applied egg-rr59.7%
Final simplification68.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* w h)))
(t_1 (pow (/ d D) 2.0))
(t_2 (* t_0 t_1))
(t_3 (/ c0 (* 2.0 w)))
(t_4 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_5 (* t_3 (+ t_4 (sqrt (- (* t_4 t_4) (* M M)))))))
(if (<= t_5 (- INFINITY))
(* t_3 (+ t_2 (* t_0 (* (/ d D) (/ d D)))))
(if (<= t_5 0.0)
(* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
(if (<= t_5 INFINITY)
(* t_3 (+ (* t_1 (/ (/ c0 w) h)) t_2))
(* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (w * h);
double t_1 = pow((d / D), 2.0);
double t_2 = t_0 * t_1;
double t_3 = c0 / (2.0 * w);
double t_4 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_5 = t_3 * (t_4 + sqrt(((t_4 * t_4) - (M * M))));
double tmp;
if (t_5 <= -((double) INFINITY)) {
tmp = t_3 * (t_2 + (t_0 * ((d / D) * (d / D))));
} else if (t_5 <= 0.0) {
tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
} else if (t_5 <= ((double) INFINITY)) {
tmp = t_3 * ((t_1 * ((c0 / w) / h)) + t_2);
} else {
tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (w * h);
double t_1 = Math.pow((d / D), 2.0);
double t_2 = t_0 * t_1;
double t_3 = c0 / (2.0 * w);
double t_4 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_5 = t_3 * (t_4 + Math.sqrt(((t_4 * t_4) - (M * M))));
double tmp;
if (t_5 <= -Double.POSITIVE_INFINITY) {
tmp = t_3 * (t_2 + (t_0 * ((d / D) * (d / D))));
} else if (t_5 <= 0.0) {
tmp = 0.25 * (Math.pow(D, 2.0) / (((d / M) * (d / M)) / h));
} else if (t_5 <= Double.POSITIVE_INFINITY) {
tmp = t_3 * ((t_1 * ((c0 / w) / h)) + t_2);
} else {
tmp = 0.25 * (h * (Math.pow(D, 2.0) / Math.pow((d / M), 2.0)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (w * h) t_1 = math.pow((d / D), 2.0) t_2 = t_0 * t_1 t_3 = c0 / (2.0 * w) t_4 = (c0 * (d * d)) / ((D * D) * (w * h)) t_5 = t_3 * (t_4 + math.sqrt(((t_4 * t_4) - (M * M)))) tmp = 0 if t_5 <= -math.inf: tmp = t_3 * (t_2 + (t_0 * ((d / D) * (d / D)))) elif t_5 <= 0.0: tmp = 0.25 * (math.pow(D, 2.0) / (((d / M) * (d / M)) / h)) elif t_5 <= math.inf: tmp = t_3 * ((t_1 * ((c0 / w) / h)) + t_2) else: tmp = 0.25 * (h * (math.pow(D, 2.0) / math.pow((d / M), 2.0))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(w * h)) t_1 = Float64(d / D) ^ 2.0 t_2 = Float64(t_0 * t_1) t_3 = Float64(c0 / Float64(2.0 * w)) t_4 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) t_5 = Float64(t_3 * Float64(t_4 + sqrt(Float64(Float64(t_4 * t_4) - Float64(M * M))))) tmp = 0.0 if (t_5 <= Float64(-Inf)) tmp = Float64(t_3 * Float64(t_2 + Float64(t_0 * Float64(Float64(d / D) * Float64(d / D))))); elseif (t_5 <= 0.0) tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h))); elseif (t_5 <= Inf) tmp = Float64(t_3 * Float64(Float64(t_1 * Float64(Float64(c0 / w) / h)) + t_2)); else tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (w * h); t_1 = (d / D) ^ 2.0; t_2 = t_0 * t_1; t_3 = c0 / (2.0 * w); t_4 = (c0 * (d * d)) / ((D * D) * (w * h)); t_5 = t_3 * (t_4 + sqrt(((t_4 * t_4) - (M * M)))); tmp = 0.0; if (t_5 <= -Inf) tmp = t_3 * (t_2 + (t_0 * ((d / D) * (d / D)))); elseif (t_5 <= 0.0) tmp = 0.25 * ((D ^ 2.0) / (((d / M) * (d / M)) / h)); elseif (t_5 <= Inf) tmp = t_3 * ((t_1 * ((c0 / w) / h)) + t_2); else tmp = 0.25 * (h * ((D ^ 2.0) / ((d / M) ^ 2.0))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$3 * N[(t$95$4 + N[Sqrt[N[(N[(t$95$4 * t$95$4), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, (-Infinity)], N[(t$95$3 * N[(t$95$2 + N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, Infinity], N[(t$95$3 * N[(N[(t$95$1 * N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := {\left(\frac{d}{D}\right)}^{2}\\
t_2 := t\_0 \cdot t\_1\\
t_3 := \frac{c0}{2 \cdot w}\\
t_4 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_5 := t\_3 \cdot \left(t\_4 + \sqrt{t\_4 \cdot t\_4 - M \cdot M}\right)\\
\mathbf{if}\;t\_5 \leq -\infty:\\
\;\;\;\;t\_3 \cdot \left(t\_2 + t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\
\mathbf{elif}\;t\_5 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\
\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;t\_3 \cdot \left(t\_1 \cdot \frac{\frac{c0}{w}}{h} + t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0Initial program 74.9%
+-commutative74.9%
+-commutative74.9%
times-frac74.9%
fma-neg74.9%
Simplified74.9%
frac-times74.9%
Applied egg-rr74.9%
Taylor expanded in c0 around inf 79.8%
*-commutative79.8%
*-commutative79.8%
times-frac79.8%
*-commutative79.8%
unpow279.8%
associate-/r*79.8%
unpow279.8%
associate-*l/79.8%
associate-*r/79.8%
unpow279.8%
Simplified79.8%
frac-times74.9%
Applied egg-rr87.2%
if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0Initial program 68.5%
+-commutative68.5%
+-commutative68.5%
times-frac48.6%
fma-neg48.6%
Simplified67.9%
Taylor expanded in c0 around -inf 67.5%
fma-def67.5%
distribute-lft1-in67.5%
metadata-eval67.5%
associate-/r*60.8%
times-frac60.5%
associate-*r*60.6%
Simplified60.6%
Taylor expanded in c0 around 0 87.3%
associate-/l*87.2%
associate-/r*81.0%
Simplified81.0%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod34.4%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod40.7%
add-sqr-sqrt87.4%
Applied egg-rr87.4%
if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 73.8%
+-commutative73.8%
+-commutative73.8%
times-frac71.2%
fma-neg71.2%
Simplified71.2%
frac-times71.1%
Applied egg-rr71.1%
Taylor expanded in c0 around inf 71.2%
*-commutative71.2%
*-commutative71.2%
times-frac71.2%
*-commutative71.2%
unpow271.2%
associate-/r*71.2%
unpow271.2%
associate-*l/71.2%
associate-*r/71.2%
unpow271.2%
Simplified71.2%
expm1-log1p-u70.6%
expm1-udef70.6%
frac-times76.2%
pow276.2%
Applied egg-rr76.2%
expm1-def79.0%
expm1-log1p79.9%
associate-/r*80.0%
Simplified80.0%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified3.9%
Taylor expanded in c0 around -inf 1.4%
fma-def1.4%
distribute-lft1-in1.4%
metadata-eval1.4%
associate-/r*1.4%
times-frac2.1%
associate-*r*2.1%
Simplified2.1%
Taylor expanded in c0 around 0 44.8%
associate-/l*44.2%
associate-/r*44.8%
Simplified44.8%
associate-/r/45.5%
add-sqr-sqrt45.5%
pow245.5%
sqrt-div45.5%
unpow245.5%
sqrt-prod26.7%
add-sqr-sqrt53.7%
unpow253.7%
sqrt-prod31.5%
add-sqr-sqrt59.7%
Applied egg-rr59.7%
Final simplification68.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (/ c0 w) h))
(t_1 (/ c0 (* w h)))
(t_2 (/ c0 (* 2.0 w)))
(t_3 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_4 (* t_2 (+ t_3 (sqrt (- (* t_3 t_3) (* M M))))))
(t_5 (pow (/ d D) 2.0)))
(if (<= t_4 (- INFINITY))
(* (/ (/ c0 w) 2.0) (fma t_0 (* (/ d D) (/ d D)) (fma t_1 t_5 M)))
(if (<= t_4 0.0)
(* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
(if (<= t_4 INFINITY)
(* t_2 (+ (* t_5 t_0) (* t_1 t_5)))
(* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / w) / h;
double t_1 = c0 / (w * h);
double t_2 = c0 / (2.0 * w);
double t_3 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_4 = t_2 * (t_3 + sqrt(((t_3 * t_3) - (M * M))));
double t_5 = pow((d / D), 2.0);
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = ((c0 / w) / 2.0) * fma(t_0, ((d / D) * (d / D)), fma(t_1, t_5, M));
} else if (t_4 <= 0.0) {
tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_2 * ((t_5 * t_0) + (t_1 * t_5));
} else {
tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 / w) / h) t_1 = Float64(c0 / Float64(w * h)) t_2 = Float64(c0 / Float64(2.0 * w)) t_3 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) t_4 = Float64(t_2 * Float64(t_3 + sqrt(Float64(Float64(t_3 * t_3) - Float64(M * M))))) t_5 = Float64(d / D) ^ 2.0 tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = Float64(Float64(Float64(c0 / w) / 2.0) * fma(t_0, Float64(Float64(d / D) * Float64(d / D)), fma(t_1, t_5, M))); elseif (t_4 <= 0.0) tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h))); elseif (t_4 <= Inf) tmp = Float64(t_2 * Float64(Float64(t_5 * t_0) + Float64(t_1 * t_5))); else tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0)))); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 * N[(t$95$3 + N[Sqrt[N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * t$95$5 + M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(t$95$2 * N[(N[(t$95$5 * t$95$0), $MachinePrecision] + N[(t$95$1 * t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{c0}{w}}{h}\\
t_1 := \frac{c0}{w \cdot h}\\
t_2 := \frac{c0}{2 \cdot w}\\
t_3 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_4 := t\_2 \cdot \left(t\_3 + \sqrt{t\_3 \cdot t\_3 - M \cdot M}\right)\\
t_5 := {\left(\frac{d}{D}\right)}^{2}\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(t\_0, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(t\_1, t\_5, M\right)\right)\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_2 \cdot \left(t\_5 \cdot t\_0 + t\_1 \cdot t\_5\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0Initial program 74.9%
Simplified74.5%
times-frac74.4%
Applied egg-rr74.4%
sqrt-prod79.2%
pow279.2%
associate-/l/79.2%
frac-times79.3%
unpow279.3%
add-sqr-sqrt47.7%
sqrt-unprod79.3%
sqr-neg79.3%
sqrt-prod31.6%
add-sqr-sqrt79.3%
Applied egg-rr79.3%
Simplified87.2%
if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0Initial program 68.5%
+-commutative68.5%
+-commutative68.5%
times-frac48.6%
fma-neg48.6%
Simplified67.9%
Taylor expanded in c0 around -inf 67.5%
fma-def67.5%
distribute-lft1-in67.5%
metadata-eval67.5%
associate-/r*60.8%
times-frac60.5%
associate-*r*60.6%
Simplified60.6%
Taylor expanded in c0 around 0 87.3%
associate-/l*87.2%
associate-/r*81.0%
Simplified81.0%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod34.4%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod40.7%
add-sqr-sqrt87.4%
Applied egg-rr87.4%
if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 73.8%
+-commutative73.8%
+-commutative73.8%
times-frac71.2%
fma-neg71.2%
Simplified71.2%
frac-times71.1%
Applied egg-rr71.1%
Taylor expanded in c0 around inf 71.2%
*-commutative71.2%
*-commutative71.2%
times-frac71.2%
*-commutative71.2%
unpow271.2%
associate-/r*71.2%
unpow271.2%
associate-*l/71.2%
associate-*r/71.2%
unpow271.2%
Simplified71.2%
expm1-log1p-u70.6%
expm1-udef70.6%
frac-times76.2%
pow276.2%
Applied egg-rr76.2%
expm1-def79.0%
expm1-log1p79.9%
associate-/r*80.0%
Simplified80.0%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified3.9%
Taylor expanded in c0 around -inf 1.4%
fma-def1.4%
distribute-lft1-in1.4%
metadata-eval1.4%
associate-/r*1.4%
times-frac2.1%
associate-*r*2.1%
Simplified2.1%
Taylor expanded in c0 around 0 44.8%
associate-/l*44.2%
associate-/r*44.8%
Simplified44.8%
associate-/r/45.5%
add-sqr-sqrt45.5%
pow245.5%
sqrt-div45.5%
unpow245.5%
sqrt-prod26.7%
add-sqr-sqrt53.7%
unpow253.7%
sqrt-prod31.5%
add-sqr-sqrt59.7%
Applied egg-rr59.7%
Final simplification68.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* w h)))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_3 (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))))
(t_4
(* t_1 (+ (* t_0 (pow (/ d D) 2.0)) (* t_0 (* (/ d D) (/ d D)))))))
(if (<= t_3 (- INFINITY))
t_4
(if (<= t_3 0.0)
(* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
(if (<= t_3 INFINITY)
t_4
(* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (w * h);
double t_1 = c0 / (2.0 * w);
double t_2 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_3 = t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))));
double t_4 = t_1 * ((t_0 * pow((d / D), 2.0)) + (t_0 * ((d / D) * (d / D))));
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_3 <= 0.0) {
tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_4;
} else {
tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (w * h);
double t_1 = c0 / (2.0 * w);
double t_2 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_3 = t_1 * (t_2 + Math.sqrt(((t_2 * t_2) - (M * M))));
double t_4 = t_1 * ((t_0 * Math.pow((d / D), 2.0)) + (t_0 * ((d / D) * (d / D))));
double tmp;
if (t_3 <= -Double.POSITIVE_INFINITY) {
tmp = t_4;
} else if (t_3 <= 0.0) {
tmp = 0.25 * (Math.pow(D, 2.0) / (((d / M) * (d / M)) / h));
} else if (t_3 <= Double.POSITIVE_INFINITY) {
tmp = t_4;
} else {
tmp = 0.25 * (h * (Math.pow(D, 2.0) / Math.pow((d / M), 2.0)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (w * h) t_1 = c0 / (2.0 * w) t_2 = (c0 * (d * d)) / ((D * D) * (w * h)) t_3 = t_1 * (t_2 + math.sqrt(((t_2 * t_2) - (M * M)))) t_4 = t_1 * ((t_0 * math.pow((d / D), 2.0)) + (t_0 * ((d / D) * (d / D)))) tmp = 0 if t_3 <= -math.inf: tmp = t_4 elif t_3 <= 0.0: tmp = 0.25 * (math.pow(D, 2.0) / (((d / M) * (d / M)) / h)) elif t_3 <= math.inf: tmp = t_4 else: tmp = 0.25 * (h * (math.pow(D, 2.0) / math.pow((d / M), 2.0))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(w * h)) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) t_3 = Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))))) t_4 = Float64(t_1 * Float64(Float64(t_0 * (Float64(d / D) ^ 2.0)) + Float64(t_0 * Float64(Float64(d / D) * Float64(d / D))))) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_4; elseif (t_3 <= 0.0) tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h))); elseif (t_3 <= Inf) tmp = t_4; else tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (w * h); t_1 = c0 / (2.0 * w); t_2 = (c0 * (d * d)) / ((D * D) * (w * h)); t_3 = t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M)))); t_4 = t_1 * ((t_0 * ((d / D) ^ 2.0)) + (t_0 * ((d / D) * (d / D)))); tmp = 0.0; if (t_3 <= -Inf) tmp = t_4; elseif (t_3 <= 0.0) tmp = 0.25 * ((D ^ 2.0) / (((d / M) * (d / M)) / h)); elseif (t_3 <= Inf) tmp = t_4; else tmp = 0.25 * (h * ((D ^ 2.0) / ((d / M) ^ 2.0))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * N[(N[(t$95$0 * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$4, If[LessEqual[t$95$3, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$4, N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_3 := t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\
t_4 := t\_1 \cdot \left(t\_0 \cdot {\left(\frac{d}{D}\right)}^{2} + t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0 or -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 74.3%
+-commutative74.3%
+-commutative74.3%
times-frac72.9%
fma-neg72.9%
Simplified72.9%
frac-times72.9%
Applied egg-rr72.9%
Taylor expanded in c0 around inf 75.2%
*-commutative75.2%
*-commutative75.2%
times-frac75.2%
*-commutative75.2%
unpow275.2%
associate-/r*75.2%
unpow275.2%
associate-*l/75.2%
associate-*r/75.2%
unpow275.2%
Simplified75.2%
frac-times72.9%
Applied egg-rr83.3%
if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0Initial program 68.5%
+-commutative68.5%
+-commutative68.5%
times-frac48.6%
fma-neg48.6%
Simplified67.9%
Taylor expanded in c0 around -inf 67.5%
fma-def67.5%
distribute-lft1-in67.5%
metadata-eval67.5%
associate-/r*60.8%
times-frac60.5%
associate-*r*60.6%
Simplified60.6%
Taylor expanded in c0 around 0 87.3%
associate-/l*87.2%
associate-/r*81.0%
Simplified81.0%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod34.4%
add-sqr-sqrt80.9%
sqrt-div80.9%
unpow280.9%
sqrt-prod27.7%
add-sqr-sqrt80.9%
unpow280.9%
sqrt-prod40.7%
add-sqr-sqrt87.4%
Applied egg-rr87.4%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified3.9%
Taylor expanded in c0 around -inf 1.4%
fma-def1.4%
distribute-lft1-in1.4%
metadata-eval1.4%
associate-/r*1.4%
times-frac2.1%
associate-*r*2.1%
Simplified2.1%
Taylor expanded in c0 around 0 44.8%
associate-/l*44.2%
associate-/r*44.8%
Simplified44.8%
associate-/r/45.5%
add-sqr-sqrt45.5%
pow245.5%
sqrt-div45.5%
unpow245.5%
sqrt-prod26.7%
add-sqr-sqrt53.7%
unpow253.7%
sqrt-prod31.5%
add-sqr-sqrt59.7%
Applied egg-rr59.7%
Final simplification68.8%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_1 (/ c0 (* w h)))
(t_2 (/ c0 (* 2.0 w)))
(t_3 (* t_2 (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
(if (or (<= t_3 (- INFINITY)) (and (not (<= t_3 0.0)) (<= t_3 INFINITY)))
(* t_2 (+ (* t_1 (pow (/ d D) 2.0)) (* t_1 (* (/ d D) (/ d D)))))
(* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_1 = c0 / (w * h);
double t_2 = c0 / (2.0 * w);
double t_3 = t_2 * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if ((t_3 <= -((double) INFINITY)) || (!(t_3 <= 0.0) && (t_3 <= ((double) INFINITY)))) {
tmp = t_2 * ((t_1 * pow((d / D), 2.0)) + (t_1 * ((d / D) * (d / D))));
} else {
tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_1 = c0 / (w * h);
double t_2 = c0 / (2.0 * w);
double t_3 = t_2 * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if ((t_3 <= -Double.POSITIVE_INFINITY) || (!(t_3 <= 0.0) && (t_3 <= Double.POSITIVE_INFINITY))) {
tmp = t_2 * ((t_1 * Math.pow((d / D), 2.0)) + (t_1 * ((d / D) * (d / D))));
} else {
tmp = 0.25 * (Math.pow(D, 2.0) / (((d / M) * (d / M)) / h));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((D * D) * (w * h)) t_1 = c0 / (w * h) t_2 = c0 / (2.0 * w) t_3 = t_2 * (t_0 + math.sqrt(((t_0 * t_0) - (M * M)))) tmp = 0 if (t_3 <= -math.inf) or (not (t_3 <= 0.0) and (t_3 <= math.inf)): tmp = t_2 * ((t_1 * math.pow((d / D), 2.0)) + (t_1 * ((d / D) * (d / D)))) else: tmp = 0.25 * (math.pow(D, 2.0) / (((d / M) * (d / M)) / h)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) t_1 = Float64(c0 / Float64(w * h)) t_2 = Float64(c0 / Float64(2.0 * w)) t_3 = Float64(t_2 * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) tmp = 0.0 if ((t_3 <= Float64(-Inf)) || (!(t_3 <= 0.0) && (t_3 <= Inf))) tmp = Float64(t_2 * Float64(Float64(t_1 * (Float64(d / D) ^ 2.0)) + Float64(t_1 * Float64(Float64(d / D) * Float64(d / D))))); else tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((D * D) * (w * h)); t_1 = c0 / (w * h); t_2 = c0 / (2.0 * w); t_3 = t_2 * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); tmp = 0.0; if ((t_3 <= -Inf) || (~((t_3 <= 0.0)) && (t_3 <= Inf))) tmp = t_2 * ((t_1 * ((d / D) ^ 2.0)) + (t_1 * ((d / D) * (d / D)))); else tmp = 0.25 * ((D ^ 2.0) / (((d / M) * (d / M)) / h)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$3, (-Infinity)], And[N[Not[LessEqual[t$95$3, 0.0]], $MachinePrecision], LessEqual[t$95$3, Infinity]]], N[(t$95$2 * N[(N[(t$95$1 * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_1 := \frac{c0}{w \cdot h}\\
t_2 := \frac{c0}{2 \cdot w}\\
t_3 := t\_2 \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)\\
\mathbf{if}\;t\_3 \leq -\infty \lor \neg \left(t\_3 \leq 0\right) \land t\_3 \leq \infty:\\
\;\;\;\;t\_2 \cdot \left(t\_1 \cdot {\left(\frac{d}{D}\right)}^{2} + t\_1 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0 or -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 74.3%
+-commutative74.3%
+-commutative74.3%
times-frac72.9%
fma-neg72.9%
Simplified72.9%
frac-times72.9%
Applied egg-rr72.9%
Taylor expanded in c0 around inf 75.2%
*-commutative75.2%
*-commutative75.2%
times-frac75.2%
*-commutative75.2%
unpow275.2%
associate-/r*75.2%
unpow275.2%
associate-*l/75.2%
associate-*r/75.2%
unpow275.2%
Simplified75.2%
frac-times72.9%
Applied egg-rr83.3%
if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0 or +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 5.9%
+-commutative5.9%
+-commutative5.9%
times-frac4.2%
fma-neg4.2%
Simplified9.4%
Taylor expanded in c0 around -inf 7.1%
fma-def7.1%
distribute-lft1-in7.1%
metadata-eval7.1%
associate-/r*6.5%
times-frac7.2%
associate-*r*7.2%
Simplified7.2%
Taylor expanded in c0 around 0 48.5%
associate-/l*47.9%
associate-/r*48.0%
Simplified48.0%
add-sqr-sqrt47.9%
sqrt-div48.0%
unpow248.0%
sqrt-prod23.0%
add-sqr-sqrt46.2%
unpow246.2%
sqrt-prod21.0%
add-sqr-sqrt44.8%
sqrt-div44.8%
unpow244.8%
sqrt-prod21.7%
add-sqr-sqrt49.1%
unpow249.1%
sqrt-prod29.5%
add-sqr-sqrt59.2%
Applied egg-rr59.2%
Final simplification66.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* d (/ d D)))
(t_1 (* (/ c0 (* w h)) (/ (* d d) (* D D))))
(t_2 (/ c0 (* 2.0 w))))
(if (<= D 1.55e-204)
0.0
(if (<= D 3.4e-142)
(* t_2 (+ t_1 (/ (* (/ c0 w) t_0) (* h D))))
(if (<= D 5.9e+71)
(* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
(if (<= D 6.5e+141)
(* t_2 (+ t_1 (/ t_0 (* D (/ (* w h) c0)))))
0.0))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = d * (d / D);
double t_1 = (c0 / (w * h)) * ((d * d) / (D * D));
double t_2 = c0 / (2.0 * w);
double tmp;
if (D <= 1.55e-204) {
tmp = 0.0;
} else if (D <= 3.4e-142) {
tmp = t_2 * (t_1 + (((c0 / w) * t_0) / (h * D)));
} else if (D <= 5.9e+71) {
tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
} else if (D <= 6.5e+141) {
tmp = t_2 * (t_1 + (t_0 / (D * ((w * h) / c0))));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d_1 * (d_1 / d)
t_1 = (c0 / (w * h)) * ((d_1 * d_1) / (d * d))
t_2 = c0 / (2.0d0 * w)
if (d <= 1.55d-204) then
tmp = 0.0d0
else if (d <= 3.4d-142) then
tmp = t_2 * (t_1 + (((c0 / w) * t_0) / (h * d)))
else if (d <= 5.9d+71) then
tmp = 0.25d0 * ((d ** 2.0d0) / (((d_1 / m) * (d_1 / m)) / h))
else if (d <= 6.5d+141) then
tmp = t_2 * (t_1 + (t_0 / (d * ((w * h) / c0))))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = d * (d / D);
double t_1 = (c0 / (w * h)) * ((d * d) / (D * D));
double t_2 = c0 / (2.0 * w);
double tmp;
if (D <= 1.55e-204) {
tmp = 0.0;
} else if (D <= 3.4e-142) {
tmp = t_2 * (t_1 + (((c0 / w) * t_0) / (h * D)));
} else if (D <= 5.9e+71) {
tmp = 0.25 * (Math.pow(D, 2.0) / (((d / M) * (d / M)) / h));
} else if (D <= 6.5e+141) {
tmp = t_2 * (t_1 + (t_0 / (D * ((w * h) / c0))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = d * (d / D) t_1 = (c0 / (w * h)) * ((d * d) / (D * D)) t_2 = c0 / (2.0 * w) tmp = 0 if D <= 1.55e-204: tmp = 0.0 elif D <= 3.4e-142: tmp = t_2 * (t_1 + (((c0 / w) * t_0) / (h * D))) elif D <= 5.9e+71: tmp = 0.25 * (math.pow(D, 2.0) / (((d / M) * (d / M)) / h)) elif D <= 6.5e+141: tmp = t_2 * (t_1 + (t_0 / (D * ((w * h) / c0)))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(d * Float64(d / D)) t_1 = Float64(Float64(c0 / Float64(w * h)) * Float64(Float64(d * d) / Float64(D * D))) t_2 = Float64(c0 / Float64(2.0 * w)) tmp = 0.0 if (D <= 1.55e-204) tmp = 0.0; elseif (D <= 3.4e-142) tmp = Float64(t_2 * Float64(t_1 + Float64(Float64(Float64(c0 / w) * t_0) / Float64(h * D)))); elseif (D <= 5.9e+71) tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h))); elseif (D <= 6.5e+141) tmp = Float64(t_2 * Float64(t_1 + Float64(t_0 / Float64(D * Float64(Float64(w * h) / c0))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = d * (d / D); t_1 = (c0 / (w * h)) * ((d * d) / (D * D)); t_2 = c0 / (2.0 * w); tmp = 0.0; if (D <= 1.55e-204) tmp = 0.0; elseif (D <= 3.4e-142) tmp = t_2 * (t_1 + (((c0 / w) * t_0) / (h * D))); elseif (D <= 5.9e+71) tmp = 0.25 * ((D ^ 2.0) / (((d / M) * (d / M)) / h)); elseif (D <= 6.5e+141) tmp = t_2 * (t_1 + (t_0 / (D * ((w * h) / c0)))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, 1.55e-204], 0.0, If[LessEqual[D, 3.4e-142], N[(t$95$2 * N[(t$95$1 + N[(N[(N[(c0 / w), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 5.9e+71], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 6.5e+141], N[(t$95$2 * N[(t$95$1 + N[(t$95$0 / N[(D * N[(N[(w * h), $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d \cdot \frac{d}{D}\\
t_1 := \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\\
t_2 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;D \leq 1.55 \cdot 10^{-204}:\\
\;\;\;\;0\\
\mathbf{elif}\;D \leq 3.4 \cdot 10^{-142}:\\
\;\;\;\;t\_2 \cdot \left(t\_1 + \frac{\frac{c0}{w} \cdot t\_0}{h \cdot D}\right)\\
\mathbf{elif}\;D \leq 5.9 \cdot 10^{+71}:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\
\mathbf{elif}\;D \leq 6.5 \cdot 10^{+141}:\\
\;\;\;\;t\_2 \cdot \left(t\_1 + \frac{t\_0}{D \cdot \frac{w \cdot h}{c0}}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if D < 1.55e-204 or 6.50000000000000053e141 < D Initial program 26.7%
+-commutative26.7%
+-commutative26.7%
times-frac25.4%
fma-neg25.4%
Simplified28.1%
Taylor expanded in c0 around -inf 4.0%
mul-1-neg4.0%
distribute-lft-in3.3%
Simplified33.0%
Taylor expanded in c0 around 0 35.8%
if 1.55e-204 < D < 3.40000000000000029e-142Initial program 36.8%
+-commutative36.8%
+-commutative36.8%
times-frac36.7%
fma-neg36.7%
Simplified36.7%
frac-times36.7%
Applied egg-rr36.7%
Taylor expanded in c0 around inf 47.5%
*-commutative47.5%
*-commutative47.5%
times-frac47.6%
*-commutative47.6%
unpow247.6%
associate-/r*47.7%
unpow247.7%
associate-*l/47.6%
associate-*r/47.6%
unpow247.6%
Simplified47.6%
pow247.6%
associate-/l/47.6%
associate-*r/47.7%
frac-times47.7%
Applied egg-rr47.7%
if 3.40000000000000029e-142 < D < 5.9000000000000002e71Initial program 27.0%
+-commutative27.0%
+-commutative27.0%
times-frac23.5%
fma-neg23.5%
Simplified30.5%
Taylor expanded in c0 around -inf 10.9%
fma-def10.9%
distribute-lft1-in10.9%
metadata-eval10.9%
associate-/r*9.2%
times-frac9.4%
associate-*r*9.4%
Simplified9.4%
Taylor expanded in c0 around 0 53.7%
associate-/l*53.7%
associate-/r*52.0%
Simplified52.0%
add-sqr-sqrt52.0%
sqrt-div52.0%
unpow252.0%
sqrt-prod25.3%
add-sqr-sqrt51.9%
unpow251.9%
sqrt-prod19.8%
add-sqr-sqrt45.2%
sqrt-div45.2%
unpow245.2%
sqrt-prod18.6%
add-sqr-sqrt49.0%
unpow249.0%
sqrt-prod30.4%
add-sqr-sqrt62.6%
Applied egg-rr62.6%
if 5.9000000000000002e71 < D < 6.50000000000000053e141Initial program 29.2%
+-commutative29.2%
+-commutative29.2%
times-frac28.7%
fma-neg28.7%
Simplified34.1%
frac-times34.1%
Applied egg-rr34.1%
Taylor expanded in c0 around inf 45.9%
*-commutative45.9%
*-commutative45.9%
times-frac46.0%
*-commutative46.0%
unpow246.0%
associate-/r*46.0%
unpow246.0%
associate-*l/46.0%
associate-*r/46.0%
unpow246.0%
Simplified46.0%
pow246.0%
associate-/l/46.1%
*-commutative46.1%
associate-*r/46.1%
associate-/l/46.0%
clear-num46.1%
frac-times46.0%
Applied egg-rr46.0%
Final simplification43.5%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= w -4.4e+104)
0.0
(if (or (<= w -4.2e-106) (and (not (<= w -2.5e-266)) (<= w 1.9e-96)))
(*
(/ c0 (* 2.0 w))
(+
(* (/ c0 (* w h)) (/ (* d d) (* D D)))
(/ (* c0 (* d (/ d D))) (* D (* w h)))))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (w <= -4.4e+104) {
tmp = 0.0;
} else if ((w <= -4.2e-106) || (!(w <= -2.5e-266) && (w <= 1.9e-96))) {
tmp = (c0 / (2.0 * w)) * (((c0 / (w * h)) * ((d * d) / (D * D))) + ((c0 * (d * (d / D))) / (D * (w * h))));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if (w <= (-4.4d+104)) then
tmp = 0.0d0
else if ((w <= (-4.2d-106)) .or. (.not. (w <= (-2.5d-266))) .and. (w <= 1.9d-96)) then
tmp = (c0 / (2.0d0 * w)) * (((c0 / (w * h)) * ((d_1 * d_1) / (d * d))) + ((c0 * (d_1 * (d_1 / d))) / (d * (w * h))))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (w <= -4.4e+104) {
tmp = 0.0;
} else if ((w <= -4.2e-106) || (!(w <= -2.5e-266) && (w <= 1.9e-96))) {
tmp = (c0 / (2.0 * w)) * (((c0 / (w * h)) * ((d * d) / (D * D))) + ((c0 * (d * (d / D))) / (D * (w * h))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if w <= -4.4e+104: tmp = 0.0 elif (w <= -4.2e-106) or (not (w <= -2.5e-266) and (w <= 1.9e-96)): tmp = (c0 / (2.0 * w)) * (((c0 / (w * h)) * ((d * d) / (D * D))) + ((c0 * (d * (d / D))) / (D * (w * h)))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (w <= -4.4e+104) tmp = 0.0; elseif ((w <= -4.2e-106) || (!(w <= -2.5e-266) && (w <= 1.9e-96))) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(Float64(c0 / Float64(w * h)) * Float64(Float64(d * d) / Float64(D * D))) + Float64(Float64(c0 * Float64(d * Float64(d / D))) / Float64(D * Float64(w * h))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (w <= -4.4e+104) tmp = 0.0; elseif ((w <= -4.2e-106) || (~((w <= -2.5e-266)) && (w <= 1.9e-96))) tmp = (c0 / (2.0 * w)) * (((c0 / (w * h)) * ((d * d) / (D * D))) + ((c0 * (d * (d / D))) / (D * (w * h)))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[w, -4.4e+104], 0.0, If[Or[LessEqual[w, -4.2e-106], And[N[Not[LessEqual[w, -2.5e-266]], $MachinePrecision], LessEqual[w, 1.9e-96]]], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(c0 * N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(D * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -4.4 \cdot 10^{+104}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq -4.2 \cdot 10^{-106} \lor \neg \left(w \leq -2.5 \cdot 10^{-266}\right) \land w \leq 1.9 \cdot 10^{-96}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot \left(d \cdot \frac{d}{D}\right)}{D \cdot \left(w \cdot h\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -4.40000000000000001e104 or -4.20000000000000007e-106 < w < -2.49999999999999996e-266 or 1.9e-96 < w Initial program 19.9%
+-commutative19.9%
+-commutative19.9%
times-frac18.5%
fma-neg18.5%
Simplified21.3%
Taylor expanded in c0 around -inf 7.9%
mul-1-neg7.9%
distribute-lft-in7.1%
Simplified44.6%
Taylor expanded in c0 around 0 48.8%
if -4.40000000000000001e104 < w < -4.20000000000000007e-106 or -2.49999999999999996e-266 < w < 1.9e-96Initial program 37.9%
+-commutative37.9%
+-commutative37.9%
times-frac36.1%
fma-neg36.1%
Simplified40.7%
frac-times39.8%
Applied egg-rr39.8%
Taylor expanded in c0 around inf 39.5%
*-commutative39.5%
*-commutative39.5%
times-frac41.7%
*-commutative41.7%
unpow241.7%
associate-/r*42.6%
unpow242.6%
associate-*l/42.6%
associate-*r/42.6%
unpow242.6%
Simplified42.6%
pow242.6%
associate-/l/42.6%
*-commutative42.6%
associate-*r/42.6%
associate-/l/42.6%
frac-times42.5%
Applied egg-rr42.5%
Final simplification46.1%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* (/ c0 (* w h)) (/ (* d d) (* D D))))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (* d (/ d D))))
(if (<= w -8e+104)
0.0
(if (<= w -4e-104)
(* t_1 (+ t_0 (/ (* t_2 (/ c0 h)) (* w D))))
(if (<= w -9.4e-268)
0.0
(if (<= w 3e-96)
(* t_1 (+ t_0 (/ (* c0 t_2) (* D (* w h)))))
0.0))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / (w * h)) * ((d * d) / (D * D));
double t_1 = c0 / (2.0 * w);
double t_2 = d * (d / D);
double tmp;
if (w <= -8e+104) {
tmp = 0.0;
} else if (w <= -4e-104) {
tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D)));
} else if (w <= -9.4e-268) {
tmp = 0.0;
} else if (w <= 3e-96) {
tmp = t_1 * (t_0 + ((c0 * t_2) / (D * (w * h))));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (c0 / (w * h)) * ((d_1 * d_1) / (d * d))
t_1 = c0 / (2.0d0 * w)
t_2 = d_1 * (d_1 / d)
if (w <= (-8d+104)) then
tmp = 0.0d0
else if (w <= (-4d-104)) then
tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * d)))
else if (w <= (-9.4d-268)) then
tmp = 0.0d0
else if (w <= 3d-96) then
tmp = t_1 * (t_0 + ((c0 * t_2) / (d * (w * h))))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / (w * h)) * ((d * d) / (D * D));
double t_1 = c0 / (2.0 * w);
double t_2 = d * (d / D);
double tmp;
if (w <= -8e+104) {
tmp = 0.0;
} else if (w <= -4e-104) {
tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D)));
} else if (w <= -9.4e-268) {
tmp = 0.0;
} else if (w <= 3e-96) {
tmp = t_1 * (t_0 + ((c0 * t_2) / (D * (w * h))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 / (w * h)) * ((d * d) / (D * D)) t_1 = c0 / (2.0 * w) t_2 = d * (d / D) tmp = 0 if w <= -8e+104: tmp = 0.0 elif w <= -4e-104: tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D))) elif w <= -9.4e-268: tmp = 0.0 elif w <= 3e-96: tmp = t_1 * (t_0 + ((c0 * t_2) / (D * (w * h)))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 / Float64(w * h)) * Float64(Float64(d * d) / Float64(D * D))) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(d * Float64(d / D)) tmp = 0.0 if (w <= -8e+104) tmp = 0.0; elseif (w <= -4e-104) tmp = Float64(t_1 * Float64(t_0 + Float64(Float64(t_2 * Float64(c0 / h)) / Float64(w * D)))); elseif (w <= -9.4e-268) tmp = 0.0; elseif (w <= 3e-96) tmp = Float64(t_1 * Float64(t_0 + Float64(Float64(c0 * t_2) / Float64(D * Float64(w * h))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 / (w * h)) * ((d * d) / (D * D)); t_1 = c0 / (2.0 * w); t_2 = d * (d / D); tmp = 0.0; if (w <= -8e+104) tmp = 0.0; elseif (w <= -4e-104) tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D))); elseif (w <= -9.4e-268) tmp = 0.0; elseif (w <= 3e-96) tmp = t_1 * (t_0 + ((c0 * t_2) / (D * (w * h)))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -8e+104], 0.0, If[LessEqual[w, -4e-104], N[(t$95$1 * N[(t$95$0 + N[(N[(t$95$2 * N[(c0 / h), $MachinePrecision]), $MachinePrecision] / N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, -9.4e-268], 0.0, If[LessEqual[w, 3e-96], N[(t$95$1 * N[(t$95$0 + N[(N[(c0 * t$95$2), $MachinePrecision] / N[(D * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := d \cdot \frac{d}{D}\\
\mathbf{if}\;w \leq -8 \cdot 10^{+104}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq -4 \cdot 10^{-104}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 + \frac{t\_2 \cdot \frac{c0}{h}}{w \cdot D}\right)\\
\mathbf{elif}\;w \leq -9.4 \cdot 10^{-268}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 3 \cdot 10^{-96}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 + \frac{c0 \cdot t\_2}{D \cdot \left(w \cdot h\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -8e104 or -3.99999999999999971e-104 < w < -9.39999999999999947e-268 or 3e-96 < w Initial program 19.9%
+-commutative19.9%
+-commutative19.9%
times-frac18.5%
fma-neg18.5%
Simplified21.3%
Taylor expanded in c0 around -inf 7.9%
mul-1-neg7.9%
distribute-lft-in7.1%
Simplified44.6%
Taylor expanded in c0 around 0 48.8%
if -8e104 < w < -3.99999999999999971e-104Initial program 47.6%
+-commutative47.6%
+-commutative47.6%
times-frac44.4%
fma-neg44.4%
Simplified47.4%
frac-times44.4%
Applied egg-rr44.4%
Taylor expanded in c0 around inf 42.0%
*-commutative42.0%
*-commutative42.0%
times-frac41.9%
*-commutative41.9%
unpow241.9%
associate-/r*41.9%
unpow241.9%
associate-*l/41.9%
associate-*r/41.9%
unpow241.9%
Simplified41.9%
pow241.9%
associate-/r*41.9%
associate-*r/41.9%
frac-times42.0%
Applied egg-rr42.0%
if -9.39999999999999947e-268 < w < 3e-96Initial program 34.1%
+-commutative34.1%
+-commutative34.1%
times-frac32.8%
fma-neg32.8%
Simplified38.0%
frac-times38.0%
Applied egg-rr38.0%
Taylor expanded in c0 around inf 38.5%
*-commutative38.5%
*-commutative38.5%
times-frac41.7%
*-commutative41.7%
unpow241.7%
associate-/r*42.8%
unpow242.8%
associate-*l/42.9%
associate-*r/42.8%
unpow242.8%
Simplified42.8%
pow242.8%
associate-/l/42.8%
*-commutative42.8%
associate-*r/42.9%
associate-/l/42.9%
frac-times42.7%
Applied egg-rr42.7%
Final simplification46.1%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* (/ c0 (* w h)) (/ (* d d) (* D D))))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (* d (/ d D))))
(if (<= w -4.5e+104)
0.0
(if (<= w -6.2e-106)
(* t_1 (+ t_0 (/ (* t_2 (/ c0 h)) (* w D))))
(if (<= w -7.6e-268)
0.0
(if (<= w 2.65e-96)
(* t_1 (+ t_0 (/ t_2 (* D (/ (* w h) c0)))))
0.0))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / (w * h)) * ((d * d) / (D * D));
double t_1 = c0 / (2.0 * w);
double t_2 = d * (d / D);
double tmp;
if (w <= -4.5e+104) {
tmp = 0.0;
} else if (w <= -6.2e-106) {
tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D)));
} else if (w <= -7.6e-268) {
tmp = 0.0;
} else if (w <= 2.65e-96) {
tmp = t_1 * (t_0 + (t_2 / (D * ((w * h) / c0))));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (c0 / (w * h)) * ((d_1 * d_1) / (d * d))
t_1 = c0 / (2.0d0 * w)
t_2 = d_1 * (d_1 / d)
if (w <= (-4.5d+104)) then
tmp = 0.0d0
else if (w <= (-6.2d-106)) then
tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * d)))
else if (w <= (-7.6d-268)) then
tmp = 0.0d0
else if (w <= 2.65d-96) then
tmp = t_1 * (t_0 + (t_2 / (d * ((w * h) / c0))))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / (w * h)) * ((d * d) / (D * D));
double t_1 = c0 / (2.0 * w);
double t_2 = d * (d / D);
double tmp;
if (w <= -4.5e+104) {
tmp = 0.0;
} else if (w <= -6.2e-106) {
tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D)));
} else if (w <= -7.6e-268) {
tmp = 0.0;
} else if (w <= 2.65e-96) {
tmp = t_1 * (t_0 + (t_2 / (D * ((w * h) / c0))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 / (w * h)) * ((d * d) / (D * D)) t_1 = c0 / (2.0 * w) t_2 = d * (d / D) tmp = 0 if w <= -4.5e+104: tmp = 0.0 elif w <= -6.2e-106: tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D))) elif w <= -7.6e-268: tmp = 0.0 elif w <= 2.65e-96: tmp = t_1 * (t_0 + (t_2 / (D * ((w * h) / c0)))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 / Float64(w * h)) * Float64(Float64(d * d) / Float64(D * D))) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(d * Float64(d / D)) tmp = 0.0 if (w <= -4.5e+104) tmp = 0.0; elseif (w <= -6.2e-106) tmp = Float64(t_1 * Float64(t_0 + Float64(Float64(t_2 * Float64(c0 / h)) / Float64(w * D)))); elseif (w <= -7.6e-268) tmp = 0.0; elseif (w <= 2.65e-96) tmp = Float64(t_1 * Float64(t_0 + Float64(t_2 / Float64(D * Float64(Float64(w * h) / c0))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 / (w * h)) * ((d * d) / (D * D)); t_1 = c0 / (2.0 * w); t_2 = d * (d / D); tmp = 0.0; if (w <= -4.5e+104) tmp = 0.0; elseif (w <= -6.2e-106) tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D))); elseif (w <= -7.6e-268) tmp = 0.0; elseif (w <= 2.65e-96) tmp = t_1 * (t_0 + (t_2 / (D * ((w * h) / c0)))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -4.5e+104], 0.0, If[LessEqual[w, -6.2e-106], N[(t$95$1 * N[(t$95$0 + N[(N[(t$95$2 * N[(c0 / h), $MachinePrecision]), $MachinePrecision] / N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, -7.6e-268], 0.0, If[LessEqual[w, 2.65e-96], N[(t$95$1 * N[(t$95$0 + N[(t$95$2 / N[(D * N[(N[(w * h), $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := d \cdot \frac{d}{D}\\
\mathbf{if}\;w \leq -4.5 \cdot 10^{+104}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq -6.2 \cdot 10^{-106}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 + \frac{t\_2 \cdot \frac{c0}{h}}{w \cdot D}\right)\\
\mathbf{elif}\;w \leq -7.6 \cdot 10^{-268}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 2.65 \cdot 10^{-96}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 + \frac{t\_2}{D \cdot \frac{w \cdot h}{c0}}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -4.4999999999999998e104 or -6.19999999999999971e-106 < w < -7.6000000000000005e-268 or 2.6500000000000001e-96 < w Initial program 19.9%
+-commutative19.9%
+-commutative19.9%
times-frac18.5%
fma-neg18.5%
Simplified21.3%
Taylor expanded in c0 around -inf 7.9%
mul-1-neg7.9%
distribute-lft-in7.1%
Simplified44.6%
Taylor expanded in c0 around 0 48.8%
if -4.4999999999999998e104 < w < -6.19999999999999971e-106Initial program 47.6%
+-commutative47.6%
+-commutative47.6%
times-frac44.4%
fma-neg44.4%
Simplified47.4%
frac-times44.4%
Applied egg-rr44.4%
Taylor expanded in c0 around inf 42.0%
*-commutative42.0%
*-commutative42.0%
times-frac41.9%
*-commutative41.9%
unpow241.9%
associate-/r*41.9%
unpow241.9%
associate-*l/41.9%
associate-*r/41.9%
unpow241.9%
Simplified41.9%
pow241.9%
associate-/r*41.9%
associate-*r/41.9%
frac-times42.0%
Applied egg-rr42.0%
if -7.6000000000000005e-268 < w < 2.6500000000000001e-96Initial program 34.1%
+-commutative34.1%
+-commutative34.1%
times-frac32.8%
fma-neg32.8%
Simplified38.0%
frac-times38.0%
Applied egg-rr38.0%
Taylor expanded in c0 around inf 38.5%
*-commutative38.5%
*-commutative38.5%
times-frac41.7%
*-commutative41.7%
unpow241.7%
associate-/r*42.8%
unpow242.8%
associate-*l/42.9%
associate-*r/42.8%
unpow242.8%
Simplified42.8%
pow242.8%
associate-/l/42.8%
*-commutative42.8%
associate-*r/42.9%
associate-/l/42.9%
clear-num42.9%
frac-times42.9%
Applied egg-rr42.9%
Final simplification46.1%
(FPCore (c0 w h D d M) :precision binary64 0.0)
double code(double c0, double w, double h, double D, double d, double M) {
return 0.0;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = 0.0d0
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return 0.0;
}
def code(c0, w, h, D, d, M): return 0.0
function code(c0, w, h, D, d, M) return 0.0 end
function tmp = code(c0, w, h, D, d, M) tmp = 0.0; end
code[c0_, w_, h_, D_, d_, M_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 27.8%
+-commutative27.8%
+-commutative27.8%
times-frac26.2%
fma-neg26.2%
Simplified29.8%
Taylor expanded in c0 around -inf 5.3%
mul-1-neg5.3%
distribute-lft-in4.9%
Simplified32.1%
Taylor expanded in c0 around 0 35.8%
Final simplification35.8%
herbie shell --seed 2024040
(FPCore (c0 w h D d M)
:name "Henrywood and Agarwal, Equation (13)"
:precision binary64
(* (/ c0 (* 2.0 w)) (+ (/ (* c0 (* d d)) (* (* w h) (* D D))) (sqrt (- (* (/ (* c0 (* d d)) (* (* w h) (* D D))) (/ (* c0 (* d d)) (* (* w h) (* D D)))) (* M M))))))