(FPCore (c0 w h D d M)
: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))))))(FPCore (c0 w h D d M)
:precision binary64
(if (<= h 1.0667044981912174e-147)
(* 0.25 (* D (* (/ D d) (/ (* M (* h M)) d))))
(if (<= h 1.0261799473837364e+177)
(* 0.25 (/ (* D (* (/ D d) (* h (* M M)))) d))
(* 0.25 (/ (* h (* (pow D 2.0) (pow M 2.0))) (pow d 2.0))))))double code(double c0, double w, double h, double D, double d, double M) {
return (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))));
}
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (h <= 1.0667044981912174e-147) {
tmp = 0.25 * (D * ((D / d) * ((M * (h * M)) / d)));
} else if (h <= 1.0261799473837364e+177) {
tmp = 0.25 * ((D * ((D / d) * (h * (M * M)))) / d);
} else {
tmp = 0.25 * ((h * (pow(D, 2.0) * pow(M, 2.0))) / pow(d, 2.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
code = (c0 / (2.0d0 * w)) * (((c0 * (d_1 * d_1)) / ((w * h) * (d * d))) + sqrt(((((c0 * (d_1 * d_1)) / ((w * h) * (d * d))) * ((c0 * (d_1 * d_1)) / ((w * h) * (d * d)))) - (m * m))))
end function
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 (h <= 1.0667044981912174d-147) then
tmp = 0.25d0 * (d * ((d / d_1) * ((m * (h * m)) / d_1)))
else if (h <= 1.0261799473837364d+177) then
tmp = 0.25d0 * ((d * ((d / d_1) * (h * (m * m)))) / d_1)
else
tmp = 0.25d0 * ((h * ((d ** 2.0d0) * (m ** 2.0d0))) / (d_1 ** 2.0d0))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + Math.sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))));
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (h <= 1.0667044981912174e-147) {
tmp = 0.25 * (D * ((D / d) * ((M * (h * M)) / d)));
} else if (h <= 1.0261799473837364e+177) {
tmp = 0.25 * ((D * ((D / d) * (h * (M * M)))) / d);
} else {
tmp = 0.25 * ((h * (Math.pow(D, 2.0) * Math.pow(M, 2.0))) / Math.pow(d, 2.0));
}
return tmp;
}
def code(c0, w, h, D, d, M): return (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + math.sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))))
def code(c0, w, h, D, d, M): tmp = 0 if h <= 1.0667044981912174e-147: tmp = 0.25 * (D * ((D / d) * ((M * (h * M)) / d))) elif h <= 1.0261799473837364e+177: tmp = 0.25 * ((D * ((D / d) * (h * (M * M)))) / d) else: tmp = 0.25 * ((h * (math.pow(D, 2.0) * math.pow(M, 2.0))) / math.pow(d, 2.0)) return tmp
function code(c0, w, h, D, d, M) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) + sqrt(Float64(Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) * Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))) - Float64(M * M))))) end
function code(c0, w, h, D, d, M) tmp = 0.0 if (h <= 1.0667044981912174e-147) tmp = Float64(0.25 * Float64(D * Float64(Float64(D / d) * Float64(Float64(M * Float64(h * M)) / d)))); elseif (h <= 1.0261799473837364e+177) tmp = Float64(0.25 * Float64(Float64(D * Float64(Float64(D / d) * Float64(h * Float64(M * M)))) / d)); else tmp = Float64(0.25 * Float64(Float64(h * Float64((D ^ 2.0) * (M ^ 2.0))) / (d ^ 2.0))); end return tmp end
function tmp = code(c0, w, h, D, d, M) tmp = (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)))); end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (h <= 1.0667044981912174e-147) tmp = 0.25 * (D * ((D / d) * ((M * (h * M)) / d))); elseif (h <= 1.0261799473837364e+177) tmp = 0.25 * ((D * ((D / d) * (h * (M * M)))) / d); else tmp = 0.25 * ((h * ((D ^ 2.0) * (M ^ 2.0))) / (d ^ 2.0)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[h, 1.0667044981912174e-147], N[(0.25 * N[(D * N[(N[(D / d), $MachinePrecision] * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.0261799473837364e+177], N[(0.25 * N[(N[(D * N[(N[(D / d), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(h * N[(N[Power[D, 2.0], $MachinePrecision] * N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\begin{array}{l}
\mathbf{if}\;h \leq 1.0667044981912174 \cdot 10^{-147}:\\
\;\;\;\;0.25 \cdot \left(D \cdot \left(\frac{D}{d} \cdot \frac{M \cdot \left(h \cdot M\right)}{d}\right)\right)\\
\mathbf{elif}\;h \leq 1.0261799473837364 \cdot 10^{+177}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot \left(\frac{D}{d} \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}{{d}^{2}}\\
\end{array}



Bits error versus c0



Bits error versus w



Bits error versus h



Bits error versus D



Bits error versus d



Bits error versus M
Results
if h < 1.0667044981912174e-147Initial program 59.5
Taylor expanded in c0 around -inf 35.3
Applied add-sqr-sqrt_binary6449.6
Applied unpow-prod-down_binary6449.6
Applied times-frac_binary6448.0
Simplified48.0
Simplified31.9
Applied *-un-lft-identity_binary6431.9
Applied times-frac_binary6429.1
Applied associate-*l*_binary6428.0
Applied associate-*r*_binary6424.4
if 1.0667044981912174e-147 < h < 1.02617994738373639e177Initial program 58.7
Taylor expanded in c0 around -inf 35.1
Applied add-sqr-sqrt_binary6449.6
Applied unpow-prod-down_binary6449.6
Applied times-frac_binary6447.9
Simplified47.9
Simplified31.8
Applied *-un-lft-identity_binary6431.8
Applied times-frac_binary6428.8
Applied associate-*l*_binary6427.7
Applied associate-*r/_binary6427.3
Applied frac-times_binary6427.2
if 1.02617994738373639e177 < h Initial program 60.0
Taylor expanded in c0 around -inf 39.8
Applied associate-*r*_binary6436.9
Final simplification26.0
herbie shell --seed 2022131
(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))))))