
(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 11 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 (* c0 (* d d)))
(t_1 (pow (/ d D) 2.0))
(t_2 (/ c0 (* 2.0 w)))
(t_3 (/ t_0 (* (* w h) (* D D))))
(t_4 (* t_2 (+ t_3 (sqrt (- (* t_3 t_3) (* M M)))))))
(if (<= t_4 -4e+42)
(* t_2 (* 2.0 (/ (* c0 (pow d 2.0)) (* (* w h) (pow D 2.0)))))
(if (<= t_4 0.0)
(* 0.25 (/ (* D (* (* M M) (* h D))) (* d d)))
(if (<= t_4 INFINITY)
(*
t_2
(+
(* (/ c0 (* w h)) t_1)
(fma (/ (/ c0 w) h) t_1 (* 0.5 (/ w (/ t_0 (* h 0.0)))))))
(* 0.25 (* (/ (* D D) d) (/ (* h (* M M)) d))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 * (d * d);
double t_1 = pow((d / D), 2.0);
double t_2 = c0 / (2.0 * w);
double t_3 = t_0 / ((w * h) * (D * D));
double t_4 = t_2 * (t_3 + sqrt(((t_3 * t_3) - (M * M))));
double tmp;
if (t_4 <= -4e+42) {
tmp = t_2 * (2.0 * ((c0 * pow(d, 2.0)) / ((w * h) * pow(D, 2.0))));
} else if (t_4 <= 0.0) {
tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d));
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_2 * (((c0 / (w * h)) * t_1) + fma(((c0 / w) / h), t_1, (0.5 * (w / (t_0 / (h * 0.0))))));
} else {
tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d));
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(c0 * Float64(d * d)) t_1 = Float64(d / D) ^ 2.0 t_2 = Float64(c0 / Float64(2.0 * w)) t_3 = Float64(t_0 / Float64(Float64(w * h) * Float64(D * D))) t_4 = Float64(t_2 * Float64(t_3 + sqrt(Float64(Float64(t_3 * t_3) - Float64(M * M))))) tmp = 0.0 if (t_4 <= -4e+42) tmp = Float64(t_2 * Float64(2.0 * Float64(Float64(c0 * (d ^ 2.0)) / Float64(Float64(w * h) * (D ^ 2.0))))); elseif (t_4 <= 0.0) tmp = Float64(0.25 * Float64(Float64(D * Float64(Float64(M * M) * Float64(h * D))) / Float64(d * d))); elseif (t_4 <= Inf) tmp = Float64(t_2 * Float64(Float64(Float64(c0 / Float64(w * h)) * t_1) + fma(Float64(Float64(c0 / w) / h), t_1, Float64(0.5 * Float64(w / Float64(t_0 / Float64(h * 0.0))))))); else tmp = Float64(0.25 * Float64(Float64(Float64(D * D) / d) * Float64(Float64(h * Float64(M * M)) / d))); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 / N[(N[(w * h), $MachinePrecision] * N[(D * D), $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]}, If[LessEqual[t$95$4, -4e+42], N[(t$95$2 * N[(2.0 * N[(N[(c0 * N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[Power[D, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], N[(0.25 * N[(N[(D * N[(N[(M * M), $MachinePrecision] * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(t$95$2 * N[(N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] + N[(N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision] * t$95$1 + N[(0.5 * N[(w / N[(t$95$0 / N[(h * 0.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c0 \cdot \left(d \cdot d\right)\\
t_1 := {\left(\frac{d}{D}\right)}^{2}\\
t_2 := \frac{c0}{2 \cdot w}\\
t_3 := \frac{t_0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_4 := t_2 \cdot \left(t_3 + \sqrt{t_3 \cdot t_3 - M \cdot M}\right)\\
\mathbf{if}\;t_4 \leq -4 \cdot 10^{+42}:\\
\;\;\;\;t_2 \cdot \left(2 \cdot \frac{c0 \cdot {d}^{2}}{\left(w \cdot h\right) \cdot {D}^{2}}\right)\\
\mathbf{elif}\;t_4 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{D \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot D\right)\right)}{d \cdot d}\\
\mathbf{elif}\;t_4 \leq \infty:\\
\;\;\;\;t_2 \cdot \left(\frac{c0}{w \cdot h} \cdot t_1 + \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, t_1, 0.5 \cdot \frac{w}{\frac{t_0}{h \cdot 0}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\frac{D \cdot D}{d} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\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))))) < -4.00000000000000018e42Initial program 73.8%
times-frac68.8%
fma-def68.8%
associate-/r*68.8%
difference-of-squares68.8%
Simplified71.3%
Taylor expanded in c0 around inf 79.6%
if -4.00000000000000018e42 < (*.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 36.4%
Taylor expanded in c0 around -inf 67.3%
fma-def67.3%
times-frac59.3%
unpow259.3%
unpow259.3%
*-commutative59.3%
unpow259.3%
associate-*r*59.3%
Simplified59.3%
Taylor expanded in c0 around 0 67.8%
associate-/l*67.5%
associate-*r/67.5%
unpow267.5%
unpow267.5%
unpow267.5%
Simplified67.5%
Taylor expanded in D around 0 67.8%
*-commutative67.8%
unpow267.8%
*-commutative67.8%
unpow267.8%
unpow267.8%
Simplified67.8%
Taylor expanded in D around 0 67.8%
unpow267.8%
unpow267.8%
associate-*r*67.9%
unpow267.9%
associate-*r*67.9%
unpow267.9%
unpow267.9%
Simplified67.9%
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 85.4%
times-frac85.4%
fma-def85.4%
times-frac85.3%
difference-of-squares85.3%
Simplified85.3%
fma-udef85.3%
pow285.3%
associate-*l*85.3%
div-inv85.3%
clear-num85.3%
associate-*r/85.3%
*-commutative85.3%
Applied egg-rr88.2%
fma-udef88.2%
associate-*r/88.2%
associate-/l*88.2%
Applied egg-rr88.2%
Taylor expanded in D around 0 27.6%
+-commutative27.6%
times-frac27.6%
unpow227.6%
unpow227.6%
times-frac30.5%
unpow230.5%
*-commutative30.5%
fma-def30.5%
associate-/r*30.5%
Simplified91.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%
Taylor expanded in c0 around -inf 1.6%
fma-def1.6%
times-frac1.0%
unpow21.0%
unpow21.0%
*-commutative1.0%
unpow21.0%
associate-*r*1.0%
Simplified31.3%
Taylor expanded in c0 around 0 44.4%
associate-/l*44.2%
associate-*r/44.2%
unpow244.2%
unpow244.2%
unpow244.2%
Simplified44.2%
Taylor expanded in D around 0 44.4%
*-commutative44.4%
unpow244.4%
*-commutative44.4%
unpow244.4%
unpow244.4%
Simplified44.4%
times-frac49.8%
Applied egg-rr49.8%
Final simplification60.7%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w)))
(t_1 (* t_0 (* 2.0 (/ (* c0 (pow d 2.0)) (* (* w h) (pow D 2.0))))))
(t_2 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_3 (* t_0 (+ t_2 (sqrt (- (* t_2 t_2) (* M M)))))))
(if (<= t_3 -4e+42)
t_1
(if (<= t_3 0.0)
(* 0.25 (/ (* D (* (* M M) (* h D))) (* d d)))
(if (<= t_3 INFINITY)
t_1
(* 0.25 (* (/ (* D D) d) (/ (* h (* M M)) d))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = t_0 * (2.0 * ((c0 * pow(d, 2.0)) / ((w * h) * pow(D, 2.0))));
double t_2 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_3 = t_0 * (t_2 + sqrt(((t_2 * t_2) - (M * M))));
double tmp;
if (t_3 <= -4e+42) {
tmp = t_1;
} else if (t_3 <= 0.0) {
tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d));
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = t_0 * (2.0 * ((c0 * Math.pow(d, 2.0)) / ((w * h) * Math.pow(D, 2.0))));
double t_2 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_3 = t_0 * (t_2 + Math.sqrt(((t_2 * t_2) - (M * M))));
double tmp;
if (t_3 <= -4e+42) {
tmp = t_1;
} else if (t_3 <= 0.0) {
tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d));
} else if (t_3 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) t_1 = t_0 * (2.0 * ((c0 * math.pow(d, 2.0)) / ((w * h) * math.pow(D, 2.0)))) t_2 = (c0 * (d * d)) / ((w * h) * (D * D)) t_3 = t_0 * (t_2 + math.sqrt(((t_2 * t_2) - (M * M)))) tmp = 0 if t_3 <= -4e+42: tmp = t_1 elif t_3 <= 0.0: tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d)) elif t_3 <= math.inf: tmp = t_1 else: tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) t_1 = Float64(t_0 * Float64(2.0 * Float64(Float64(c0 * (d ^ 2.0)) / Float64(Float64(w * h) * (D ^ 2.0))))) t_2 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_3 = Float64(t_0 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))))) tmp = 0.0 if (t_3 <= -4e+42) tmp = t_1; elseif (t_3 <= 0.0) tmp = Float64(0.25 * Float64(Float64(D * Float64(Float64(M * M) * Float64(h * D))) / Float64(d * d))); elseif (t_3 <= Inf) tmp = t_1; else tmp = Float64(0.25 * Float64(Float64(Float64(D * D) / d) * Float64(Float64(h * Float64(M * M)) / d))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); t_1 = t_0 * (2.0 * ((c0 * (d ^ 2.0)) / ((w * h) * (D ^ 2.0)))); t_2 = (c0 * (d * d)) / ((w * h) * (D * D)); t_3 = t_0 * (t_2 + sqrt(((t_2 * t_2) - (M * M)))); tmp = 0.0; if (t_3 <= -4e+42) tmp = t_1; elseif (t_3 <= 0.0) tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d)); elseif (t_3 <= Inf) tmp = t_1; else tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d)); end tmp_2 = 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[(t$95$0 * N[(2.0 * N[(N[(c0 * N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[Power[D, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -4e+42], t$95$1, If[LessEqual[t$95$3, 0.0], N[(0.25 * N[(N[(D * N[(N[(M * M), $MachinePrecision] * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$1, N[(0.25 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := t_0 \cdot \left(2 \cdot \frac{c0 \cdot {d}^{2}}{\left(w \cdot h\right) \cdot {D}^{2}}\right)\\
t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_3 := t_0 \cdot \left(t_2 + \sqrt{t_2 \cdot t_2 - M \cdot M}\right)\\
\mathbf{if}\;t_3 \leq -4 \cdot 10^{+42}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_3 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{D \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot D\right)\right)}{d \cdot d}\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\frac{D \cdot D}{d} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\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))))) < -4.00000000000000018e42 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 79.0%
times-frac76.3%
fma-def76.3%
associate-/r*76.3%
difference-of-squares76.3%
Simplified79.0%
Taylor expanded in c0 around inf 83.6%
if -4.00000000000000018e42 < (*.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 36.4%
Taylor expanded in c0 around -inf 67.3%
fma-def67.3%
times-frac59.3%
unpow259.3%
unpow259.3%
*-commutative59.3%
unpow259.3%
associate-*r*59.3%
Simplified59.3%
Taylor expanded in c0 around 0 67.8%
associate-/l*67.5%
associate-*r/67.5%
unpow267.5%
unpow267.5%
unpow267.5%
Simplified67.5%
Taylor expanded in D around 0 67.8%
*-commutative67.8%
unpow267.8%
*-commutative67.8%
unpow267.8%
unpow267.8%
Simplified67.8%
Taylor expanded in D around 0 67.8%
unpow267.8%
unpow267.8%
associate-*r*67.9%
unpow267.9%
associate-*r*67.9%
unpow267.9%
unpow267.9%
Simplified67.9%
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%
Taylor expanded in c0 around -inf 1.6%
fma-def1.6%
times-frac1.0%
unpow21.0%
unpow21.0%
*-commutative1.0%
unpow21.0%
associate-*r*1.0%
Simplified31.3%
Taylor expanded in c0 around 0 44.4%
associate-/l*44.2%
associate-*r/44.2%
unpow244.2%
unpow244.2%
unpow244.2%
Simplified44.2%
Taylor expanded in D around 0 44.4%
*-commutative44.4%
unpow244.4%
*-commutative44.4%
unpow244.4%
unpow244.4%
Simplified44.4%
times-frac49.8%
Applied egg-rr49.8%
Final simplification60.3%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_1 (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
(if (<= t_1 INFINITY) t_1 (* 0.25 (* (/ (* D D) d) (/ (* h (* M M)) d))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d));
}
return tmp;
}
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));
double t_1 = (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) t_1 = (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M)))) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_1 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(0.25 * Float64(Float64(Float64(D * D) / d) * Float64(Float64(h * Float64(M * M)) / d))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d)); 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[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(0.25 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / d), $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)}\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\frac{D \cdot D}{d} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\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 73.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%
Taylor expanded in c0 around -inf 1.6%
fma-def1.6%
times-frac1.0%
unpow21.0%
unpow21.0%
*-commutative1.0%
unpow21.0%
associate-*r*1.0%
Simplified31.3%
Taylor expanded in c0 around 0 44.4%
associate-/l*44.2%
associate-*r/44.2%
unpow244.2%
unpow244.2%
unpow244.2%
Simplified44.2%
Taylor expanded in D around 0 44.4%
*-commutative44.4%
unpow244.4%
*-commutative44.4%
unpow244.4%
unpow244.4%
Simplified44.4%
times-frac49.8%
Applied egg-rr49.8%
Final simplification57.5%
(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 (* t_1 (* (/ c0 (* w h)) (pow (/ d D) 2.0)))))
(if (<= c0 -2.9e-107)
t_2
(if (<= c0 6.5e-84)
(/ (* (* D D) 0.25) (* (/ d h) (/ d (* M M))))
(if (<= c0 16.0)
t_2
(if (<= c0 4.9e+228)
(* 0.25 (/ (* D (* (* M M) (* h D))) (* d d)))
(* t_1 (+ t_0 (sqrt (* M (- t_0 M)))))))))))
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 = t_1 * ((c0 / (w * h)) * pow((d / D), 2.0));
double tmp;
if (c0 <= -2.9e-107) {
tmp = t_2;
} else if (c0 <= 6.5e-84) {
tmp = ((D * D) * 0.25) / ((d / h) * (d / (M * M)));
} else if (c0 <= 16.0) {
tmp = t_2;
} else if (c0 <= 4.9e+228) {
tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d));
} else {
tmp = t_1 * (t_0 + sqrt((M * (t_0 - M))));
}
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))) * (d_1 / (d / d_1))
t_1 = c0 / (2.0d0 * w)
t_2 = t_1 * ((c0 / (w * h)) * ((d_1 / d) ** 2.0d0))
if (c0 <= (-2.9d-107)) then
tmp = t_2
else if (c0 <= 6.5d-84) then
tmp = ((d * d) * 0.25d0) / ((d_1 / h) * (d_1 / (m * m)))
else if (c0 <= 16.0d0) then
tmp = t_2
else if (c0 <= 4.9d+228) then
tmp = 0.25d0 * ((d * ((m * m) * (h * d))) / (d_1 * d_1))
else
tmp = t_1 * (t_0 + sqrt((m * (t_0 - m))))
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 = t_1 * ((c0 / (w * h)) * Math.pow((d / D), 2.0));
double tmp;
if (c0 <= -2.9e-107) {
tmp = t_2;
} else if (c0 <= 6.5e-84) {
tmp = ((D * D) * 0.25) / ((d / h) * (d / (M * M)));
} else if (c0 <= 16.0) {
tmp = t_2;
} else if (c0 <= 4.9e+228) {
tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d));
} else {
tmp = t_1 * (t_0 + Math.sqrt((M * (t_0 - M))));
}
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 = t_1 * ((c0 / (w * h)) * math.pow((d / D), 2.0)) tmp = 0 if c0 <= -2.9e-107: tmp = t_2 elif c0 <= 6.5e-84: tmp = ((D * D) * 0.25) / ((d / h) * (d / (M * M))) elif c0 <= 16.0: tmp = t_2 elif c0 <= 4.9e+228: tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d)) else: tmp = t_1 * (t_0 + math.sqrt((M * (t_0 - M)))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 / Float64(w * Float64(h * D))) * Float64(d / Float64(D / d))) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(t_1 * Float64(Float64(c0 / Float64(w * h)) * (Float64(d / D) ^ 2.0))) tmp = 0.0 if (c0 <= -2.9e-107) tmp = t_2; elseif (c0 <= 6.5e-84) tmp = Float64(Float64(Float64(D * D) * 0.25) / Float64(Float64(d / h) * Float64(d / Float64(M * M)))); elseif (c0 <= 16.0) tmp = t_2; elseif (c0 <= 4.9e+228) tmp = Float64(0.25 * Float64(Float64(D * Float64(Float64(M * M) * Float64(h * D))) / Float64(d * d))); else tmp = Float64(t_1 * Float64(t_0 + sqrt(Float64(M * Float64(t_0 - M))))); 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 = t_1 * ((c0 / (w * h)) * ((d / D) ^ 2.0)); tmp = 0.0; if (c0 <= -2.9e-107) tmp = t_2; elseif (c0 <= 6.5e-84) tmp = ((D * D) * 0.25) / ((d / h) * (d / (M * M))); elseif (c0 <= 16.0) tmp = t_2; elseif (c0 <= 4.9e+228) tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d)); else tmp = t_1 * (t_0 + sqrt((M * (t_0 - M)))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / N[(w * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -2.9e-107], t$95$2, If[LessEqual[c0, 6.5e-84], N[(N[(N[(D * D), $MachinePrecision] * 0.25), $MachinePrecision] / N[(N[(d / h), $MachinePrecision] * N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 16.0], t$95$2, If[LessEqual[c0, 4.9e+228], N[(0.25 * N[(N[(D * N[(N[(M * M), $MachinePrecision] * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$0 + N[Sqrt[N[(M * N[(t$95$0 - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot \left(h \cdot D\right)} \cdot \frac{d}{\frac{D}{d}}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := t_1 \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\\
\mathbf{if}\;c0 \leq -2.9 \cdot 10^{-107}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c0 \leq 6.5 \cdot 10^{-84}:\\
\;\;\;\;\frac{\left(D \cdot D\right) \cdot 0.25}{\frac{d}{h} \cdot \frac{d}{M \cdot M}}\\
\mathbf{elif}\;c0 \leq 16:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c0 \leq 4.9 \cdot 10^{+228}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot D\right)\right)}{d \cdot d}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(t_0 + \sqrt{M \cdot \left(t_0 - M\right)}\right)\\
\end{array}
\end{array}
if c0 < -2.8999999999999998e-107 or 6.50000000000000022e-84 < c0 < 16Initial program 30.1%
times-frac29.3%
fma-def29.3%
associate-/r*29.3%
difference-of-squares33.0%
Simplified42.5%
Taylor expanded in c0 around 0 17.3%
div-inv17.3%
Applied egg-rr17.3%
Taylor expanded in c0 around inf 31.4%
times-frac32.6%
unpow232.6%
unpow232.6%
times-frac43.4%
unpow243.4%
*-commutative43.4%
*-commutative43.4%
Simplified43.4%
if -2.8999999999999998e-107 < c0 < 6.50000000000000022e-84Initial program 16.2%
Taylor expanded in c0 around -inf 6.0%
fma-def6.0%
times-frac4.8%
unpow24.8%
unpow24.8%
*-commutative4.8%
unpow24.8%
associate-*r*4.8%
Simplified35.8%
Taylor expanded in c0 around 0 43.0%
associate-/l*43.0%
associate-*r/43.0%
unpow243.0%
unpow243.0%
unpow243.0%
Simplified43.0%
Taylor expanded in d around 0 43.0%
unpow243.0%
times-frac50.4%
unpow250.4%
Simplified50.4%
if 16 < c0 < 4.9000000000000002e228Initial program 16.2%
Taylor expanded in c0 around -inf 9.4%
fma-def9.4%
times-frac9.2%
unpow29.2%
unpow29.2%
*-commutative9.2%
unpow29.2%
associate-*r*9.2%
Simplified29.8%
Taylor expanded in c0 around 0 44.6%
associate-/l*46.0%
associate-*r/46.0%
unpow246.0%
unpow246.0%
unpow246.0%
Simplified46.0%
Taylor expanded in D around 0 44.6%
*-commutative44.6%
unpow244.6%
*-commutative44.6%
unpow244.6%
unpow244.6%
Simplified44.6%
Taylor expanded in D around 0 44.6%
unpow244.6%
unpow244.6%
associate-*r*54.2%
unpow254.2%
associate-*r*54.0%
unpow254.0%
unpow254.0%
Simplified54.0%
if 4.9000000000000002e228 < c0 Initial program 42.9%
times-frac42.9%
fma-def42.9%
associate-/r*42.9%
difference-of-squares52.4%
Simplified52.9%
Taylor expanded in c0 around 0 33.9%
div-inv33.9%
Applied egg-rr33.9%
fma-udef33.9%
div-inv33.9%
frac-times33.9%
associate-/l*33.9%
associate-*r*33.9%
associate-*l/33.9%
frac-times33.7%
frac-times33.7%
associate-/l*38.4%
associate-*r*38.4%
associate-*l/38.4%
frac-times38.4%
Applied egg-rr38.4%
times-frac38.4%
*-commutative38.4%
times-frac38.6%
*-commutative38.6%
Simplified38.6%
Final simplification47.1%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* (/ c0 (* 2.0 w)) (* (/ c0 (* w h)) (pow (/ d D) 2.0)))))
(if (<= c0 -1.55e-106)
t_0
(if (<= c0 1.9e-82)
(/ (* (* D D) 0.25) (* (/ d h) (/ d (* M M))))
(if (or (<= c0 18000.0) (not (<= c0 2.6e+228)))
t_0
(* 0.25 (/ (* D (* (* M M) (* h D))) (* d d))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / (2.0 * w)) * ((c0 / (w * h)) * pow((d / D), 2.0));
double tmp;
if (c0 <= -1.55e-106) {
tmp = t_0;
} else if (c0 <= 1.9e-82) {
tmp = ((D * D) * 0.25) / ((d / h) * (d / (M * M)));
} else if ((c0 <= 18000.0) || !(c0 <= 2.6e+228)) {
tmp = t_0;
} else {
tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d));
}
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) :: tmp
t_0 = (c0 / (2.0d0 * w)) * ((c0 / (w * h)) * ((d_1 / d) ** 2.0d0))
if (c0 <= (-1.55d-106)) then
tmp = t_0
else if (c0 <= 1.9d-82) then
tmp = ((d * d) * 0.25d0) / ((d_1 / h) * (d_1 / (m * m)))
else if ((c0 <= 18000.0d0) .or. (.not. (c0 <= 2.6d+228))) then
tmp = t_0
else
tmp = 0.25d0 * ((d * ((m * m) * (h * d))) / (d_1 * d_1))
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 / (2.0 * w)) * ((c0 / (w * h)) * Math.pow((d / D), 2.0));
double tmp;
if (c0 <= -1.55e-106) {
tmp = t_0;
} else if (c0 <= 1.9e-82) {
tmp = ((D * D) * 0.25) / ((d / h) * (d / (M * M)));
} else if ((c0 <= 18000.0) || !(c0 <= 2.6e+228)) {
tmp = t_0;
} else {
tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 / (2.0 * w)) * ((c0 / (w * h)) * math.pow((d / D), 2.0)) tmp = 0 if c0 <= -1.55e-106: tmp = t_0 elif c0 <= 1.9e-82: tmp = ((D * D) * 0.25) / ((d / h) * (d / (M * M))) elif (c0 <= 18000.0) or not (c0 <= 2.6e+228): tmp = t_0 else: tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(c0 / Float64(w * h)) * (Float64(d / D) ^ 2.0))) tmp = 0.0 if (c0 <= -1.55e-106) tmp = t_0; elseif (c0 <= 1.9e-82) tmp = Float64(Float64(Float64(D * D) * 0.25) / Float64(Float64(d / h) * Float64(d / Float64(M * M)))); elseif ((c0 <= 18000.0) || !(c0 <= 2.6e+228)) tmp = t_0; else tmp = Float64(0.25 * Float64(Float64(D * Float64(Float64(M * M) * Float64(h * D))) / Float64(d * d))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 / (2.0 * w)) * ((c0 / (w * h)) * ((d / D) ^ 2.0)); tmp = 0.0; if (c0 <= -1.55e-106) tmp = t_0; elseif (c0 <= 1.9e-82) tmp = ((D * D) * 0.25) / ((d / h) * (d / (M * M))); elseif ((c0 <= 18000.0) || ~((c0 <= 2.6e+228))) tmp = t_0; else tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -1.55e-106], t$95$0, If[LessEqual[c0, 1.9e-82], N[(N[(N[(D * D), $MachinePrecision] * 0.25), $MachinePrecision] / N[(N[(d / h), $MachinePrecision] * N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[c0, 18000.0], N[Not[LessEqual[c0, 2.6e+228]], $MachinePrecision]], t$95$0, N[(0.25 * N[(N[(D * N[(N[(M * M), $MachinePrecision] * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\\
\mathbf{if}\;c0 \leq -1.55 \cdot 10^{-106}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c0 \leq 1.9 \cdot 10^{-82}:\\
\;\;\;\;\frac{\left(D \cdot D\right) \cdot 0.25}{\frac{d}{h} \cdot \frac{d}{M \cdot M}}\\
\mathbf{elif}\;c0 \leq 18000 \lor \neg \left(c0 \leq 2.6 \cdot 10^{+228}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot D\right)\right)}{d \cdot d}\\
\end{array}
\end{array}
if c0 < -1.54999999999999993e-106 or 1.9000000000000001e-82 < c0 < 18000 or 2.60000000000000007e228 < c0 Initial program 32.2%
times-frac31.5%
fma-def31.5%
associate-/r*31.5%
difference-of-squares36.2%
Simplified44.2%
Taylor expanded in c0 around 0 20.0%
div-inv20.0%
Applied egg-rr20.0%
Taylor expanded in c0 around inf 35.0%
times-frac36.0%
unpow236.0%
unpow236.0%
times-frac46.7%
unpow246.7%
*-commutative46.7%
*-commutative46.7%
Simplified46.7%
if -1.54999999999999993e-106 < c0 < 1.9000000000000001e-82Initial program 16.2%
Taylor expanded in c0 around -inf 6.0%
fma-def6.0%
times-frac4.8%
unpow24.8%
unpow24.8%
*-commutative4.8%
unpow24.8%
associate-*r*4.8%
Simplified35.8%
Taylor expanded in c0 around 0 43.0%
associate-/l*43.0%
associate-*r/43.0%
unpow243.0%
unpow243.0%
unpow243.0%
Simplified43.0%
Taylor expanded in d around 0 43.0%
unpow243.0%
times-frac50.4%
unpow250.4%
Simplified50.4%
if 18000 < c0 < 2.60000000000000007e228Initial program 16.2%
Taylor expanded in c0 around -inf 9.4%
fma-def9.4%
times-frac9.2%
unpow29.2%
unpow29.2%
*-commutative9.2%
unpow29.2%
associate-*r*9.2%
Simplified29.8%
Taylor expanded in c0 around 0 44.6%
associate-/l*46.0%
associate-*r/46.0%
unpow246.0%
unpow246.0%
unpow246.0%
Simplified46.0%
Taylor expanded in D around 0 44.6%
*-commutative44.6%
unpow244.6%
*-commutative44.6%
unpow244.6%
unpow244.6%
Simplified44.6%
Taylor expanded in D around 0 44.6%
unpow244.6%
unpow244.6%
associate-*r*54.2%
unpow254.2%
associate-*r*54.0%
unpow254.0%
unpow254.0%
Simplified54.0%
Final simplification49.2%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* h (* M M))) (t_1 (/ (* D D) d)))
(if (<= (* d d) 4e-164)
(* 0.25 (* t_1 (/ t_0 d)))
(if (<= (* d d) 2e-126)
(/ (* (* d d) (* c0 c0)) (* (* D D) (* h (* w w))))
(if (<= (* d d) 5e-54)
(* t_0 (* t_1 (/ 0.25 d)))
(if (<= (* d d) 5e+307)
(* 0.25 (* (* D (* D t_0)) (/ 1.0 (* d d))))
0.0))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = h * (M * M);
double t_1 = (D * D) / d;
double tmp;
if ((d * d) <= 4e-164) {
tmp = 0.25 * (t_1 * (t_0 / d));
} else if ((d * d) <= 2e-126) {
tmp = ((d * d) * (c0 * c0)) / ((D * D) * (h * (w * w)));
} else if ((d * d) <= 5e-54) {
tmp = t_0 * (t_1 * (0.25 / d));
} else if ((d * d) <= 5e+307) {
tmp = 0.25 * ((D * (D * t_0)) * (1.0 / (d * d)));
} 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) :: tmp
t_0 = h * (m * m)
t_1 = (d * d) / d_1
if ((d_1 * d_1) <= 4d-164) then
tmp = 0.25d0 * (t_1 * (t_0 / d_1))
else if ((d_1 * d_1) <= 2d-126) then
tmp = ((d_1 * d_1) * (c0 * c0)) / ((d * d) * (h * (w * w)))
else if ((d_1 * d_1) <= 5d-54) then
tmp = t_0 * (t_1 * (0.25d0 / d_1))
else if ((d_1 * d_1) <= 5d+307) then
tmp = 0.25d0 * ((d * (d * t_0)) * (1.0d0 / (d_1 * d_1)))
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 = h * (M * M);
double t_1 = (D * D) / d;
double tmp;
if ((d * d) <= 4e-164) {
tmp = 0.25 * (t_1 * (t_0 / d));
} else if ((d * d) <= 2e-126) {
tmp = ((d * d) * (c0 * c0)) / ((D * D) * (h * (w * w)));
} else if ((d * d) <= 5e-54) {
tmp = t_0 * (t_1 * (0.25 / d));
} else if ((d * d) <= 5e+307) {
tmp = 0.25 * ((D * (D * t_0)) * (1.0 / (d * d)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = h * (M * M) t_1 = (D * D) / d tmp = 0 if (d * d) <= 4e-164: tmp = 0.25 * (t_1 * (t_0 / d)) elif (d * d) <= 2e-126: tmp = ((d * d) * (c0 * c0)) / ((D * D) * (h * (w * w))) elif (d * d) <= 5e-54: tmp = t_0 * (t_1 * (0.25 / d)) elif (d * d) <= 5e+307: tmp = 0.25 * ((D * (D * t_0)) * (1.0 / (d * d))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(h * Float64(M * M)) t_1 = Float64(Float64(D * D) / d) tmp = 0.0 if (Float64(d * d) <= 4e-164) tmp = Float64(0.25 * Float64(t_1 * Float64(t_0 / d))); elseif (Float64(d * d) <= 2e-126) tmp = Float64(Float64(Float64(d * d) * Float64(c0 * c0)) / Float64(Float64(D * D) * Float64(h * Float64(w * w)))); elseif (Float64(d * d) <= 5e-54) tmp = Float64(t_0 * Float64(t_1 * Float64(0.25 / d))); elseif (Float64(d * d) <= 5e+307) tmp = Float64(0.25 * Float64(Float64(D * Float64(D * t_0)) * Float64(1.0 / Float64(d * d)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = h * (M * M); t_1 = (D * D) / d; tmp = 0.0; if ((d * d) <= 4e-164) tmp = 0.25 * (t_1 * (t_0 / d)); elseif ((d * d) <= 2e-126) tmp = ((d * d) * (c0 * c0)) / ((D * D) * (h * (w * w))); elseif ((d * d) <= 5e-54) tmp = t_0 * (t_1 * (0.25 / d)); elseif ((d * d) <= 5e+307) tmp = 0.25 * ((D * (D * t_0)) * (1.0 / (d * d))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[N[(d * d), $MachinePrecision], 4e-164], N[(0.25 * N[(t$95$1 * N[(t$95$0 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(d * d), $MachinePrecision], 2e-126], N[(N[(N[(d * d), $MachinePrecision] * N[(c0 * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(d * d), $MachinePrecision], 5e-54], N[(t$95$0 * N[(t$95$1 * N[(0.25 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(d * d), $MachinePrecision], 5e+307], N[(0.25 * N[(N[(D * N[(D * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := h \cdot \left(M \cdot M\right)\\
t_1 := \frac{D \cdot D}{d}\\
\mathbf{if}\;d \cdot d \leq 4 \cdot 10^{-164}:\\
\;\;\;\;0.25 \cdot \left(t_1 \cdot \frac{t_0}{d}\right)\\
\mathbf{elif}\;d \cdot d \leq 2 \cdot 10^{-126}:\\
\;\;\;\;\frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\\
\mathbf{elif}\;d \cdot d \leq 5 \cdot 10^{-54}:\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot \frac{0.25}{d}\right)\\
\mathbf{elif}\;d \cdot d \leq 5 \cdot 10^{+307}:\\
\;\;\;\;0.25 \cdot \left(\left(D \cdot \left(D \cdot t_0\right)\right) \cdot \frac{1}{d \cdot d}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if (*.f64 d d) < 3.99999999999999985e-164Initial program 8.9%
Taylor expanded in c0 around -inf 6.4%
fma-def6.4%
times-frac6.3%
unpow26.3%
unpow26.3%
*-commutative6.3%
unpow26.3%
associate-*r*6.3%
Simplified23.6%
Taylor expanded in c0 around 0 31.2%
associate-/l*32.5%
associate-*r/32.5%
unpow232.5%
unpow232.5%
unpow232.5%
Simplified32.5%
Taylor expanded in D around 0 31.2%
*-commutative31.2%
unpow231.2%
*-commutative31.2%
unpow231.2%
unpow231.2%
Simplified31.2%
times-frac45.5%
Applied egg-rr45.5%
if 3.99999999999999985e-164 < (*.f64 d d) < 1.9999999999999999e-126Initial program 83.3%
times-frac66.7%
fma-def66.7%
associate-/r*66.7%
difference-of-squares83.3%
Simplified83.3%
Taylor expanded in c0 around inf 99.7%
unpow299.7%
unpow299.7%
unpow299.7%
*-commutative99.7%
unpow299.7%
Simplified99.7%
if 1.9999999999999999e-126 < (*.f64 d d) < 5.00000000000000015e-54Initial program 15.4%
Taylor expanded in c0 around -inf 16.0%
fma-def16.0%
times-frac1.2%
unpow21.2%
unpow21.2%
*-commutative1.2%
unpow21.2%
associate-*r*1.2%
Simplified58.3%
Taylor expanded in c0 around 0 73.1%
associate-/l*73.1%
associate-*r/73.1%
unpow273.1%
unpow273.1%
unpow273.1%
Simplified73.1%
Taylor expanded in D around 0 73.1%
associate-/l*73.1%
unpow273.1%
unpow273.1%
associate-*r/73.1%
unpow273.1%
unpow273.1%
associate-/r/73.7%
unpow273.7%
*-commutative73.7%
unpow273.7%
times-frac73.7%
unpow273.7%
Simplified73.7%
if 5.00000000000000015e-54 < (*.f64 d d) < 5e307Initial program 28.0%
Taylor expanded in c0 around -inf 9.8%
fma-def9.8%
times-frac8.7%
unpow28.7%
unpow28.7%
*-commutative8.7%
unpow28.7%
associate-*r*8.7%
Simplified29.2%
Taylor expanded in c0 around 0 41.1%
associate-/l*40.0%
associate-*r/40.0%
unpow240.0%
unpow240.0%
unpow240.0%
Simplified40.0%
Taylor expanded in D around 0 41.1%
*-commutative41.1%
unpow241.1%
*-commutative41.1%
unpow241.1%
unpow241.1%
Simplified41.1%
div-inv41.1%
associate-*l*48.2%
Applied egg-rr48.2%
if 5e307 < (*.f64 d d) Initial program 25.2%
times-frac25.2%
fma-def25.2%
associate-/r*25.2%
difference-of-squares33.1%
Simplified36.3%
Taylor expanded in c0 around -inf 0.0%
associate-*r*0.0%
distribute-rgt1-in0.0%
metadata-eval0.0%
mul0-lft36.9%
metadata-eval36.9%
mul0-lft0.0%
metadata-eval0.0%
distribute-lft1-in0.0%
*-commutative0.0%
distribute-lft1-in0.0%
metadata-eval0.0%
mul0-lft36.9%
Simplified36.9%
Taylor expanded in c0 around 0 39.9%
Final simplification46.2%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= M 2e-161)
0.0
(if (<= M 1.9e+51)
(* (* h (* M M)) (* (/ (* D D) d) (/ 0.25 d)))
(if (or (<= M 1.25e+76) (not (<= M 9.6e+138)))
(* (/ c0 (* 2.0 w)) (* 2.0 (* (/ c0 (* w h)) (/ (* d d) (* D D)))))
(* 0.25 (/ (* D (* (* M M) (* h D))) (* d d)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (M <= 2e-161) {
tmp = 0.0;
} else if (M <= 1.9e+51) {
tmp = (h * (M * M)) * (((D * D) / d) * (0.25 / d));
} else if ((M <= 1.25e+76) || !(M <= 9.6e+138)) {
tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / (w * h)) * ((d * d) / (D * D))));
} else {
tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d));
}
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 (m <= 2d-161) then
tmp = 0.0d0
else if (m <= 1.9d+51) then
tmp = (h * (m * m)) * (((d * d) / d_1) * (0.25d0 / d_1))
else if ((m <= 1.25d+76) .or. (.not. (m <= 9.6d+138))) then
tmp = (c0 / (2.0d0 * w)) * (2.0d0 * ((c0 / (w * h)) * ((d_1 * d_1) / (d * d))))
else
tmp = 0.25d0 * ((d * ((m * m) * (h * d))) / (d_1 * d_1))
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 (M <= 2e-161) {
tmp = 0.0;
} else if (M <= 1.9e+51) {
tmp = (h * (M * M)) * (((D * D) / d) * (0.25 / d));
} else if ((M <= 1.25e+76) || !(M <= 9.6e+138)) {
tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / (w * h)) * ((d * d) / (D * D))));
} else {
tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if M <= 2e-161: tmp = 0.0 elif M <= 1.9e+51: tmp = (h * (M * M)) * (((D * D) / d) * (0.25 / d)) elif (M <= 1.25e+76) or not (M <= 9.6e+138): tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / (w * h)) * ((d * d) / (D * D)))) else: tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (M <= 2e-161) tmp = 0.0; elseif (M <= 1.9e+51) tmp = Float64(Float64(h * Float64(M * M)) * Float64(Float64(Float64(D * D) / d) * Float64(0.25 / d))); elseif ((M <= 1.25e+76) || !(M <= 9.6e+138)) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(Float64(c0 / Float64(w * h)) * Float64(Float64(d * d) / Float64(D * D))))); else tmp = Float64(0.25 * Float64(Float64(D * Float64(Float64(M * M) * Float64(h * D))) / Float64(d * d))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (M <= 2e-161) tmp = 0.0; elseif (M <= 1.9e+51) tmp = (h * (M * M)) * (((D * D) / d) * (0.25 / d)); elseif ((M <= 1.25e+76) || ~((M <= 9.6e+138))) tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / (w * h)) * ((d * d) / (D * D)))); else tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 2e-161], 0.0, If[LessEqual[M, 1.9e+51], N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * N[(0.25 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[M, 1.25e+76], N[Not[LessEqual[M, 9.6e+138]], $MachinePrecision]], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(D * N[(N[(M * M), $MachinePrecision] * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2 \cdot 10^{-161}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \leq 1.9 \cdot 10^{+51}:\\
\;\;\;\;\left(h \cdot \left(M \cdot M\right)\right) \cdot \left(\frac{D \cdot D}{d} \cdot \frac{0.25}{d}\right)\\
\mathbf{elif}\;M \leq 1.25 \cdot 10^{+76} \lor \neg \left(M \leq 9.6 \cdot 10^{+138}\right):\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot D\right)\right)}{d \cdot d}\\
\end{array}
\end{array}
if M < 2.00000000000000006e-161Initial program 26.1%
times-frac24.4%
fma-def24.4%
associate-/r*24.5%
difference-of-squares28.5%
Simplified33.9%
Taylor expanded in c0 around -inf 3.2%
associate-*r*3.2%
distribute-rgt1-in3.2%
metadata-eval3.2%
mul0-lft31.9%
metadata-eval31.9%
mul0-lft4.4%
metadata-eval4.4%
distribute-lft1-in4.4%
*-commutative4.4%
distribute-lft1-in4.4%
metadata-eval4.4%
mul0-lft31.9%
Simplified31.9%
Taylor expanded in c0 around 0 36.6%
if 2.00000000000000006e-161 < M < 1.8999999999999999e51Initial program 25.5%
Taylor expanded in c0 around -inf 8.2%
fma-def8.2%
times-frac8.1%
unpow28.1%
unpow28.1%
*-commutative8.1%
unpow28.1%
associate-*r*8.1%
Simplified31.7%
Taylor expanded in c0 around 0 45.6%
associate-/l*43.5%
associate-*r/43.5%
unpow243.5%
unpow243.5%
unpow243.5%
Simplified43.5%
Taylor expanded in D around 0 45.6%
associate-/l*43.5%
unpow243.5%
unpow243.5%
associate-*r/43.5%
unpow243.5%
unpow243.5%
associate-/r/45.7%
unpow245.7%
*-commutative45.7%
unpow245.7%
times-frac52.4%
unpow252.4%
Simplified52.4%
if 1.8999999999999999e51 < M < 1.24999999999999998e76 or 9.6000000000000003e138 < M Initial program 16.4%
times-frac16.4%
fma-def16.4%
associate-/r*16.4%
difference-of-squares36.9%
Simplified41.8%
Taylor expanded in c0 around inf 41.6%
times-frac41.9%
unpow241.9%
unpow241.9%
Simplified41.9%
if 1.24999999999999998e76 < M < 9.6000000000000003e138Initial program 8.9%
Taylor expanded in c0 around -inf 0.0%
fma-def0.0%
times-frac0.0%
unpow20.0%
unpow20.0%
*-commutative0.0%
unpow20.0%
associate-*r*0.0%
Simplified17.1%
Taylor expanded in c0 around 0 42.3%
associate-/l*42.3%
associate-*r/42.3%
unpow242.3%
unpow242.3%
unpow242.3%
Simplified42.3%
Taylor expanded in D around 0 42.3%
*-commutative42.3%
unpow242.3%
*-commutative42.3%
unpow242.3%
unpow242.3%
Simplified42.3%
Taylor expanded in D around 0 42.3%
unpow242.3%
unpow242.3%
associate-*r*43.3%
unpow243.3%
associate-*r*59.1%
unpow259.1%
unpow259.1%
Simplified59.1%
Final simplification40.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* h (* M M))))
(if (<= (* d d) 5e-50)
(* 0.25 (* (/ (* D D) d) (/ t_0 d)))
(if (<= (* d d) 5e+307)
(* 0.25 (* (* D (* D t_0)) (/ 1.0 (* d d))))
0.0))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = h * (M * M);
double tmp;
if ((d * d) <= 5e-50) {
tmp = 0.25 * (((D * D) / d) * (t_0 / d));
} else if ((d * d) <= 5e+307) {
tmp = 0.25 * ((D * (D * t_0)) * (1.0 / (d * d)));
} 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) :: tmp
t_0 = h * (m * m)
if ((d_1 * d_1) <= 5d-50) then
tmp = 0.25d0 * (((d * d) / d_1) * (t_0 / d_1))
else if ((d_1 * d_1) <= 5d+307) then
tmp = 0.25d0 * ((d * (d * t_0)) * (1.0d0 / (d_1 * d_1)))
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 = h * (M * M);
double tmp;
if ((d * d) <= 5e-50) {
tmp = 0.25 * (((D * D) / d) * (t_0 / d));
} else if ((d * d) <= 5e+307) {
tmp = 0.25 * ((D * (D * t_0)) * (1.0 / (d * d)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = h * (M * M) tmp = 0 if (d * d) <= 5e-50: tmp = 0.25 * (((D * D) / d) * (t_0 / d)) elif (d * d) <= 5e+307: tmp = 0.25 * ((D * (D * t_0)) * (1.0 / (d * d))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(h * Float64(M * M)) tmp = 0.0 if (Float64(d * d) <= 5e-50) tmp = Float64(0.25 * Float64(Float64(Float64(D * D) / d) * Float64(t_0 / d))); elseif (Float64(d * d) <= 5e+307) tmp = Float64(0.25 * Float64(Float64(D * Float64(D * t_0)) * Float64(1.0 / Float64(d * d)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = h * (M * M); tmp = 0.0; if ((d * d) <= 5e-50) tmp = 0.25 * (((D * D) / d) * (t_0 / d)); elseif ((d * d) <= 5e+307) tmp = 0.25 * ((D * (D * t_0)) * (1.0 / (d * d))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(d * d), $MachinePrecision], 5e-50], N[(0.25 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * N[(t$95$0 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(d * d), $MachinePrecision], 5e+307], N[(0.25 * N[(N[(D * N[(D * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := h \cdot \left(M \cdot M\right)\\
\mathbf{if}\;d \cdot d \leq 5 \cdot 10^{-50}:\\
\;\;\;\;0.25 \cdot \left(\frac{D \cdot D}{d} \cdot \frac{t_0}{d}\right)\\
\mathbf{elif}\;d \cdot d \leq 5 \cdot 10^{+307}:\\
\;\;\;\;0.25 \cdot \left(\left(D \cdot \left(D \cdot t_0\right)\right) \cdot \frac{1}{d \cdot d}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if (*.f64 d d) < 4.99999999999999968e-50Initial program 16.5%
Taylor expanded in c0 around -inf 8.4%
fma-def8.4%
times-frac6.7%
unpow26.7%
unpow26.7%
*-commutative6.7%
unpow26.7%
associate-*r*6.7%
Simplified27.8%
Taylor expanded in c0 around 0 36.7%
associate-/l*37.7%
associate-*r/37.7%
unpow237.7%
unpow237.7%
unpow237.7%
Simplified37.7%
Taylor expanded in D around 0 36.7%
*-commutative36.7%
unpow236.7%
*-commutative36.7%
unpow236.7%
unpow236.7%
Simplified36.7%
times-frac47.7%
Applied egg-rr47.7%
if 4.99999999999999968e-50 < (*.f64 d d) < 5e307Initial program 28.6%
Taylor expanded in c0 around -inf 8.8%
fma-def8.8%
times-frac7.7%
unpow27.7%
unpow27.7%
*-commutative7.7%
unpow27.7%
associate-*r*7.7%
Simplified28.6%
Taylor expanded in c0 around 0 39.8%
associate-/l*38.6%
associate-*r/38.6%
unpow238.6%
unpow238.6%
unpow238.6%
Simplified38.6%
Taylor expanded in D around 0 39.8%
*-commutative39.8%
unpow239.8%
*-commutative39.8%
unpow239.8%
unpow239.8%
Simplified39.8%
div-inv39.8%
associate-*l*47.1%
Applied egg-rr47.1%
if 5e307 < (*.f64 d d) Initial program 25.2%
times-frac25.2%
fma-def25.2%
associate-/r*25.2%
difference-of-squares33.1%
Simplified36.3%
Taylor expanded in c0 around -inf 0.0%
associate-*r*0.0%
distribute-rgt1-in0.0%
metadata-eval0.0%
mul0-lft36.9%
metadata-eval36.9%
mul0-lft0.0%
metadata-eval0.0%
distribute-lft1-in0.0%
*-commutative0.0%
distribute-lft1-in0.0%
metadata-eval0.0%
mul0-lft36.9%
Simplified36.9%
Taylor expanded in c0 around 0 39.9%
Final simplification44.3%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= (* d d) 2e-98)
(* 0.25 (* (/ (* D D) d) (/ (* h (* M M)) d)))
(if (<= (* d d) 5e+307)
(* 0.25 (/ (* D (* (* M M) (* h D))) (* d d)))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((d * d) <= 2e-98) {
tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d));
} else if ((d * d) <= 5e+307) {
tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d));
} 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 ((d_1 * d_1) <= 2d-98) then
tmp = 0.25d0 * (((d * d) / d_1) * ((h * (m * m)) / d_1))
else if ((d_1 * d_1) <= 5d+307) then
tmp = 0.25d0 * ((d * ((m * m) * (h * d))) / (d_1 * d_1))
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 ((d * d) <= 2e-98) {
tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d));
} else if ((d * d) <= 5e+307) {
tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (d * d) <= 2e-98: tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d)) elif (d * d) <= 5e+307: tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d)) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (Float64(d * d) <= 2e-98) tmp = Float64(0.25 * Float64(Float64(Float64(D * D) / d) * Float64(Float64(h * Float64(M * M)) / d))); elseif (Float64(d * d) <= 5e+307) tmp = Float64(0.25 * Float64(Float64(D * Float64(Float64(M * M) * Float64(h * D))) / Float64(d * d))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((d * d) <= 2e-98) tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d)); elseif ((d * d) <= 5e+307) tmp = 0.25 * ((D * ((M * M) * (h * D))) / (d * d)); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[N[(d * d), $MachinePrecision], 2e-98], N[(0.25 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(d * d), $MachinePrecision], 5e+307], N[(0.25 * N[(N[(D * N[(N[(M * M), $MachinePrecision] * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \cdot d \leq 2 \cdot 10^{-98}:\\
\;\;\;\;0.25 \cdot \left(\frac{D \cdot D}{d} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\right)\\
\mathbf{elif}\;d \cdot d \leq 5 \cdot 10^{+307}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot D\right)\right)}{d \cdot d}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if (*.f64 d d) < 1.99999999999999988e-98Initial program 16.7%
Taylor expanded in c0 around -inf 7.4%
fma-def7.4%
times-frac5.6%
unpow25.6%
unpow25.6%
*-commutative5.6%
unpow25.6%
associate-*r*5.6%
Simplified22.2%
Taylor expanded in c0 around 0 30.6%
associate-/l*31.7%
associate-*r/31.7%
unpow231.7%
unpow231.7%
unpow231.7%
Simplified31.7%
Taylor expanded in D around 0 30.6%
*-commutative30.6%
unpow230.6%
*-commutative30.6%
unpow230.6%
unpow230.6%
Simplified30.6%
times-frac42.9%
Applied egg-rr42.9%
if 1.99999999999999988e-98 < (*.f64 d d) < 5e307Initial program 27.6%
Taylor expanded in c0 around -inf 9.3%
fma-def9.3%
times-frac8.2%
unpow28.2%
unpow28.2%
*-commutative8.2%
unpow28.2%
associate-*r*8.2%
Simplified31.8%
Taylor expanded in c0 around 0 43.1%
associate-/l*42.1%
associate-*r/42.1%
unpow242.1%
unpow242.1%
unpow242.1%
Simplified42.1%
Taylor expanded in D around 0 43.1%
*-commutative43.1%
unpow243.1%
*-commutative43.1%
unpow243.1%
unpow243.1%
Simplified43.1%
Taylor expanded in D around 0 43.1%
unpow243.1%
unpow243.1%
associate-*r*50.0%
unpow250.0%
associate-*r*49.8%
unpow249.8%
unpow249.8%
Simplified49.8%
if 5e307 < (*.f64 d d) Initial program 25.2%
times-frac25.2%
fma-def25.2%
associate-/r*25.2%
difference-of-squares33.1%
Simplified36.3%
Taylor expanded in c0 around -inf 0.0%
associate-*r*0.0%
distribute-rgt1-in0.0%
metadata-eval0.0%
mul0-lft36.9%
metadata-eval36.9%
mul0-lft0.0%
metadata-eval0.0%
distribute-lft1-in0.0%
*-commutative0.0%
distribute-lft1-in0.0%
metadata-eval0.0%
mul0-lft36.9%
Simplified36.9%
Taylor expanded in c0 around 0 39.9%
Final simplification44.3%
(FPCore (c0 w h D d M) :precision binary64 (if (<= (* d d) 1e+277) (* 0.25 (* (/ (* D D) d) (/ (* h (* M M)) d))) 0.0))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((d * d) <= 1e+277) {
tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d));
} 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 ((d_1 * d_1) <= 1d+277) then
tmp = 0.25d0 * (((d * d) / d_1) * ((h * (m * m)) / d_1))
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 ((d * d) <= 1e+277) {
tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (d * d) <= 1e+277: tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d)) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (Float64(d * d) <= 1e+277) tmp = Float64(0.25 * Float64(Float64(Float64(D * D) / d) * Float64(Float64(h * Float64(M * M)) / d))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((d * d) <= 1e+277) tmp = 0.25 * (((D * D) / d) * ((h * (M * M)) / d)); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[N[(d * d), $MachinePrecision], 1e+277], N[(0.25 * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \cdot d \leq 10^{+277}:\\
\;\;\;\;0.25 \cdot \left(\frac{D \cdot D}{d} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if (*.f64 d d) < 1e277Initial program 24.0%
Taylor expanded in c0 around -inf 9.0%
fma-def9.0%
times-frac7.6%
unpow27.6%
unpow27.6%
*-commutative7.6%
unpow27.6%
associate-*r*7.6%
Simplified28.9%
Taylor expanded in c0 around 0 39.6%
associate-/l*39.4%
associate-*r/39.4%
unpow239.4%
unpow239.4%
unpow239.4%
Simplified39.4%
Taylor expanded in D around 0 39.6%
*-commutative39.6%
unpow239.6%
*-commutative39.6%
unpow239.6%
unpow239.6%
Simplified39.6%
times-frac43.0%
Applied egg-rr43.0%
if 1e277 < (*.f64 d d) Initial program 24.6%
times-frac24.6%
fma-def24.6%
associate-/r*24.6%
difference-of-squares32.8%
Simplified37.7%
Taylor expanded in c0 around -inf 0.1%
associate-*r*0.1%
distribute-rgt1-in0.1%
metadata-eval0.1%
mul0-lft35.6%
metadata-eval35.6%
mul0-lft1.0%
metadata-eval1.0%
distribute-lft1-in1.0%
*-commutative1.0%
distribute-lft1-in1.0%
metadata-eval1.0%
mul0-lft35.6%
Simplified35.6%
Taylor expanded in c0 around 0 38.4%
Final simplification41.0%
(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.2%
times-frac22.7%
fma-def22.7%
associate-/r*22.7%
difference-of-squares27.5%
Simplified32.4%
Taylor expanded in c0 around -inf 2.3%
associate-*r*2.3%
distribute-rgt1-in2.3%
metadata-eval2.3%
mul0-lft29.5%
metadata-eval29.5%
mul0-lft3.5%
metadata-eval3.5%
distribute-lft1-in3.5%
*-commutative3.5%
distribute-lft1-in3.5%
metadata-eval3.5%
mul0-lft29.5%
Simplified29.5%
Taylor expanded in c0 around 0 33.6%
Final simplification33.6%
herbie shell --seed 2023199
(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))))))