
(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 7 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 (* h (* w 0.0)))
(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 (/ (/ c0 w) 2.0)))
(if (<= t_3 -5e+53)
(* t_4 (* 2.0 (* (/ d (* (pow D 2.0) (* w h))) (/ d (/ 1.0 c0)))))
(if (<= t_3 0.0)
(*
t_4
(-
(fma 0.5 (/ (pow D 2.0) (/ (pow d 2.0) t_0)) 0.0)
(*
-0.5
(*
(/ (pow D 2.0) c0)
(/
(*
(* w h)
(+
(pow M 2.0)
(pow (/ (* 0.5 (* (pow D 2.0) t_0)) (pow d 2.0)) 2.0)))
(pow d 2.0))))))
(if (<= t_3 INFINITY)
(pow
(cbrt
(*
(* 2.0 t_1)
(pow (/ d (/ D (* (sqrt (/ c0 w)) (sqrt (/ 1.0 h))))) 2.0)))
3.0)
0.0)))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = h * (w * 0.0);
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 = (c0 / w) / 2.0;
double tmp;
if (t_3 <= -5e+53) {
tmp = t_4 * (2.0 * ((d / (pow(D, 2.0) * (w * h))) * (d / (1.0 / c0))));
} else if (t_3 <= 0.0) {
tmp = t_4 * (fma(0.5, (pow(D, 2.0) / (pow(d, 2.0) / t_0)), 0.0) - (-0.5 * ((pow(D, 2.0) / c0) * (((w * h) * (pow(M, 2.0) + pow(((0.5 * (pow(D, 2.0) * t_0)) / pow(d, 2.0)), 2.0))) / pow(d, 2.0)))));
} else if (t_3 <= ((double) INFINITY)) {
tmp = pow(cbrt(((2.0 * t_1) * pow((d / (D / (sqrt((c0 / w)) * sqrt((1.0 / h))))), 2.0))), 3.0);
} else {
tmp = 0.0;
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(h * Float64(w * 0.0)) 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(Float64(c0 / w) / 2.0) tmp = 0.0 if (t_3 <= -5e+53) tmp = Float64(t_4 * Float64(2.0 * Float64(Float64(d / Float64((D ^ 2.0) * Float64(w * h))) * Float64(d / Float64(1.0 / c0))))); elseif (t_3 <= 0.0) tmp = Float64(t_4 * Float64(fma(0.5, Float64((D ^ 2.0) / Float64((d ^ 2.0) / t_0)), 0.0) - Float64(-0.5 * Float64(Float64((D ^ 2.0) / c0) * Float64(Float64(Float64(w * h) * Float64((M ^ 2.0) + (Float64(Float64(0.5 * Float64((D ^ 2.0) * t_0)) / (d ^ 2.0)) ^ 2.0))) / (d ^ 2.0)))))); elseif (t_3 <= Inf) tmp = cbrt(Float64(Float64(2.0 * t_1) * (Float64(d / Float64(D / Float64(sqrt(Float64(c0 / w)) * sqrt(Float64(1.0 / h))))) ^ 2.0))) ^ 3.0; else tmp = 0.0; end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(h * N[(w * 0.0), $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[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[t$95$3, -5e+53], N[(t$95$4 * N[(2.0 * N[(N[(d / N[(N[Power[D, 2.0], $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(1.0 / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(t$95$4 * N[(N[(0.5 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[Power[d, 2.0], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] + 0.0), $MachinePrecision] - N[(-0.5 * N[(N[(N[Power[D, 2.0], $MachinePrecision] / c0), $MachinePrecision] * N[(N[(N[(w * h), $MachinePrecision] * N[(N[Power[M, 2.0], $MachinePrecision] + N[Power[N[(N[(0.5 * N[(N[Power[D, 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[Power[N[Power[N[(N[(2.0 * t$95$1), $MachinePrecision] * N[Power[N[(d / N[(D / N[(N[Sqrt[N[(c0 / w), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], 0.0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := h \cdot \left(w \cdot 0\right)\\
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 := \frac{\frac{c0}{w}}{2}\\
\mathbf{if}\;t_3 \leq -5 \cdot 10^{+53}:\\
\;\;\;\;t_4 \cdot \left(2 \cdot \left(\frac{d}{{D}^{2} \cdot \left(w \cdot h\right)} \cdot \frac{d}{\frac{1}{c0}}\right)\right)\\
\mathbf{elif}\;t_3 \leq 0:\\
\;\;\;\;t_4 \cdot \left(\mathsf{fma}\left(0.5, \frac{{D}^{2}}{\frac{{d}^{2}}{t_0}}, 0\right) - -0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left(w \cdot h\right) \cdot \left({M}^{2} + {\left(\frac{0.5 \cdot \left({D}^{2} \cdot t_0\right)}{{d}^{2}}\right)}^{2}\right)}{{d}^{2}}\right)\right)\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;{\left(\sqrt[3]{\left(2 \cdot t_1\right) \cdot {\left(\frac{d}{\frac{D}{\sqrt{\frac{c0}{w}} \cdot \sqrt{\frac{1}{h}}}}\right)}^{2}}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;0\\
\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))))) < -5.0000000000000004e53Initial program 74.0%
Simplified73.7%
sqrt-prod73.7%
fma-udef73.7%
*-commutative73.7%
fma-udef73.7%
associate-/r*73.7%
pow273.7%
pow273.7%
Applied egg-rr73.7%
*-commutative73.7%
fma-udef73.7%
unsub-neg73.7%
*-commutative73.7%
*-commutative73.7%
associate-*r*73.7%
Simplified73.7%
Taylor expanded in c0 around inf 74.0%
associate-/r*70.3%
*-commutative70.3%
*-commutative70.3%
associate-/r*74.0%
associate-/l*73.8%
*-commutative73.8%
Simplified73.8%
unpow273.8%
div-inv73.8%
times-frac85.1%
*-commutative85.1%
*-commutative85.1%
Applied egg-rr85.1%
if -5.0000000000000004e53 < (*.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 55.4%
Simplified10.2%
Taylor expanded in c0 around -inf 69.9%
Simplified69.8%
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 83.5%
Simplified81.0%
sqrt-prod80.9%
fma-udef80.9%
*-commutative80.9%
fma-udef80.9%
associate-/r*80.9%
pow280.9%
pow280.9%
Applied egg-rr80.9%
*-commutative80.9%
fma-udef80.9%
unsub-neg80.9%
*-commutative80.9%
*-commutative80.9%
associate-*r*80.9%
Simplified80.9%
Taylor expanded in c0 around inf 83.5%
associate-/r*85.8%
*-commutative85.8%
*-commutative85.8%
associate-/r*83.5%
associate-/l*83.5%
*-commutative83.5%
Simplified83.5%
add-cube-cbrt83.4%
pow383.4%
Applied egg-rr92.4%
pow1/292.4%
associate-/r*92.4%
div-inv92.4%
unpow-prod-down92.4%
pow1/292.4%
Applied egg-rr92.4%
unpow1/292.4%
Simplified92.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%
Simplified0.1%
Taylor expanded in c0 around -inf 1.3%
mul-1-neg1.3%
distribute-lft-in1.3%
Simplified37.4%
Taylor expanded in c0 around 0 44.1%
Final simplification57.5%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w)))
(t_1 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_2 (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))))
(if (<= t_2 -5e+53)
(*
(/ (/ c0 w) 2.0)
(* 2.0 (* (/ d (* (pow D 2.0) (* w h))) (/ d (/ 1.0 c0)))))
(if (<= t_2 0.0)
(*
t_0
(fma
0.5
(/ (* (/ (pow D 2.0) c0) (* (* w h) (pow M 2.0))) (pow d 2.0))
0.0))
(if (<= t_2 INFINITY)
(pow
(cbrt
(*
(* 2.0 t_0)
(pow (/ d (/ D (* (sqrt (/ c0 w)) (sqrt (/ 1.0 h))))) 2.0)))
3.0)
0.0)))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_2 = t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= -5e+53) {
tmp = ((c0 / w) / 2.0) * (2.0 * ((d / (pow(D, 2.0) * (w * h))) * (d / (1.0 / c0))));
} else if (t_2 <= 0.0) {
tmp = t_0 * fma(0.5, (((pow(D, 2.0) / c0) * ((w * h) * pow(M, 2.0))) / pow(d, 2.0)), 0.0);
} else if (t_2 <= ((double) INFINITY)) {
tmp = pow(cbrt(((2.0 * t_0) * pow((d / (D / (sqrt((c0 / w)) * sqrt((1.0 / h))))), 2.0))), 3.0);
} else {
tmp = 0.0;
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) t_2 = Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) tmp = 0.0 if (t_2 <= -5e+53) tmp = Float64(Float64(Float64(c0 / w) / 2.0) * Float64(2.0 * Float64(Float64(d / Float64((D ^ 2.0) * Float64(w * h))) * Float64(d / Float64(1.0 / c0))))); elseif (t_2 <= 0.0) tmp = Float64(t_0 * fma(0.5, Float64(Float64(Float64((D ^ 2.0) / c0) * Float64(Float64(w * h) * (M ^ 2.0))) / (d ^ 2.0)), 0.0)); elseif (t_2 <= Inf) tmp = cbrt(Float64(Float64(2.0 * t_0) * (Float64(d / Float64(D / Float64(sqrt(Float64(c0 / w)) * sqrt(Float64(1.0 / h))))) ^ 2.0))) ^ 3.0; else tmp = 0.0; end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+53], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(2.0 * N[(N[(d / N[(N[Power[D, 2.0], $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(1.0 / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(t$95$0 * N[(0.5 * N[(N[(N[(N[Power[D, 2.0], $MachinePrecision] / c0), $MachinePrecision] * N[(N[(w * h), $MachinePrecision] * N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision] + 0.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[Power[N[Power[N[(N[(2.0 * t$95$0), $MachinePrecision] * N[Power[N[(d / N[(D / N[(N[Sqrt[N[(c0 / w), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], 0.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_2 := t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right)\\
\mathbf{if}\;t_2 \leq -5 \cdot 10^{+53}:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \left(2 \cdot \left(\frac{d}{{D}^{2} \cdot \left(w \cdot h\right)} \cdot \frac{d}{\frac{1}{c0}}\right)\right)\\
\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;t_0 \cdot \mathsf{fma}\left(0.5, \frac{\frac{{D}^{2}}{c0} \cdot \left(\left(w \cdot h\right) \cdot {M}^{2}\right)}{{d}^{2}}, 0\right)\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;{\left(\sqrt[3]{\left(2 \cdot t_0\right) \cdot {\left(\frac{d}{\frac{D}{\sqrt{\frac{c0}{w}} \cdot \sqrt{\frac{1}{h}}}}\right)}^{2}}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;0\\
\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))))) < -5.0000000000000004e53Initial program 74.0%
Simplified73.7%
sqrt-prod73.7%
fma-udef73.7%
*-commutative73.7%
fma-udef73.7%
associate-/r*73.7%
pow273.7%
pow273.7%
Applied egg-rr73.7%
*-commutative73.7%
fma-udef73.7%
unsub-neg73.7%
*-commutative73.7%
*-commutative73.7%
associate-*r*73.7%
Simplified73.7%
Taylor expanded in c0 around inf 74.0%
associate-/r*70.3%
*-commutative70.3%
*-commutative70.3%
associate-/r*74.0%
associate-/l*73.8%
*-commutative73.8%
Simplified73.8%
unpow273.8%
div-inv73.8%
times-frac85.1%
*-commutative85.1%
*-commutative85.1%
Applied egg-rr85.1%
if -5.0000000000000004e53 < (*.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 55.4%
Simplified41.9%
Taylor expanded in c0 around -inf 63.4%
Simplified63.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 83.5%
Simplified81.0%
sqrt-prod80.9%
fma-udef80.9%
*-commutative80.9%
fma-udef80.9%
associate-/r*80.9%
pow280.9%
pow280.9%
Applied egg-rr80.9%
*-commutative80.9%
fma-udef80.9%
unsub-neg80.9%
*-commutative80.9%
*-commutative80.9%
associate-*r*80.9%
Simplified80.9%
Taylor expanded in c0 around inf 83.5%
associate-/r*85.8%
*-commutative85.8%
*-commutative85.8%
associate-/r*83.5%
associate-/l*83.5%
*-commutative83.5%
Simplified83.5%
add-cube-cbrt83.4%
pow383.4%
Applied egg-rr92.4%
pow1/292.4%
associate-/r*92.4%
div-inv92.4%
unpow-prod-down92.4%
pow1/292.4%
Applied egg-rr92.4%
unpow1/292.4%
Simplified92.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%
Simplified0.1%
Taylor expanded in c0 around -inf 1.3%
mul-1-neg1.3%
distribute-lft-in1.3%
Simplified37.4%
Taylor expanded in c0 around 0 44.1%
Final simplification57.2%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w)))
(t_1 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_2 (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))))
(if (<= t_2 -5e+53)
(*
(/ (/ c0 w) 2.0)
(* 2.0 (* (/ d (* (pow D 2.0) (* w h))) (/ d (/ 1.0 c0)))))
(if (<= t_2 0.0)
(*
t_0
(fma
0.5
(/ (* (/ (pow D 2.0) c0) (* (* w h) (pow M 2.0))) (pow d 2.0))
0.0))
(if (<= t_2 INFINITY)
(pow (* (* (/ d D) (sqrt (/ (/ c0 w) h))) (sqrt (* 2.0 t_0))) 2.0)
0.0)))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_2 = t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= -5e+53) {
tmp = ((c0 / w) / 2.0) * (2.0 * ((d / (pow(D, 2.0) * (w * h))) * (d / (1.0 / c0))));
} else if (t_2 <= 0.0) {
tmp = t_0 * fma(0.5, (((pow(D, 2.0) / c0) * ((w * h) * pow(M, 2.0))) / pow(d, 2.0)), 0.0);
} else if (t_2 <= ((double) INFINITY)) {
tmp = pow((((d / D) * sqrt(((c0 / w) / h))) * sqrt((2.0 * t_0))), 2.0);
} else {
tmp = 0.0;
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) t_2 = Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) tmp = 0.0 if (t_2 <= -5e+53) tmp = Float64(Float64(Float64(c0 / w) / 2.0) * Float64(2.0 * Float64(Float64(d / Float64((D ^ 2.0) * Float64(w * h))) * Float64(d / Float64(1.0 / c0))))); elseif (t_2 <= 0.0) tmp = Float64(t_0 * fma(0.5, Float64(Float64(Float64((D ^ 2.0) / c0) * Float64(Float64(w * h) * (M ^ 2.0))) / (d ^ 2.0)), 0.0)); elseif (t_2 <= Inf) tmp = Float64(Float64(Float64(d / D) * sqrt(Float64(Float64(c0 / w) / h))) * sqrt(Float64(2.0 * t_0))) ^ 2.0; else tmp = 0.0; end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+53], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(2.0 * N[(N[(d / N[(N[Power[D, 2.0], $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(1.0 / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(t$95$0 * N[(0.5 * N[(N[(N[(N[Power[D, 2.0], $MachinePrecision] / c0), $MachinePrecision] * N[(N[(w * h), $MachinePrecision] * N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision] + 0.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[Power[N[(N[(N[(d / D), $MachinePrecision] * N[Sqrt[N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], 0.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_2 := t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right)\\
\mathbf{if}\;t_2 \leq -5 \cdot 10^{+53}:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \left(2 \cdot \left(\frac{d}{{D}^{2} \cdot \left(w \cdot h\right)} \cdot \frac{d}{\frac{1}{c0}}\right)\right)\\
\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;t_0 \cdot \mathsf{fma}\left(0.5, \frac{\frac{{D}^{2}}{c0} \cdot \left(\left(w \cdot h\right) \cdot {M}^{2}\right)}{{d}^{2}}, 0\right)\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;{\left(\left(\frac{d}{D} \cdot \sqrt{\frac{\frac{c0}{w}}{h}}\right) \cdot \sqrt{2 \cdot t_0}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\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))))) < -5.0000000000000004e53Initial program 74.0%
Simplified73.7%
sqrt-prod73.7%
fma-udef73.7%
*-commutative73.7%
fma-udef73.7%
associate-/r*73.7%
pow273.7%
pow273.7%
Applied egg-rr73.7%
*-commutative73.7%
fma-udef73.7%
unsub-neg73.7%
*-commutative73.7%
*-commutative73.7%
associate-*r*73.7%
Simplified73.7%
Taylor expanded in c0 around inf 74.0%
associate-/r*70.3%
*-commutative70.3%
*-commutative70.3%
associate-/r*74.0%
associate-/l*73.8%
*-commutative73.8%
Simplified73.8%
unpow273.8%
div-inv73.8%
times-frac85.1%
*-commutative85.1%
*-commutative85.1%
Applied egg-rr85.1%
if -5.0000000000000004e53 < (*.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 55.4%
Simplified41.9%
Taylor expanded in c0 around -inf 63.4%
Simplified63.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 83.5%
Simplified81.0%
sqrt-prod80.9%
fma-udef80.9%
*-commutative80.9%
fma-udef80.9%
associate-/r*80.9%
pow280.9%
pow280.9%
Applied egg-rr80.9%
*-commutative80.9%
fma-udef80.9%
unsub-neg80.9%
*-commutative80.9%
*-commutative80.9%
associate-*r*80.9%
Simplified80.9%
Taylor expanded in c0 around inf 83.5%
associate-/r*85.8%
*-commutative85.8%
*-commutative85.8%
associate-/r*83.5%
associate-/l*83.5%
*-commutative83.5%
Simplified83.5%
add-sqr-sqrt83.4%
pow283.4%
Applied egg-rr92.5%
*-commutative92.5%
associate-/r/92.4%
associate-/r*92.4%
*-commutative92.4%
*-commutative92.4%
Simplified92.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%
Simplified0.1%
Taylor expanded in c0 around -inf 1.3%
mul-1-neg1.3%
distribute-lft-in1.3%
Simplified37.4%
Taylor expanded in c0 around 0 44.1%
Final simplification57.2%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (* c0 (* d d)) (* (* D D) (* w h)))))
(if (<=
(* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))
INFINITY)
(*
(/ (/ c0 w) 2.0)
(* 2.0 (* (/ d (* (pow D 2.0) (* w h))) (/ d (/ 1.0 c0)))))
0.0)))
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 tmp;
if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= ((double) INFINITY)) {
tmp = ((c0 / w) / 2.0) * (2.0 * ((d / (pow(D, 2.0) * (w * h))) * (d / (1.0 / c0))));
} else {
tmp = 0.0;
}
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 tmp;
if (((c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = ((c0 / w) / 2.0) * (2.0 * ((d / (Math.pow(D, 2.0) * (w * h))) * (d / (1.0 / c0))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((D * D) * (w * h)) tmp = 0 if ((c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))) <= math.inf: tmp = ((c0 / w) / 2.0) * (2.0 * ((d / (math.pow(D, 2.0) * (w * h))) * (d / (1.0 / c0)))) else: tmp = 0.0 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))) tmp = 0.0 if (Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) <= Inf) tmp = Float64(Float64(Float64(c0 / w) / 2.0) * Float64(2.0 * Float64(Float64(d / Float64((D ^ 2.0) * Float64(w * h))) * Float64(d / Float64(1.0 / c0))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((D * D) * (w * h)); tmp = 0.0; if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= Inf) tmp = ((c0 / w) / 2.0) * (2.0 * ((d / ((D ^ 2.0) * (w * h))) * (d / (1.0 / 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[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[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], Infinity], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(2.0 * N[(N[(d / N[(N[Power[D, 2.0], $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(1.0 / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\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)}\\
\mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \left(2 \cdot \left(\frac{d}{{D}^{2} \cdot \left(w \cdot h\right)} \cdot \frac{d}{\frac{1}{c0}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\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 75.3%
Simplified65.7%
sqrt-prod63.9%
fma-udef63.9%
*-commutative63.9%
fma-udef63.9%
associate-/r*63.9%
pow263.9%
pow263.9%
Applied egg-rr63.9%
*-commutative63.9%
fma-udef63.9%
unsub-neg63.9%
*-commutative63.9%
*-commutative63.9%
associate-*r*65.1%
Simplified65.1%
Taylor expanded in c0 around inf 70.4%
associate-/r*67.9%
*-commutative67.9%
*-commutative67.9%
associate-/r*70.4%
associate-/l*70.3%
*-commutative70.3%
Simplified70.3%
unpow270.3%
div-inv70.3%
times-frac76.2%
*-commutative76.2%
*-commutative76.2%
Applied egg-rr76.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))))) Initial program 0.0%
Simplified0.1%
Taylor expanded in c0 around -inf 1.3%
mul-1-neg1.3%
distribute-lft-in1.3%
Simplified37.4%
Taylor expanded in c0 around 0 44.1%
Final simplification54.4%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= w -0.043)
0.0
(if (<= w 1.7e-238)
(* (/ (/ c0 w) 2.0) (* 2.0 (* c0 (* (/ 1.0 (* w h)) (pow (/ d D) 2.0)))))
(if (<= w 7.5e-202)
0.0
(if (<= w 1e+99)
(* c0 (/ (* c0 (/ (* (/ d D) (/ d D)) (* w h))) w))
0.0)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (w <= -0.043) {
tmp = 0.0;
} else if (w <= 1.7e-238) {
tmp = ((c0 / w) / 2.0) * (2.0 * (c0 * ((1.0 / (w * h)) * pow((d / D), 2.0))));
} else if (w <= 7.5e-202) {
tmp = 0.0;
} else if (w <= 1e+99) {
tmp = c0 * ((c0 * (((d / D) * (d / D)) / (w * h))) / w);
} 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 <= (-0.043d0)) then
tmp = 0.0d0
else if (w <= 1.7d-238) then
tmp = ((c0 / w) / 2.0d0) * (2.0d0 * (c0 * ((1.0d0 / (w * h)) * ((d_1 / d) ** 2.0d0))))
else if (w <= 7.5d-202) then
tmp = 0.0d0
else if (w <= 1d+99) then
tmp = c0 * ((c0 * (((d_1 / d) * (d_1 / d)) / (w * h))) / w)
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 <= -0.043) {
tmp = 0.0;
} else if (w <= 1.7e-238) {
tmp = ((c0 / w) / 2.0) * (2.0 * (c0 * ((1.0 / (w * h)) * Math.pow((d / D), 2.0))));
} else if (w <= 7.5e-202) {
tmp = 0.0;
} else if (w <= 1e+99) {
tmp = c0 * ((c0 * (((d / D) * (d / D)) / (w * h))) / w);
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if w <= -0.043: tmp = 0.0 elif w <= 1.7e-238: tmp = ((c0 / w) / 2.0) * (2.0 * (c0 * ((1.0 / (w * h)) * math.pow((d / D), 2.0)))) elif w <= 7.5e-202: tmp = 0.0 elif w <= 1e+99: tmp = c0 * ((c0 * (((d / D) * (d / D)) / (w * h))) / w) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (w <= -0.043) tmp = 0.0; elseif (w <= 1.7e-238) tmp = Float64(Float64(Float64(c0 / w) / 2.0) * Float64(2.0 * Float64(c0 * Float64(Float64(1.0 / Float64(w * h)) * (Float64(d / D) ^ 2.0))))); elseif (w <= 7.5e-202) tmp = 0.0; elseif (w <= 1e+99) tmp = Float64(c0 * Float64(Float64(c0 * Float64(Float64(Float64(d / D) * Float64(d / D)) / Float64(w * h))) / w)); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (w <= -0.043) tmp = 0.0; elseif (w <= 1.7e-238) tmp = ((c0 / w) / 2.0) * (2.0 * (c0 * ((1.0 / (w * h)) * ((d / D) ^ 2.0)))); elseif (w <= 7.5e-202) tmp = 0.0; elseif (w <= 1e+99) tmp = c0 * ((c0 * (((d / D) * (d / D)) / (w * h))) / w); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[w, -0.043], 0.0, If[LessEqual[w, 1.7e-238], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(2.0 * N[(c0 * N[(N[(1.0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, 7.5e-202], 0.0, If[LessEqual[w, 1e+99], N[(c0 * N[(N[(c0 * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.043:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 1.7 \cdot 10^{-238}:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \left(2 \cdot \left(c0 \cdot \left(\frac{1}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;w \leq 7.5 \cdot 10^{-202}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 10^{+99}:\\
\;\;\;\;c0 \cdot \frac{c0 \cdot \frac{\frac{d}{D} \cdot \frac{d}{D}}{w \cdot h}}{w}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -0.042999999999999997 or 1.69999999999999992e-238 < w < 7.50000000000000005e-202 or 9.9999999999999997e98 < w Initial program 13.6%
Simplified11.5%
Taylor expanded in c0 around -inf 11.7%
mul-1-neg11.7%
distribute-lft-in11.7%
Simplified52.1%
Taylor expanded in c0 around 0 55.2%
if -0.042999999999999997 < w < 1.69999999999999992e-238Initial program 32.6%
Simplified43.0%
sqrt-prod42.6%
fma-udef42.6%
*-commutative42.6%
fma-udef42.6%
associate-/r*42.6%
pow242.6%
pow242.6%
Applied egg-rr42.6%
*-commutative42.6%
fma-udef42.6%
unsub-neg42.6%
*-commutative42.6%
*-commutative42.6%
associate-*r*43.6%
Simplified43.6%
Taylor expanded in c0 around inf 42.3%
associate-/r*42.4%
*-commutative42.4%
*-commutative42.4%
associate-/r*42.3%
associate-/l*42.4%
*-commutative42.4%
Simplified42.4%
associate-/r/42.4%
*-un-lft-identity42.4%
*-commutative42.4%
*-commutative42.4%
times-frac42.4%
unpow242.4%
unpow242.4%
frac-times53.8%
pow253.8%
Applied egg-rr53.8%
if 7.50000000000000005e-202 < w < 9.9999999999999997e98Initial program 27.4%
Simplified37.9%
sqrt-prod36.0%
fma-udef36.0%
*-commutative36.0%
fma-udef36.0%
associate-/r*36.0%
pow236.0%
pow236.0%
Applied egg-rr36.0%
*-commutative36.0%
fma-udef36.0%
unsub-neg36.0%
*-commutative36.0%
*-commutative36.0%
associate-*r*37.7%
Simplified37.7%
Taylor expanded in c0 around inf 36.7%
associate-/r*38.4%
*-commutative38.4%
*-commutative38.4%
associate-/r*36.7%
associate-/l*36.8%
*-commutative36.8%
Simplified36.8%
*-commutative36.8%
associate-/l/36.8%
clear-num36.8%
un-div-inv36.8%
Applied egg-rr45.8%
times-frac45.8%
metadata-eval45.8%
*-lft-identity45.8%
associate-/r/44.3%
associate-/r/44.3%
unpow244.3%
swap-sqr42.5%
unpow242.5%
rem-square-sqrt46.9%
associate-*r/48.6%
*-commutative48.6%
associate-*r/48.6%
*-commutative48.6%
Simplified48.6%
unpow248.6%
Applied egg-rr48.6%
Final simplification53.1%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= w -1.55e-5)
0.0
(if (or (<= w 1.6e-249) (and (not (<= w 7.2e-202)) (<= w 1.45e+99)))
(* c0 (/ (* c0 (/ (* (/ d D) (/ d D)) (* w h))) w))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (w <= -1.55e-5) {
tmp = 0.0;
} else if ((w <= 1.6e-249) || (!(w <= 7.2e-202) && (w <= 1.45e+99))) {
tmp = c0 * ((c0 * (((d / D) * (d / D)) / (w * h))) / w);
} 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 <= (-1.55d-5)) then
tmp = 0.0d0
else if ((w <= 1.6d-249) .or. (.not. (w <= 7.2d-202)) .and. (w <= 1.45d+99)) then
tmp = c0 * ((c0 * (((d_1 / d) * (d_1 / d)) / (w * h))) / w)
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 <= -1.55e-5) {
tmp = 0.0;
} else if ((w <= 1.6e-249) || (!(w <= 7.2e-202) && (w <= 1.45e+99))) {
tmp = c0 * ((c0 * (((d / D) * (d / D)) / (w * h))) / w);
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if w <= -1.55e-5: tmp = 0.0 elif (w <= 1.6e-249) or (not (w <= 7.2e-202) and (w <= 1.45e+99)): tmp = c0 * ((c0 * (((d / D) * (d / D)) / (w * h))) / w) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (w <= -1.55e-5) tmp = 0.0; elseif ((w <= 1.6e-249) || (!(w <= 7.2e-202) && (w <= 1.45e+99))) tmp = Float64(c0 * Float64(Float64(c0 * Float64(Float64(Float64(d / D) * Float64(d / D)) / Float64(w * h))) / w)); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (w <= -1.55e-5) tmp = 0.0; elseif ((w <= 1.6e-249) || (~((w <= 7.2e-202)) && (w <= 1.45e+99))) tmp = c0 * ((c0 * (((d / D) * (d / D)) / (w * h))) / w); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[w, -1.55e-5], 0.0, If[Or[LessEqual[w, 1.6e-249], And[N[Not[LessEqual[w, 7.2e-202]], $MachinePrecision], LessEqual[w, 1.45e+99]]], N[(c0 * N[(N[(c0 * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.55 \cdot 10^{-5}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 1.6 \cdot 10^{-249} \lor \neg \left(w \leq 7.2 \cdot 10^{-202}\right) \land w \leq 1.45 \cdot 10^{+99}:\\
\;\;\;\;c0 \cdot \frac{c0 \cdot \frac{\frac{d}{D} \cdot \frac{d}{D}}{w \cdot h}}{w}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -1.55000000000000007e-5 or 1.6000000000000001e-249 < w < 7.2000000000000003e-202 or 1.4500000000000001e99 < w Initial program 13.6%
Simplified11.5%
Taylor expanded in c0 around -inf 11.7%
mul-1-neg11.7%
distribute-lft-in11.7%
Simplified52.1%
Taylor expanded in c0 around 0 55.2%
if -1.55000000000000007e-5 < w < 1.6000000000000001e-249 or 7.2000000000000003e-202 < w < 1.4500000000000001e99Initial program 30.7%
Simplified41.1%
sqrt-prod40.2%
fma-udef40.2%
*-commutative40.2%
fma-udef40.2%
associate-/r*40.2%
pow240.2%
pow240.2%
Applied egg-rr40.2%
*-commutative40.2%
fma-udef40.2%
unsub-neg40.2%
*-commutative40.2%
*-commutative40.2%
associate-*r*41.4%
Simplified41.4%
Taylor expanded in c0 around inf 40.2%
associate-/r*40.9%
*-commutative40.9%
*-commutative40.9%
associate-/r*40.2%
associate-/l*40.3%
*-commutative40.3%
Simplified40.3%
*-commutative40.3%
associate-/l/40.3%
clear-num40.3%
un-div-inv40.3%
Applied egg-rr49.5%
times-frac49.5%
metadata-eval49.5%
*-lft-identity49.5%
associate-/r/47.8%
associate-/r/47.8%
unpow247.8%
swap-sqr47.1%
unpow247.1%
rem-square-sqrt50.6%
associate-*r/51.3%
*-commutative51.3%
associate-*r/51.9%
*-commutative51.9%
Simplified51.9%
unpow251.9%
Applied egg-rr51.9%
Final simplification53.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 24.1%
Simplified22.6%
Taylor expanded in c0 around -inf 5.5%
mul-1-neg5.5%
distribute-lft-in5.5%
Simplified30.2%
Taylor expanded in c0 around 0 34.9%
Final simplification34.9%
herbie shell --seed 2023322
(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))))))