
(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 8 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 (* 2.0 w))) (t_1 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
(if (<= (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M))))) INFINITY)
(* t_0 (* 2.0 (* (/ d D) (* (/ d (* h D)) (/ c0 w)))))
(* 0.25 (/ (* D D) (* (/ d (* h M)) (/ d M)))))))
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)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= ((double) INFINITY)) {
tmp = t_0 * (2.0 * ((d / D) * ((d / (h * D)) * (c0 / w))));
} else {
tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M)));
}
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 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = t_0 * (2.0 * ((d / D) * ((d / (h * D)) * (c0 / w))));
} else {
tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) t_1 = (c0 * (d * d)) / ((w * h) * (D * D)) tmp = 0 if (t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))) <= math.inf: tmp = t_0 * (2.0 * ((d / D) * ((d / (h * D)) * (c0 / w)))) else: tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M))) 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(w * h) * Float64(D * D))) tmp = 0.0 if (Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= Inf) tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(d / D) * Float64(Float64(d / Float64(h * D)) * Float64(c0 / w))))); else tmp = Float64(0.25 * Float64(Float64(D * D) / Float64(Float64(d / Float64(h * M)) * Float64(d / M)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); t_1 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = 0.0; if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= Inf) tmp = t_0 * (2.0 * ((d / D) * ((d / (h * D)) * (c0 / w)))); else tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M))); 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[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[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], Infinity], N[(t$95$0 * N[(2.0 * N[(N[(d / D), $MachinePrecision] * N[(N[(d / N[(h * D), $MachinePrecision]), $MachinePrecision] * N[(c0 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(d / N[(h * M), $MachinePrecision]), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(\frac{d}{D} \cdot \left(\frac{d}{h \cdot D} \cdot \frac{c0}{w}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d}{h \cdot M} \cdot \frac{d}{M}}\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 74.8%
times-frac70.3%
fma-def69.2%
associate-/r*69.4%
difference-of-squares69.4%
Simplified70.3%
Taylor expanded in c0 around inf 73.6%
*-commutative73.6%
unpow273.6%
associate-/l/71.4%
associate-/r*72.5%
associate-/r*71.3%
unpow271.3%
associate-/l/72.3%
unpow272.3%
*-commutative72.3%
unpow272.3%
associate-*r*73.3%
*-commutative73.3%
Simplified73.3%
*-un-lft-identity73.3%
times-frac69.9%
*-commutative69.9%
Applied egg-rr69.9%
*-lft-identity69.9%
times-frac76.2%
Simplified76.2%
associate-*l/75.2%
*-commutative75.2%
associate-*l*78.5%
*-commutative78.5%
Applied egg-rr78.5%
associate-*l/80.5%
*-commutative80.5%
*-commutative80.5%
*-commutative80.5%
Simplified80.5%
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%
times-frac0.6%
fma-def0.6%
associate-/r*0.6%
difference-of-squares14.0%
Simplified16.6%
fma-udef17.2%
associate-/l/15.9%
times-frac13.4%
fma-udef13.4%
associate-/l/13.4%
times-frac13.4%
associate-/l/13.4%
times-frac13.4%
Applied egg-rr3.2%
unpow23.2%
associate--r-6.2%
+-inverses32.5%
unpow232.5%
Simplified32.5%
Taylor expanded in c0 around -inf 21.3%
mul-1-neg21.3%
unsub-neg21.3%
associate-*r/21.3%
associate-*r*22.0%
unpow222.0%
unpow222.0%
unpow222.0%
associate-*r*22.0%
times-frac22.6%
unpow222.6%
unpow222.6%
times-frac23.2%
unpow223.2%
*-commutative23.2%
Simplified23.3%
Taylor expanded in c0 around inf 44.0%
unpow244.0%
*-commutative44.0%
unpow244.0%
associate-/l*44.0%
unpow244.0%
unpow244.0%
unpow244.0%
*-commutative44.0%
Simplified44.0%
Taylor expanded in d around 0 44.0%
unpow244.0%
unpow244.0%
associate-*r*47.0%
times-frac58.1%
Simplified58.1%
Final simplification66.1%
(FPCore (c0 w h D d M) :precision binary64 (if (<= (* M M) 2e+117) (* 0.25 (* (* h (* M M)) (* (/ D d) (/ D d)))) (* (/ c0 (* 2.0 w)) (* 2.0 (* (/ d D) (* (/ d D) (/ c0 (* w h))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M * M) <= 2e+117) {
tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d)));
} else {
tmp = (c0 / (2.0 * w)) * (2.0 * ((d / D) * ((d / D) * (c0 / (w * h)))));
}
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 * m) <= 2d+117) then
tmp = 0.25d0 * ((h * (m * m)) * ((d / d_1) * (d / d_1)))
else
tmp = (c0 / (2.0d0 * w)) * (2.0d0 * ((d_1 / d) * ((d_1 / d) * (c0 / (w * h)))))
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 * M) <= 2e+117) {
tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d)));
} else {
tmp = (c0 / (2.0 * w)) * (2.0 * ((d / D) * ((d / D) * (c0 / (w * h)))));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (M * M) <= 2e+117: tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d))) else: tmp = (c0 / (2.0 * w)) * (2.0 * ((d / D) * ((d / D) * (c0 / (w * h))))) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (Float64(M * M) <= 2e+117) tmp = Float64(0.25 * Float64(Float64(h * Float64(M * M)) * Float64(Float64(D / d) * Float64(D / d)))); else tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(Float64(d / D) * Float64(Float64(d / D) * Float64(c0 / Float64(w * h)))))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((M * M) <= 2e+117) tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d))); else tmp = (c0 / (2.0 * w)) * (2.0 * ((d / D) * ((d / D) * (c0 / (w * h))))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[N[(M * M), $MachinePrecision], 2e+117], N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(d / D), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \cdot M \leq 2 \cdot 10^{+117}:\\
\;\;\;\;0.25 \cdot \left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{d}{D} \cdot \left(\frac{d}{D} \cdot \frac{c0}{w \cdot h}\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 M M) < 2.0000000000000001e117Initial program 31.1%
times-frac28.7%
fma-def28.2%
associate-/r*28.3%
difference-of-squares28.3%
Simplified30.7%
fma-udef32.5%
associate-/l/30.1%
times-frac29.4%
fma-udef29.4%
associate-/l/29.3%
times-frac29.3%
associate-/l/29.3%
times-frac31.1%
Applied egg-rr5.5%
unpow25.5%
associate--r-9.0%
+-inverses32.5%
unpow232.5%
Simplified32.5%
Taylor expanded in c0 around -inf 26.5%
mul-1-neg26.5%
unsub-neg26.5%
associate-*r/26.5%
associate-*r*25.4%
unpow225.4%
unpow225.4%
unpow225.4%
associate-*r*25.4%
times-frac24.8%
unpow224.8%
unpow224.8%
times-frac25.4%
unpow225.4%
*-commutative25.4%
Simplified26.0%
Taylor expanded in c0 around inf 43.9%
unpow243.9%
*-commutative43.9%
unpow243.9%
associate-/l*43.6%
unpow243.6%
unpow243.6%
unpow243.6%
*-commutative43.6%
Simplified43.6%
Taylor expanded in D around 0 43.9%
*-commutative43.9%
unpow243.9%
associate-*r/42.2%
unpow242.2%
unpow242.2%
times-frac51.7%
Simplified51.7%
if 2.0000000000000001e117 < (*.f64 M M) Initial program 17.6%
times-frac18.8%
fma-def18.8%
associate-/r*18.8%
difference-of-squares44.4%
Simplified45.6%
Taylor expanded in c0 around inf 49.8%
*-commutative49.8%
unpow249.8%
associate-/l/52.3%
associate-/r*54.6%
associate-/r*53.5%
unpow253.5%
associate-/l/50.9%
unpow250.9%
*-commutative50.9%
unpow250.9%
associate-*r*52.1%
*-commutative52.1%
Simplified52.1%
*-un-lft-identity52.1%
times-frac53.6%
*-commutative53.6%
Applied egg-rr53.6%
*-lft-identity53.6%
times-frac55.1%
Simplified55.1%
associate-*l/55.1%
*-commutative55.1%
associate-*l*57.3%
*-commutative57.3%
Applied egg-rr57.3%
associate-*l/58.4%
*-commutative58.4%
*-commutative58.4%
*-commutative58.4%
Simplified58.4%
Taylor expanded in d around 0 58.4%
times-frac58.4%
Simplified58.4%
Final simplification54.0%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* h (* M M))))
(if (<= D 7.2e-146)
(* 0.25 (/ D (/ (/ (* d d) t_0) D)))
(if (<= D 6.6e-137)
(/ (* d d) (/ (* h (* (* D D) (* w w))) (* c0 c0)))
(if (<= D 3.8e+75)
(* 0.25 (/ (* D D) (* (/ d (* h M)) (/ d M))))
(* 0.25 (* t_0 (* (/ D d) (/ D d)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = h * (M * M);
double tmp;
if (D <= 7.2e-146) {
tmp = 0.25 * (D / (((d * d) / t_0) / D));
} else if (D <= 6.6e-137) {
tmp = (d * d) / ((h * ((D * D) * (w * w))) / (c0 * c0));
} else if (D <= 3.8e+75) {
tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M)));
} else {
tmp = 0.25 * (t_0 * ((D / 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 = h * (m * m)
if (d <= 7.2d-146) then
tmp = 0.25d0 * (d / (((d_1 * d_1) / t_0) / d))
else if (d <= 6.6d-137) then
tmp = (d_1 * d_1) / ((h * ((d * d) * (w * w))) / (c0 * c0))
else if (d <= 3.8d+75) then
tmp = 0.25d0 * ((d * d) / ((d_1 / (h * m)) * (d_1 / m)))
else
tmp = 0.25d0 * (t_0 * ((d / d_1) * (d / 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 = h * (M * M);
double tmp;
if (D <= 7.2e-146) {
tmp = 0.25 * (D / (((d * d) / t_0) / D));
} else if (D <= 6.6e-137) {
tmp = (d * d) / ((h * ((D * D) * (w * w))) / (c0 * c0));
} else if (D <= 3.8e+75) {
tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M)));
} else {
tmp = 0.25 * (t_0 * ((D / d) * (D / d)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = h * (M * M) tmp = 0 if D <= 7.2e-146: tmp = 0.25 * (D / (((d * d) / t_0) / D)) elif D <= 6.6e-137: tmp = (d * d) / ((h * ((D * D) * (w * w))) / (c0 * c0)) elif D <= 3.8e+75: tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M))) else: tmp = 0.25 * (t_0 * ((D / d) * (D / d))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(h * Float64(M * M)) tmp = 0.0 if (D <= 7.2e-146) tmp = Float64(0.25 * Float64(D / Float64(Float64(Float64(d * d) / t_0) / D))); elseif (D <= 6.6e-137) tmp = Float64(Float64(d * d) / Float64(Float64(h * Float64(Float64(D * D) * Float64(w * w))) / Float64(c0 * c0))); elseif (D <= 3.8e+75) tmp = Float64(0.25 * Float64(Float64(D * D) / Float64(Float64(d / Float64(h * M)) * Float64(d / M)))); else tmp = Float64(0.25 * Float64(t_0 * Float64(Float64(D / d) * Float64(D / d)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = h * (M * M); tmp = 0.0; if (D <= 7.2e-146) tmp = 0.25 * (D / (((d * d) / t_0) / D)); elseif (D <= 6.6e-137) tmp = (d * d) / ((h * ((D * D) * (w * w))) / (c0 * c0)); elseif (D <= 3.8e+75) tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M))); else tmp = 0.25 * (t_0 * ((D / d) * (D / d))); 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[D, 7.2e-146], N[(0.25 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / t$95$0), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 6.6e-137], N[(N[(d * d), $MachinePrecision] / N[(N[(h * N[(N[(D * D), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c0 * c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 3.8e+75], N[(0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(d / N[(h * M), $MachinePrecision]), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(t$95$0 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := h \cdot \left(M \cdot M\right)\\
\mathbf{if}\;D \leq 7.2 \cdot 10^{-146}:\\
\;\;\;\;0.25 \cdot \frac{D}{\frac{\frac{d \cdot d}{t_0}}{D}}\\
\mathbf{elif}\;D \leq 6.6 \cdot 10^{-137}:\\
\;\;\;\;\frac{d \cdot d}{\frac{h \cdot \left(\left(D \cdot D\right) \cdot \left(w \cdot w\right)\right)}{c0 \cdot c0}}\\
\mathbf{elif}\;D \leq 3.8 \cdot 10^{+75}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d}{h \cdot M} \cdot \frac{d}{M}}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(t_0 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\
\end{array}
\end{array}
if D < 7.19999999999999957e-146Initial program 24.7%
times-frac22.9%
fma-def22.9%
associate-/r*23.0%
difference-of-squares32.0%
Simplified34.9%
fma-udef36.0%
associate-/l/33.8%
times-frac32.6%
fma-udef32.6%
associate-/l/32.5%
times-frac32.5%
associate-/l/32.5%
times-frac33.7%
Applied egg-rr3.6%
unpow23.6%
associate--r-6.3%
+-inverses28.1%
unpow228.1%
Simplified28.1%
Taylor expanded in c0 around -inf 20.7%
mul-1-neg20.7%
unsub-neg20.7%
associate-*r/20.7%
associate-*r*21.3%
unpow221.3%
unpow221.3%
unpow221.3%
associate-*r*21.3%
times-frac21.3%
unpow221.3%
unpow221.3%
times-frac21.8%
unpow221.8%
*-commutative21.8%
Simplified21.9%
Taylor expanded in c0 around inf 36.1%
unpow236.1%
*-commutative36.1%
unpow236.1%
associate-/l*36.4%
unpow236.4%
unpow236.4%
unpow236.4%
*-commutative36.4%
Simplified36.4%
*-un-lft-identity36.4%
associate-/l*45.8%
Applied egg-rr45.8%
if 7.19999999999999957e-146 < D < 6.6000000000000004e-137Initial program 80.0%
associate-*l*80.0%
difference-of-squares80.0%
associate-*l*80.0%
associate-*l*80.0%
Simplified80.0%
Taylor expanded in c0 around inf 80.0%
associate-/l*80.0%
unpow280.0%
associate-*r*80.0%
unpow280.0%
unpow280.0%
unpow280.0%
Simplified80.0%
if 6.6000000000000004e-137 < D < 3.8000000000000002e75Initial program 33.5%
times-frac33.6%
fma-def31.7%
associate-/r*31.7%
difference-of-squares41.6%
Simplified39.6%
fma-udef41.5%
associate-/l/41.5%
times-frac41.5%
fma-udef41.5%
associate-/l/41.5%
times-frac41.5%
associate-/l/41.5%
times-frac43.4%
Applied egg-rr3.9%
unpow23.9%
associate--r-6.0%
+-inverses12.3%
unpow212.3%
Simplified12.3%
Taylor expanded in c0 around -inf 14.5%
mul-1-neg14.5%
unsub-neg14.5%
associate-*r/14.5%
associate-*r*14.5%
unpow214.5%
unpow214.5%
unpow214.5%
associate-*r*14.5%
times-frac10.6%
unpow210.6%
unpow210.6%
times-frac10.6%
unpow210.6%
*-commutative10.6%
Simplified12.5%
Taylor expanded in c0 around inf 40.1%
unpow240.1%
*-commutative40.1%
unpow240.1%
associate-/l*40.3%
unpow240.3%
unpow240.3%
unpow240.3%
*-commutative40.3%
Simplified40.3%
Taylor expanded in d around 0 40.3%
unpow240.3%
unpow240.3%
associate-*r*45.8%
times-frac55.6%
Simplified55.6%
if 3.8000000000000002e75 < D Initial program 14.0%
times-frac13.9%
fma-def13.9%
associate-/r*13.9%
difference-of-squares18.5%
Simplified23.2%
fma-udef23.1%
associate-/l/23.1%
times-frac18.5%
fma-udef18.5%
associate-/l/18.5%
times-frac18.4%
associate-/l/18.4%
times-frac18.6%
Applied egg-rr4.7%
unpow24.7%
associate--r-9.0%
+-inverses18.5%
unpow218.5%
Simplified18.5%
Taylor expanded in c0 around -inf 9.2%
mul-1-neg9.2%
unsub-neg9.2%
associate-*r/9.2%
associate-*r*4.8%
unpow24.8%
unpow24.8%
unpow24.8%
associate-*r*4.8%
times-frac9.3%
unpow29.3%
unpow29.3%
times-frac9.3%
unpow29.3%
*-commutative9.3%
Simplified9.3%
Taylor expanded in c0 around inf 23.4%
unpow223.4%
*-commutative23.4%
unpow223.4%
associate-/l*19.1%
unpow219.1%
unpow219.1%
unpow219.1%
*-commutative19.1%
Simplified19.1%
Taylor expanded in D around 0 23.4%
*-commutative23.4%
unpow223.4%
associate-*r/23.3%
unpow223.3%
unpow223.3%
times-frac55.1%
Simplified55.1%
Final simplification49.2%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= D 2.4e-184) (not (<= D 6.8e+101))) (* 0.25 (* (* h (* M M)) (* (/ D d) (/ D d)))) (* 0.25 (/ (* D D) (* (/ d h) (/ d (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((D <= 2.4e-184) || !(D <= 6.8e+101)) {
tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d)));
} else {
tmp = 0.25 * ((D * D) / ((d / h) * (d / (M * 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) :: tmp
if ((d <= 2.4d-184) .or. (.not. (d <= 6.8d+101))) then
tmp = 0.25d0 * ((h * (m * m)) * ((d / d_1) * (d / d_1)))
else
tmp = 0.25d0 * ((d * d) / ((d_1 / h) * (d_1 / (m * m))))
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 <= 2.4e-184) || !(D <= 6.8e+101)) {
tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d)));
} else {
tmp = 0.25 * ((D * D) / ((d / h) * (d / (M * M))));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (D <= 2.4e-184) or not (D <= 6.8e+101): tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d))) else: tmp = 0.25 * ((D * D) / ((d / h) * (d / (M * M)))) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((D <= 2.4e-184) || !(D <= 6.8e+101)) tmp = Float64(0.25 * Float64(Float64(h * Float64(M * M)) * Float64(Float64(D / d) * Float64(D / d)))); else tmp = Float64(0.25 * Float64(Float64(D * D) / Float64(Float64(d / h) * Float64(d / Float64(M * M))))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((D <= 2.4e-184) || ~((D <= 6.8e+101))) tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d))); else tmp = 0.25 * ((D * D) / ((d / h) * (d / (M * M)))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[D, 2.4e-184], N[Not[LessEqual[D, 6.8e+101]], $MachinePrecision]], N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(d / h), $MachinePrecision] * N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 2.4 \cdot 10^{-184} \lor \neg \left(D \leq 6.8 \cdot 10^{+101}\right):\\
\;\;\;\;0.25 \cdot \left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d}{h} \cdot \frac{d}{M \cdot M}}\\
\end{array}
\end{array}
if D < 2.40000000000000024e-184 or 6.80000000000000034e101 < D Initial program 23.7%
times-frac22.0%
fma-def22.0%
associate-/r*22.1%
difference-of-squares30.7%
Simplified34.0%
fma-udef35.1%
associate-/l/32.9%
times-frac31.2%
fma-udef31.2%
associate-/l/31.1%
times-frac31.1%
associate-/l/31.1%
times-frac32.3%
Applied egg-rr3.4%
unpow23.4%
associate--r-6.6%
+-inverses26.4%
unpow226.4%
Simplified26.4%
Taylor expanded in c0 around -inf 18.7%
mul-1-neg18.7%
unsub-neg18.7%
associate-*r/18.7%
associate-*r*18.8%
unpow218.8%
unpow218.8%
unpow218.8%
associate-*r*18.8%
times-frac18.8%
unpow218.8%
unpow218.8%
times-frac19.3%
unpow219.3%
*-commutative19.3%
Simplified19.4%
Taylor expanded in c0 around inf 33.0%
unpow233.0%
*-commutative33.0%
unpow233.0%
associate-/l*32.7%
unpow232.7%
unpow232.7%
unpow232.7%
*-commutative32.7%
Simplified32.7%
Taylor expanded in D around 0 33.0%
*-commutative33.0%
unpow233.0%
associate-*r/32.4%
unpow232.4%
unpow232.4%
times-frac45.1%
Simplified45.1%
if 2.40000000000000024e-184 < D < 6.80000000000000034e101Initial program 34.4%
times-frac34.5%
fma-def33.1%
associate-/r*33.1%
difference-of-squares41.8%
Simplified40.3%
fma-udef41.7%
associate-/l/41.7%
times-frac41.7%
fma-udef41.7%
associate-/l/41.7%
times-frac41.7%
associate-/l/41.7%
times-frac43.0%
Applied egg-rr4.3%
unpow24.3%
associate--r-5.8%
+-inverses16.1%
unpow216.1%
Simplified16.1%
Taylor expanded in c0 around -inf 16.4%
mul-1-neg16.4%
unsub-neg16.4%
associate-*r/16.4%
associate-*r*16.4%
unpow216.4%
unpow216.4%
unpow216.4%
associate-*r*16.4%
times-frac15.0%
unpow215.0%
unpow215.0%
times-frac15.0%
unpow215.0%
*-commutative15.0%
Simplified16.4%
Taylor expanded in c0 around inf 41.1%
unpow241.1%
*-commutative41.1%
unpow241.1%
associate-/l*41.3%
unpow241.3%
unpow241.3%
unpow241.3%
*-commutative41.3%
Simplified41.3%
times-frac48.1%
Applied egg-rr48.1%
Final simplification45.9%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= D 2.15e-184) (not (<= D 3.9e+75))) (* 0.25 (* (* h (* M M)) (* (/ D d) (/ D d)))) (* 0.25 (/ (* D D) (* (/ d (* h M)) (/ d M))))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((D <= 2.15e-184) || !(D <= 3.9e+75)) {
tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d)));
} else {
tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / 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) :: tmp
if ((d <= 2.15d-184) .or. (.not. (d <= 3.9d+75))) then
tmp = 0.25d0 * ((h * (m * m)) * ((d / d_1) * (d / d_1)))
else
tmp = 0.25d0 * ((d * d) / ((d_1 / (h * m)) * (d_1 / m)))
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 <= 2.15e-184) || !(D <= 3.9e+75)) {
tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d)));
} else {
tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M)));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (D <= 2.15e-184) or not (D <= 3.9e+75): tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d))) else: tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M))) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((D <= 2.15e-184) || !(D <= 3.9e+75)) tmp = Float64(0.25 * Float64(Float64(h * Float64(M * M)) * Float64(Float64(D / d) * Float64(D / d)))); else tmp = Float64(0.25 * Float64(Float64(D * D) / Float64(Float64(d / Float64(h * M)) * Float64(d / M)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((D <= 2.15e-184) || ~((D <= 3.9e+75))) tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d))); else tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[D, 2.15e-184], N[Not[LessEqual[D, 3.9e+75]], $MachinePrecision]], N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(d / N[(h * M), $MachinePrecision]), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 2.15 \cdot 10^{-184} \lor \neg \left(D \leq 3.9 \cdot 10^{+75}\right):\\
\;\;\;\;0.25 \cdot \left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d}{h \cdot M} \cdot \frac{d}{M}}\\
\end{array}
\end{array}
if D < 2.15000000000000003e-184 or 3.90000000000000038e75 < D Initial program 23.6%
times-frac21.9%
fma-def21.9%
associate-/r*22.0%
difference-of-squares30.4%
Simplified33.6%
fma-udef34.7%
associate-/l/32.6%
times-frac30.9%
fma-udef30.9%
associate-/l/30.8%
times-frac30.8%
associate-/l/30.8%
times-frac31.9%
Applied egg-rr3.9%
unpow23.9%
associate--r-6.9%
+-inverses26.8%
unpow226.8%
Simplified26.8%
Taylor expanded in c0 around -inf 18.7%
mul-1-neg18.7%
unsub-neg18.7%
associate-*r/18.7%
associate-*r*18.8%
unpow218.8%
unpow218.8%
unpow218.8%
associate-*r*18.8%
times-frac19.3%
unpow219.3%
unpow219.3%
times-frac19.8%
unpow219.8%
*-commutative19.8%
Simplified19.9%
Taylor expanded in c0 around inf 33.7%
unpow233.7%
*-commutative33.7%
unpow233.7%
associate-/l*33.5%
unpow233.5%
unpow233.5%
unpow233.5%
*-commutative33.5%
Simplified33.5%
Taylor expanded in D around 0 33.7%
*-commutative33.7%
unpow233.7%
associate-*r/33.2%
unpow233.2%
unpow233.2%
times-frac45.5%
Simplified45.5%
if 2.15000000000000003e-184 < D < 3.90000000000000038e75Initial program 35.5%
times-frac35.6%
fma-def34.1%
associate-/r*34.1%
difference-of-squares43.4%
Simplified41.9%
fma-udef43.3%
associate-/l/43.3%
times-frac43.4%
fma-udef43.4%
associate-/l/43.4%
times-frac43.4%
associate-/l/43.4%
times-frac44.8%
Applied egg-rr3.1%
unpow23.1%
associate--r-4.7%
+-inverses14.2%
unpow214.2%
Simplified14.2%
Taylor expanded in c0 around -inf 16.1%
mul-1-neg16.1%
unsub-neg16.1%
associate-*r/16.1%
associate-*r*16.1%
unpow216.1%
unpow216.1%
unpow216.1%
associate-*r*16.1%
times-frac13.0%
unpow213.0%
unpow213.0%
times-frac13.1%
unpow213.1%
*-commutative13.1%
Simplified14.6%
Taylor expanded in c0 around inf 39.5%
unpow239.5%
*-commutative39.5%
unpow239.5%
associate-/l*39.6%
unpow239.6%
unpow239.6%
unpow239.6%
*-commutative39.6%
Simplified39.6%
Taylor expanded in d around 0 39.6%
unpow239.6%
unpow239.6%
associate-*r*45.6%
times-frac53.2%
Simplified53.2%
Final simplification47.5%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* h (* M M))))
(if (<= D 2.3e-184)
(* 0.25 (/ D (/ (/ (* d d) t_0) D)))
(if (<= D 4e+75)
(* 0.25 (/ (* D D) (* (/ d (* h M)) (/ d M))))
(* 0.25 (* t_0 (* (/ D d) (/ D d))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = h * (M * M);
double tmp;
if (D <= 2.3e-184) {
tmp = 0.25 * (D / (((d * d) / t_0) / D));
} else if (D <= 4e+75) {
tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M)));
} else {
tmp = 0.25 * (t_0 * ((D / 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 = h * (m * m)
if (d <= 2.3d-184) then
tmp = 0.25d0 * (d / (((d_1 * d_1) / t_0) / d))
else if (d <= 4d+75) then
tmp = 0.25d0 * ((d * d) / ((d_1 / (h * m)) * (d_1 / m)))
else
tmp = 0.25d0 * (t_0 * ((d / d_1) * (d / 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 = h * (M * M);
double tmp;
if (D <= 2.3e-184) {
tmp = 0.25 * (D / (((d * d) / t_0) / D));
} else if (D <= 4e+75) {
tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M)));
} else {
tmp = 0.25 * (t_0 * ((D / d) * (D / d)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = h * (M * M) tmp = 0 if D <= 2.3e-184: tmp = 0.25 * (D / (((d * d) / t_0) / D)) elif D <= 4e+75: tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M))) else: tmp = 0.25 * (t_0 * ((D / d) * (D / d))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(h * Float64(M * M)) tmp = 0.0 if (D <= 2.3e-184) tmp = Float64(0.25 * Float64(D / Float64(Float64(Float64(d * d) / t_0) / D))); elseif (D <= 4e+75) tmp = Float64(0.25 * Float64(Float64(D * D) / Float64(Float64(d / Float64(h * M)) * Float64(d / M)))); else tmp = Float64(0.25 * Float64(t_0 * Float64(Float64(D / d) * Float64(D / d)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = h * (M * M); tmp = 0.0; if (D <= 2.3e-184) tmp = 0.25 * (D / (((d * d) / t_0) / D)); elseif (D <= 4e+75) tmp = 0.25 * ((D * D) / ((d / (h * M)) * (d / M))); else tmp = 0.25 * (t_0 * ((D / d) * (D / d))); 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[D, 2.3e-184], N[(0.25 * N[(D / N[(N[(N[(d * d), $MachinePrecision] / t$95$0), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 4e+75], N[(0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(d / N[(h * M), $MachinePrecision]), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(t$95$0 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := h \cdot \left(M \cdot M\right)\\
\mathbf{if}\;D \leq 2.3 \cdot 10^{-184}:\\
\;\;\;\;0.25 \cdot \frac{D}{\frac{\frac{d \cdot d}{t_0}}{D}}\\
\mathbf{elif}\;D \leq 4 \cdot 10^{+75}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d}{h \cdot M} \cdot \frac{d}{M}}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(t_0 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\
\end{array}
\end{array}
if D < 2.2999999999999999e-184Initial program 24.8%
times-frac23.0%
fma-def23.0%
associate-/r*23.1%
difference-of-squares32.0%
Simplified35.0%
fma-udef36.2%
associate-/l/33.8%
times-frac32.5%
fma-udef32.5%
associate-/l/32.4%
times-frac32.4%
associate-/l/32.4%
times-frac33.7%
Applied egg-rr3.8%
unpow23.8%
associate--r-6.7%
+-inverses27.9%
unpow227.9%
Simplified27.9%
Taylor expanded in c0 around -inf 20.0%
mul-1-neg20.0%
unsub-neg20.0%
associate-*r/20.0%
associate-*r*20.6%
unpow220.6%
unpow220.6%
unpow220.6%
associate-*r*20.6%
times-frac20.6%
unpow220.6%
unpow220.6%
times-frac21.2%
unpow221.2%
*-commutative21.2%
Simplified21.3%
Taylor expanded in c0 around inf 35.1%
unpow235.1%
*-commutative35.1%
unpow235.1%
associate-/l*35.3%
unpow235.3%
unpow235.3%
unpow235.3%
*-commutative35.3%
Simplified35.3%
*-un-lft-identity35.3%
associate-/l*44.6%
Applied egg-rr44.6%
if 2.2999999999999999e-184 < D < 3.99999999999999971e75Initial program 35.5%
times-frac35.6%
fma-def34.1%
associate-/r*34.1%
difference-of-squares43.4%
Simplified41.9%
fma-udef43.3%
associate-/l/43.3%
times-frac43.4%
fma-udef43.4%
associate-/l/43.4%
times-frac43.4%
associate-/l/43.4%
times-frac44.8%
Applied egg-rr3.1%
unpow23.1%
associate--r-4.7%
+-inverses14.2%
unpow214.2%
Simplified14.2%
Taylor expanded in c0 around -inf 16.1%
mul-1-neg16.1%
unsub-neg16.1%
associate-*r/16.1%
associate-*r*16.1%
unpow216.1%
unpow216.1%
unpow216.1%
associate-*r*16.1%
times-frac13.0%
unpow213.0%
unpow213.0%
times-frac13.1%
unpow213.1%
*-commutative13.1%
Simplified14.6%
Taylor expanded in c0 around inf 39.5%
unpow239.5%
*-commutative39.5%
unpow239.5%
associate-/l*39.6%
unpow239.6%
unpow239.6%
unpow239.6%
*-commutative39.6%
Simplified39.6%
Taylor expanded in d around 0 39.6%
unpow239.6%
unpow239.6%
associate-*r*45.6%
times-frac53.2%
Simplified53.2%
if 3.99999999999999971e75 < D Initial program 14.0%
times-frac13.9%
fma-def13.9%
associate-/r*13.9%
difference-of-squares18.5%
Simplified23.2%
fma-udef23.1%
associate-/l/23.1%
times-frac18.5%
fma-udef18.5%
associate-/l/18.5%
times-frac18.4%
associate-/l/18.4%
times-frac18.6%
Applied egg-rr4.7%
unpow24.7%
associate--r-9.0%
+-inverses18.5%
unpow218.5%
Simplified18.5%
Taylor expanded in c0 around -inf 9.2%
mul-1-neg9.2%
unsub-neg9.2%
associate-*r/9.2%
associate-*r*4.8%
unpow24.8%
unpow24.8%
unpow24.8%
associate-*r*4.8%
times-frac9.3%
unpow29.3%
unpow29.3%
times-frac9.3%
unpow29.3%
*-commutative9.3%
Simplified9.3%
Taylor expanded in c0 around inf 23.4%
unpow223.4%
*-commutative23.4%
unpow223.4%
associate-/l*19.1%
unpow219.1%
unpow219.1%
unpow219.1%
*-commutative19.1%
Simplified19.1%
Taylor expanded in D around 0 23.4%
*-commutative23.4%
unpow223.4%
associate-*r/23.3%
unpow223.3%
unpow223.3%
times-frac55.1%
Simplified55.1%
Final simplification47.7%
(FPCore (c0 w h D d M) :precision binary64 (* 0.25 (* (* h (* M M)) (* (/ D d) (/ D d)))))
double code(double c0, double w, double h, double D, double d, double M) {
return 0.25 * ((h * (M * M)) * ((D / d) * (D / d)));
}
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.25d0 * ((h * (m * m)) * ((d / d_1) * (d / d_1)))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return 0.25 * ((h * (M * M)) * ((D / d) * (D / d)));
}
def code(c0, w, h, D, d, M): return 0.25 * ((h * (M * M)) * ((D / d) * (D / d)))
function code(c0, w, h, D, d, M) return Float64(0.25 * Float64(Float64(h * Float64(M * M)) * Float64(Float64(D / d) * Float64(D / d)))) end
function tmp = code(c0, w, h, D, d, M) tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d))); end
code[c0_, w_, h_, D_, d_, M_] := N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.25 \cdot \left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)
\end{array}
Initial program 26.6%
times-frac25.4%
fma-def25.0%
associate-/r*25.1%
difference-of-squares33.7%
Simplified35.7%
fma-udef36.9%
associate-/l/35.3%
times-frac34.1%
fma-udef34.1%
associate-/l/34.0%
times-frac34.0%
associate-/l/34.0%
times-frac35.2%
Applied egg-rr3.7%
unpow23.7%
associate--r-6.4%
+-inverses23.6%
unpow223.6%
Simplified23.6%
Taylor expanded in c0 around -inf 18.1%
mul-1-neg18.1%
unsub-neg18.1%
associate-*r/18.1%
associate-*r*18.1%
unpow218.1%
unpow218.1%
unpow218.1%
associate-*r*18.1%
times-frac17.7%
unpow217.7%
unpow217.7%
times-frac18.1%
unpow218.1%
*-commutative18.1%
Simplified18.6%
Taylor expanded in c0 around inf 35.2%
unpow235.2%
*-commutative35.2%
unpow235.2%
associate-/l*35.0%
unpow235.0%
unpow235.0%
unpow235.0%
*-commutative35.0%
Simplified35.0%
Taylor expanded in D around 0 35.2%
*-commutative35.2%
unpow235.2%
associate-*r/34.1%
unpow234.1%
unpow234.1%
times-frac43.3%
Simplified43.3%
Final simplification43.3%
(FPCore (c0 w h D d M) :precision binary64 (* -0.5 (/ 0.0 w)))
double code(double c0, double w, double h, double D, double d, double M) {
return -0.5 * (0.0 / w);
}
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.5d0) * (0.0d0 / w)
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return -0.5 * (0.0 / w);
}
def code(c0, w, h, D, d, M): return -0.5 * (0.0 / w)
function code(c0, w, h, D, d, M) return Float64(-0.5 * Float64(0.0 / w)) end
function tmp = code(c0, w, h, D, d, M) tmp = -0.5 * (0.0 / w); end
code[c0_, w_, h_, D_, d_, M_] := N[(-0.5 * N[(0.0 / w), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \frac{0}{w}
\end{array}
Initial program 26.6%
associate-*l*25.8%
difference-of-squares34.4%
associate-*l*34.0%
associate-*l*35.5%
Simplified35.5%
Taylor expanded in c0 around -inf 3.0%
*-commutative3.0%
unpow23.0%
distribute-rgt1-in3.0%
metadata-eval3.0%
mul0-lft25.4%
Simplified25.4%
Taylor expanded in c0 around 0 32.7%
Final simplification32.7%
herbie shell --seed 2023250
(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))))))