
(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 (* d d)))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (/ t_0 (* (* w h) (* D D)))))
(if (<= (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))) INFINITY)
(* t_1 (* 2.0 (/ (/ t_0 (* D D)) (* w h))))
(* 0.25 (* D (/ D (/ d (/ h (/ d (* M M))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 * (d * d);
double t_1 = c0 / (2.0 * w);
double t_2 = t_0 / ((w * h) * (D * D));
double tmp;
if ((t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))))) <= ((double) INFINITY)) {
tmp = t_1 * (2.0 * ((t_0 / (D * D)) / (w * h)));
} else {
tmp = 0.25 * (D * (D / (d / (h / (d / (M * M))))));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 * (d * d);
double t_1 = c0 / (2.0 * w);
double t_2 = t_0 / ((w * h) * (D * D));
double tmp;
if ((t_1 * (t_2 + Math.sqrt(((t_2 * t_2) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = t_1 * (2.0 * ((t_0 / (D * D)) / (w * h)));
} else {
tmp = 0.25 * (D * (D / (d / (h / (d / (M * M))))));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 * (d * d) t_1 = c0 / (2.0 * w) t_2 = t_0 / ((w * h) * (D * D)) tmp = 0 if (t_1 * (t_2 + math.sqrt(((t_2 * t_2) - (M * M))))) <= math.inf: tmp = t_1 * (2.0 * ((t_0 / (D * D)) / (w * h))) else: tmp = 0.25 * (D * (D / (d / (h / (d / (M * M)))))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 * Float64(d * d)) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(t_0 / Float64(Float64(w * h) * Float64(D * D))) tmp = 0.0 if (Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))))) <= Inf) tmp = Float64(t_1 * Float64(2.0 * Float64(Float64(t_0 / Float64(D * D)) / Float64(w * h)))); else tmp = Float64(0.25 * Float64(D * Float64(D / Float64(d / Float64(h / Float64(d / Float64(M * M))))))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 * (d * d); t_1 = c0 / (2.0 * w); t_2 = t_0 / ((w * h) * (D * D)); tmp = 0.0; if ((t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))))) <= Inf) tmp = t_1 * (2.0 * ((t_0 / (D * D)) / (w * h))); else tmp = 0.25 * (D * (D / (d / (h / (d / (M * M)))))); end tmp_2 = 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[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$1 * N[(2.0 * N[(N[(t$95$0 / N[(D * D), $MachinePrecision]), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(D * N[(D / N[(d / N[(h / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c0 \cdot \left(d \cdot d\right)\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{t_0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;t_1 \cdot \left(t_2 + \sqrt{t_2 \cdot t_2 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \frac{\frac{t_0}{D \cdot D}}{w \cdot h}\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(D \cdot \frac{D}{\frac{d}{\frac{h}{\frac{d}{M \cdot M}}}}\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 78.5%
times-frac76.1%
fma-def76.1%
times-frac76.3%
difference-of-squares76.3%
Simplified75.1%
*-un-lft-identity75.1%
associate-*l*75.1%
div-inv75.1%
clear-num75.1%
associate-*r/76.3%
*-commutative76.3%
times-frac76.3%
frac-times77.3%
pow277.3%
Applied egg-rr77.3%
*-lft-identity77.3%
*-commutative77.3%
associate-*l/77.2%
associate-/l*77.2%
*-commutative77.2%
Simplified77.2%
fma-udef77.2%
*-commutative77.2%
associate-*r/77.2%
associate-/l*77.2%
Applied egg-rr77.2%
Taylor expanded in c0 around inf 80.8%
associate-/r*80.8%
unpow280.8%
unpow280.8%
Simplified80.8%
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 2.9%
fma-def2.9%
associate-/l*2.9%
unpow22.9%
unpow22.9%
*-commutative2.9%
unpow22.9%
associate-*r*2.9%
Simplified36.4%
Taylor expanded in c0 around 0 46.7%
associate-/l*46.8%
*-commutative46.8%
unpow246.8%
unpow246.8%
*-commutative46.8%
unpow246.8%
Simplified46.8%
*-un-lft-identity46.8%
associate-/l*53.1%
associate-/l*63.7%
Applied egg-rr63.7%
*-lft-identity63.7%
associate-/r/63.7%
unpow263.7%
associate-/l*66.9%
unpow266.9%
Simplified66.9%
Final simplification71.4%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* d (/ d D)))
(t_1 (* 0.25 (* D (/ D (/ d (/ h (/ d (* M M))))))))
(t_2 (* h (* M M))))
(if (<= h -6.8e-19)
t_1
(if (<= h -1.6e-224)
(* t_0 (/ (* (/ c0 w) (/ (/ c0 h) w)) D))
(if (<= h 5.5e-200)
(* 0.25 (/ D (/ (* d (/ d t_2)) D)))
(if (<= h 7.6e-140)
(* t_0 (/ (* c0 c0) (* D (* w (* w h)))))
(if (<= h 4.5e-8)
(* 0.25 (* t_2 (* (/ D d) (/ D d))))
(if (or (<= h 420000000000.0) (not (<= h 5e+88)))
(* d (* (/ d D) (* (/ c0 h) (/ (/ c0 (* w w)) D))))
t_1))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = d * (d / D);
double t_1 = 0.25 * (D * (D / (d / (h / (d / (M * M))))));
double t_2 = h * (M * M);
double tmp;
if (h <= -6.8e-19) {
tmp = t_1;
} else if (h <= -1.6e-224) {
tmp = t_0 * (((c0 / w) * ((c0 / h) / w)) / D);
} else if (h <= 5.5e-200) {
tmp = 0.25 * (D / ((d * (d / t_2)) / D));
} else if (h <= 7.6e-140) {
tmp = t_0 * ((c0 * c0) / (D * (w * (w * h))));
} else if (h <= 4.5e-8) {
tmp = 0.25 * (t_2 * ((D / d) * (D / d)));
} else if ((h <= 420000000000.0) || !(h <= 5e+88)) {
tmp = d * ((d / D) * ((c0 / h) * ((c0 / (w * w)) / D)));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d_1 * (d_1 / d)
t_1 = 0.25d0 * (d * (d / (d_1 / (h / (d_1 / (m * m))))))
t_2 = h * (m * m)
if (h <= (-6.8d-19)) then
tmp = t_1
else if (h <= (-1.6d-224)) then
tmp = t_0 * (((c0 / w) * ((c0 / h) / w)) / d)
else if (h <= 5.5d-200) then
tmp = 0.25d0 * (d / ((d_1 * (d_1 / t_2)) / d))
else if (h <= 7.6d-140) then
tmp = t_0 * ((c0 * c0) / (d * (w * (w * h))))
else if (h <= 4.5d-8) then
tmp = 0.25d0 * (t_2 * ((d / d_1) * (d / d_1)))
else if ((h <= 420000000000.0d0) .or. (.not. (h <= 5d+88))) then
tmp = d_1 * ((d_1 / d) * ((c0 / h) * ((c0 / (w * w)) / d)))
else
tmp = t_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 = d * (d / D);
double t_1 = 0.25 * (D * (D / (d / (h / (d / (M * M))))));
double t_2 = h * (M * M);
double tmp;
if (h <= -6.8e-19) {
tmp = t_1;
} else if (h <= -1.6e-224) {
tmp = t_0 * (((c0 / w) * ((c0 / h) / w)) / D);
} else if (h <= 5.5e-200) {
tmp = 0.25 * (D / ((d * (d / t_2)) / D));
} else if (h <= 7.6e-140) {
tmp = t_0 * ((c0 * c0) / (D * (w * (w * h))));
} else if (h <= 4.5e-8) {
tmp = 0.25 * (t_2 * ((D / d) * (D / d)));
} else if ((h <= 420000000000.0) || !(h <= 5e+88)) {
tmp = d * ((d / D) * ((c0 / h) * ((c0 / (w * w)) / D)));
} else {
tmp = t_1;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = d * (d / D) t_1 = 0.25 * (D * (D / (d / (h / (d / (M * M)))))) t_2 = h * (M * M) tmp = 0 if h <= -6.8e-19: tmp = t_1 elif h <= -1.6e-224: tmp = t_0 * (((c0 / w) * ((c0 / h) / w)) / D) elif h <= 5.5e-200: tmp = 0.25 * (D / ((d * (d / t_2)) / D)) elif h <= 7.6e-140: tmp = t_0 * ((c0 * c0) / (D * (w * (w * h)))) elif h <= 4.5e-8: tmp = 0.25 * (t_2 * ((D / d) * (D / d))) elif (h <= 420000000000.0) or not (h <= 5e+88): tmp = d * ((d / D) * ((c0 / h) * ((c0 / (w * w)) / D))) else: tmp = t_1 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(d * Float64(d / D)) t_1 = Float64(0.25 * Float64(D * Float64(D / Float64(d / Float64(h / Float64(d / Float64(M * M))))))) t_2 = Float64(h * Float64(M * M)) tmp = 0.0 if (h <= -6.8e-19) tmp = t_1; elseif (h <= -1.6e-224) tmp = Float64(t_0 * Float64(Float64(Float64(c0 / w) * Float64(Float64(c0 / h) / w)) / D)); elseif (h <= 5.5e-200) tmp = Float64(0.25 * Float64(D / Float64(Float64(d * Float64(d / t_2)) / D))); elseif (h <= 7.6e-140) tmp = Float64(t_0 * Float64(Float64(c0 * c0) / Float64(D * Float64(w * Float64(w * h))))); elseif (h <= 4.5e-8) tmp = Float64(0.25 * Float64(t_2 * Float64(Float64(D / d) * Float64(D / d)))); elseif ((h <= 420000000000.0) || !(h <= 5e+88)) tmp = Float64(d * Float64(Float64(d / D) * Float64(Float64(c0 / h) * Float64(Float64(c0 / Float64(w * w)) / D)))); else tmp = t_1; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = d * (d / D); t_1 = 0.25 * (D * (D / (d / (h / (d / (M * M)))))); t_2 = h * (M * M); tmp = 0.0; if (h <= -6.8e-19) tmp = t_1; elseif (h <= -1.6e-224) tmp = t_0 * (((c0 / w) * ((c0 / h) / w)) / D); elseif (h <= 5.5e-200) tmp = 0.25 * (D / ((d * (d / t_2)) / D)); elseif (h <= 7.6e-140) tmp = t_0 * ((c0 * c0) / (D * (w * (w * h)))); elseif (h <= 4.5e-8) tmp = 0.25 * (t_2 * ((D / d) * (D / d))); elseif ((h <= 420000000000.0) || ~((h <= 5e+88))) tmp = d * ((d / D) * ((c0 / h) * ((c0 / (w * w)) / D))); else tmp = t_1; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.25 * N[(D * N[(D / N[(d / N[(h / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -6.8e-19], t$95$1, If[LessEqual[h, -1.6e-224], N[(t$95$0 * N[(N[(N[(c0 / w), $MachinePrecision] * N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5.5e-200], N[(0.25 * N[(D / N[(N[(d * N[(d / t$95$2), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 7.6e-140], N[(t$95$0 * N[(N[(c0 * c0), $MachinePrecision] / N[(D * N[(w * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 4.5e-8], N[(0.25 * N[(t$95$2 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[h, 420000000000.0], N[Not[LessEqual[h, 5e+88]], $MachinePrecision]], N[(d * N[(N[(d / D), $MachinePrecision] * N[(N[(c0 / h), $MachinePrecision] * N[(N[(c0 / N[(w * w), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d \cdot \frac{d}{D}\\
t_1 := 0.25 \cdot \left(D \cdot \frac{D}{\frac{d}{\frac{h}{\frac{d}{M \cdot M}}}}\right)\\
t_2 := h \cdot \left(M \cdot M\right)\\
\mathbf{if}\;h \leq -6.8 \cdot 10^{-19}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;h \leq -1.6 \cdot 10^{-224}:\\
\;\;\;\;t_0 \cdot \frac{\frac{c0}{w} \cdot \frac{\frac{c0}{h}}{w}}{D}\\
\mathbf{elif}\;h \leq 5.5 \cdot 10^{-200}:\\
\;\;\;\;0.25 \cdot \frac{D}{\frac{d \cdot \frac{d}{t_2}}{D}}\\
\mathbf{elif}\;h \leq 7.6 \cdot 10^{-140}:\\
\;\;\;\;t_0 \cdot \frac{c0 \cdot c0}{D \cdot \left(w \cdot \left(w \cdot h\right)\right)}\\
\mathbf{elif}\;h \leq 4.5 \cdot 10^{-8}:\\
\;\;\;\;0.25 \cdot \left(t_2 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\
\mathbf{elif}\;h \leq 420000000000 \lor \neg \left(h \leq 5 \cdot 10^{+88}\right):\\
\;\;\;\;d \cdot \left(\frac{d}{D} \cdot \left(\frac{c0}{h} \cdot \frac{\frac{c0}{w \cdot w}}{D}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if h < -6.8000000000000004e-19 or 4.2e11 < h < 4.99999999999999997e88Initial program 12.2%
Taylor expanded in c0 around -inf 7.7%
fma-def7.7%
associate-/l*7.7%
unpow27.7%
unpow27.7%
*-commutative7.7%
unpow27.7%
associate-*r*7.7%
Simplified33.7%
Taylor expanded in c0 around 0 42.9%
associate-/l*42.8%
*-commutative42.8%
unpow242.8%
unpow242.8%
*-commutative42.8%
unpow242.8%
Simplified42.8%
*-un-lft-identity42.8%
associate-/l*46.1%
associate-/l*57.1%
Applied egg-rr57.1%
*-lft-identity57.1%
associate-/r/57.1%
unpow257.1%
associate-/l*63.0%
unpow263.0%
Simplified63.0%
if -6.8000000000000004e-19 < h < -1.5999999999999999e-224Initial program 34.9%
times-frac34.9%
fma-def34.9%
times-frac35.1%
difference-of-squares46.0%
Simplified44.6%
*-un-lft-identity44.6%
associate-*l*44.6%
div-inv44.6%
clear-num44.6%
associate-*r/46.0%
*-commutative46.0%
times-frac46.1%
frac-times52.1%
pow252.1%
Applied egg-rr52.1%
*-lft-identity52.1%
*-commutative52.1%
associate-*l/52.1%
associate-/l*52.1%
*-commutative52.1%
Simplified52.1%
Taylor expanded in c0 around inf 33.3%
times-frac34.8%
unpow234.8%
unpow234.8%
unpow234.8%
unpow234.8%
Simplified34.8%
associate-*l/33.4%
times-frac38.2%
Applied egg-rr38.2%
unpow238.2%
times-frac49.2%
unpow249.2%
associate-*r/50.8%
Simplified50.8%
associate-*l/46.0%
Applied egg-rr46.0%
times-frac60.3%
Simplified60.3%
if -1.5999999999999999e-224 < h < 5.4999999999999996e-200Initial program 15.5%
Taylor expanded in c0 around -inf 1.9%
fma-def1.9%
associate-/l*1.9%
unpow21.9%
unpow21.9%
*-commutative1.9%
unpow21.9%
associate-*r*1.9%
Simplified36.4%
Taylor expanded in c0 around 0 43.5%
associate-/l*44.2%
*-commutative44.2%
unpow244.2%
unpow244.2%
*-commutative44.2%
unpow244.2%
Simplified44.2%
*-un-lft-identity44.2%
associate-/l*46.3%
associate-/l*52.4%
Applied egg-rr52.4%
*-lft-identity52.4%
associate-/r/52.4%
Simplified52.4%
if 5.4999999999999996e-200 < h < 7.59999999999999997e-140Initial program 38.6%
times-frac38.6%
fma-def38.6%
times-frac38.6%
difference-of-squares54.0%
Simplified54.0%
*-un-lft-identity54.0%
associate-*l*54.0%
div-inv54.0%
clear-num54.0%
associate-*r/54.0%
*-commutative54.0%
times-frac61.7%
frac-times77.0%
pow277.0%
Applied egg-rr77.0%
*-lft-identity77.0%
*-commutative77.0%
associate-*l/77.0%
associate-/l*77.0%
*-commutative77.0%
Simplified77.0%
Taylor expanded in c0 around inf 61.7%
times-frac61.7%
unpow261.7%
unpow261.7%
unpow261.7%
unpow261.7%
Simplified61.7%
associate-*l/61.7%
times-frac61.7%
Applied egg-rr61.7%
unpow261.7%
times-frac61.7%
unpow261.7%
associate-*r/77.0%
Simplified77.0%
Taylor expanded in c0 around 0 77.0%
unpow277.0%
unpow277.0%
associate-*l*84.7%
Simplified84.7%
if 7.59999999999999997e-140 < h < 4.49999999999999993e-8Initial program 19.8%
Taylor expanded in c0 around -inf 11.2%
fma-def11.2%
associate-/l*7.6%
unpow27.6%
unpow27.6%
*-commutative7.6%
unpow27.6%
associate-*r*7.6%
Simplified31.5%
Taylor expanded in c0 around 0 51.0%
associate-/l*50.9%
*-commutative50.9%
unpow250.9%
unpow250.9%
*-commutative50.9%
unpow250.9%
Simplified50.9%
associate-/r/50.8%
times-frac58.4%
Applied egg-rr58.4%
if 4.49999999999999993e-8 < h < 4.2e11 or 4.99999999999999997e88 < h Initial program 50.5%
times-frac50.4%
fma-def50.4%
times-frac50.4%
difference-of-squares59.2%
Simplified59.2%
*-un-lft-identity59.2%
associate-*l*59.2%
div-inv59.2%
clear-num59.2%
associate-*r/59.2%
*-commutative59.2%
times-frac59.2%
frac-times68.4%
pow268.4%
Applied egg-rr68.4%
*-lft-identity68.4%
*-commutative68.4%
associate-*l/68.3%
associate-/l*68.3%
*-commutative68.3%
Simplified68.3%
Taylor expanded in c0 around inf 59.0%
times-frac65.1%
unpow265.1%
unpow265.1%
unpow265.1%
unpow265.1%
Simplified65.1%
associate-*l/62.3%
times-frac62.3%
Applied egg-rr62.3%
unpow262.3%
times-frac68.1%
unpow268.1%
associate-*r/71.1%
Simplified71.1%
pow171.1%
associate-*l*74.3%
associate-/l*71.4%
Applied egg-rr71.4%
unpow171.4%
associate-/r/74.3%
Simplified74.3%
Final simplification62.3%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* d (/ d D)))
(t_1 (* 0.25 (* D (/ D (/ d (/ h (/ d (* M M))))))))
(t_2 (* h (* M M))))
(if (<= h -1.8e-20)
t_1
(if (<= h -7e-223)
(* t_0 (/ (* (/ c0 w) (/ (/ c0 h) w)) D))
(if (<= h 9e-207)
(* 0.25 (/ D (/ (* d (/ d t_2)) D)))
(if (<= h 8.4e-140)
(* t_0 (/ (* c0 c0) (* D (* w (* w h)))))
(if (<= h 1.25e-5)
(* 0.25 (* t_2 (* (/ D d) (/ D d))))
(if (<= h 450000000000.0)
(* (* (/ d D) (/ d D)) (/ (* c0 c0) (* h (* w w))))
(if (<= h 5.2e+88)
t_1
(* d (* (/ d D) (* (/ c0 h) (/ (/ c0 (* w w)) D)))))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = d * (d / D);
double t_1 = 0.25 * (D * (D / (d / (h / (d / (M * M))))));
double t_2 = h * (M * M);
double tmp;
if (h <= -1.8e-20) {
tmp = t_1;
} else if (h <= -7e-223) {
tmp = t_0 * (((c0 / w) * ((c0 / h) / w)) / D);
} else if (h <= 9e-207) {
tmp = 0.25 * (D / ((d * (d / t_2)) / D));
} else if (h <= 8.4e-140) {
tmp = t_0 * ((c0 * c0) / (D * (w * (w * h))));
} else if (h <= 1.25e-5) {
tmp = 0.25 * (t_2 * ((D / d) * (D / d)));
} else if (h <= 450000000000.0) {
tmp = ((d / D) * (d / D)) * ((c0 * c0) / (h * (w * w)));
} else if (h <= 5.2e+88) {
tmp = t_1;
} else {
tmp = d * ((d / D) * ((c0 / h) * ((c0 / (w * w)) / 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d_1 * (d_1 / d)
t_1 = 0.25d0 * (d * (d / (d_1 / (h / (d_1 / (m * m))))))
t_2 = h * (m * m)
if (h <= (-1.8d-20)) then
tmp = t_1
else if (h <= (-7d-223)) then
tmp = t_0 * (((c0 / w) * ((c0 / h) / w)) / d)
else if (h <= 9d-207) then
tmp = 0.25d0 * (d / ((d_1 * (d_1 / t_2)) / d))
else if (h <= 8.4d-140) then
tmp = t_0 * ((c0 * c0) / (d * (w * (w * h))))
else if (h <= 1.25d-5) then
tmp = 0.25d0 * (t_2 * ((d / d_1) * (d / d_1)))
else if (h <= 450000000000.0d0) then
tmp = ((d_1 / d) * (d_1 / d)) * ((c0 * c0) / (h * (w * w)))
else if (h <= 5.2d+88) then
tmp = t_1
else
tmp = d_1 * ((d_1 / d) * ((c0 / h) * ((c0 / (w * w)) / d)))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = d * (d / D);
double t_1 = 0.25 * (D * (D / (d / (h / (d / (M * M))))));
double t_2 = h * (M * M);
double tmp;
if (h <= -1.8e-20) {
tmp = t_1;
} else if (h <= -7e-223) {
tmp = t_0 * (((c0 / w) * ((c0 / h) / w)) / D);
} else if (h <= 9e-207) {
tmp = 0.25 * (D / ((d * (d / t_2)) / D));
} else if (h <= 8.4e-140) {
tmp = t_0 * ((c0 * c0) / (D * (w * (w * h))));
} else if (h <= 1.25e-5) {
tmp = 0.25 * (t_2 * ((D / d) * (D / d)));
} else if (h <= 450000000000.0) {
tmp = ((d / D) * (d / D)) * ((c0 * c0) / (h * (w * w)));
} else if (h <= 5.2e+88) {
tmp = t_1;
} else {
tmp = d * ((d / D) * ((c0 / h) * ((c0 / (w * w)) / D)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = d * (d / D) t_1 = 0.25 * (D * (D / (d / (h / (d / (M * M)))))) t_2 = h * (M * M) tmp = 0 if h <= -1.8e-20: tmp = t_1 elif h <= -7e-223: tmp = t_0 * (((c0 / w) * ((c0 / h) / w)) / D) elif h <= 9e-207: tmp = 0.25 * (D / ((d * (d / t_2)) / D)) elif h <= 8.4e-140: tmp = t_0 * ((c0 * c0) / (D * (w * (w * h)))) elif h <= 1.25e-5: tmp = 0.25 * (t_2 * ((D / d) * (D / d))) elif h <= 450000000000.0: tmp = ((d / D) * (d / D)) * ((c0 * c0) / (h * (w * w))) elif h <= 5.2e+88: tmp = t_1 else: tmp = d * ((d / D) * ((c0 / h) * ((c0 / (w * w)) / D))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(d * Float64(d / D)) t_1 = Float64(0.25 * Float64(D * Float64(D / Float64(d / Float64(h / Float64(d / Float64(M * M))))))) t_2 = Float64(h * Float64(M * M)) tmp = 0.0 if (h <= -1.8e-20) tmp = t_1; elseif (h <= -7e-223) tmp = Float64(t_0 * Float64(Float64(Float64(c0 / w) * Float64(Float64(c0 / h) / w)) / D)); elseif (h <= 9e-207) tmp = Float64(0.25 * Float64(D / Float64(Float64(d * Float64(d / t_2)) / D))); elseif (h <= 8.4e-140) tmp = Float64(t_0 * Float64(Float64(c0 * c0) / Float64(D * Float64(w * Float64(w * h))))); elseif (h <= 1.25e-5) tmp = Float64(0.25 * Float64(t_2 * Float64(Float64(D / d) * Float64(D / d)))); elseif (h <= 450000000000.0) tmp = Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(Float64(c0 * c0) / Float64(h * Float64(w * w)))); elseif (h <= 5.2e+88) tmp = t_1; else tmp = Float64(d * Float64(Float64(d / D) * Float64(Float64(c0 / h) * Float64(Float64(c0 / Float64(w * w)) / D)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = d * (d / D); t_1 = 0.25 * (D * (D / (d / (h / (d / (M * M)))))); t_2 = h * (M * M); tmp = 0.0; if (h <= -1.8e-20) tmp = t_1; elseif (h <= -7e-223) tmp = t_0 * (((c0 / w) * ((c0 / h) / w)) / D); elseif (h <= 9e-207) tmp = 0.25 * (D / ((d * (d / t_2)) / D)); elseif (h <= 8.4e-140) tmp = t_0 * ((c0 * c0) / (D * (w * (w * h)))); elseif (h <= 1.25e-5) tmp = 0.25 * (t_2 * ((D / d) * (D / d))); elseif (h <= 450000000000.0) tmp = ((d / D) * (d / D)) * ((c0 * c0) / (h * (w * w))); elseif (h <= 5.2e+88) tmp = t_1; else tmp = d * ((d / D) * ((c0 / h) * ((c0 / (w * w)) / D))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.25 * N[(D * N[(D / N[(d / N[(h / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.8e-20], t$95$1, If[LessEqual[h, -7e-223], N[(t$95$0 * N[(N[(N[(c0 / w), $MachinePrecision] * N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 9e-207], N[(0.25 * N[(D / N[(N[(d * N[(d / t$95$2), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 8.4e-140], N[(t$95$0 * N[(N[(c0 * c0), $MachinePrecision] / N[(D * N[(w * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.25e-5], N[(0.25 * N[(t$95$2 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 450000000000.0], N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * c0), $MachinePrecision] / N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5.2e+88], t$95$1, N[(d * N[(N[(d / D), $MachinePrecision] * N[(N[(c0 / h), $MachinePrecision] * N[(N[(c0 / N[(w * w), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d \cdot \frac{d}{D}\\
t_1 := 0.25 \cdot \left(D \cdot \frac{D}{\frac{d}{\frac{h}{\frac{d}{M \cdot M}}}}\right)\\
t_2 := h \cdot \left(M \cdot M\right)\\
\mathbf{if}\;h \leq -1.8 \cdot 10^{-20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;h \leq -7 \cdot 10^{-223}:\\
\;\;\;\;t_0 \cdot \frac{\frac{c0}{w} \cdot \frac{\frac{c0}{h}}{w}}{D}\\
\mathbf{elif}\;h \leq 9 \cdot 10^{-207}:\\
\;\;\;\;0.25 \cdot \frac{D}{\frac{d \cdot \frac{d}{t_2}}{D}}\\
\mathbf{elif}\;h \leq 8.4 \cdot 10^{-140}:\\
\;\;\;\;t_0 \cdot \frac{c0 \cdot c0}{D \cdot \left(w \cdot \left(w \cdot h\right)\right)}\\
\mathbf{elif}\;h \leq 1.25 \cdot 10^{-5}:\\
\;\;\;\;0.25 \cdot \left(t_2 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\
\mathbf{elif}\;h \leq 450000000000:\\
\;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\
\mathbf{elif}\;h \leq 5.2 \cdot 10^{+88}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left(\frac{d}{D} \cdot \left(\frac{c0}{h} \cdot \frac{\frac{c0}{w \cdot w}}{D}\right)\right)\\
\end{array}
\end{array}
if h < -1.79999999999999987e-20 or 4.5e11 < h < 5.2000000000000001e88Initial program 12.2%
Taylor expanded in c0 around -inf 7.7%
fma-def7.7%
associate-/l*7.7%
unpow27.7%
unpow27.7%
*-commutative7.7%
unpow27.7%
associate-*r*7.7%
Simplified33.7%
Taylor expanded in c0 around 0 42.9%
associate-/l*42.8%
*-commutative42.8%
unpow242.8%
unpow242.8%
*-commutative42.8%
unpow242.8%
Simplified42.8%
*-un-lft-identity42.8%
associate-/l*46.1%
associate-/l*57.1%
Applied egg-rr57.1%
*-lft-identity57.1%
associate-/r/57.1%
unpow257.1%
associate-/l*63.0%
unpow263.0%
Simplified63.0%
if -1.79999999999999987e-20 < h < -7.00000000000000018e-223Initial program 34.9%
times-frac34.9%
fma-def34.9%
times-frac35.1%
difference-of-squares46.0%
Simplified44.6%
*-un-lft-identity44.6%
associate-*l*44.6%
div-inv44.6%
clear-num44.6%
associate-*r/46.0%
*-commutative46.0%
times-frac46.1%
frac-times52.1%
pow252.1%
Applied egg-rr52.1%
*-lft-identity52.1%
*-commutative52.1%
associate-*l/52.1%
associate-/l*52.1%
*-commutative52.1%
Simplified52.1%
Taylor expanded in c0 around inf 33.3%
times-frac34.8%
unpow234.8%
unpow234.8%
unpow234.8%
unpow234.8%
Simplified34.8%
associate-*l/33.4%
times-frac38.2%
Applied egg-rr38.2%
unpow238.2%
times-frac49.2%
unpow249.2%
associate-*r/50.8%
Simplified50.8%
associate-*l/46.0%
Applied egg-rr46.0%
times-frac60.3%
Simplified60.3%
if -7.00000000000000018e-223 < h < 8.99999999999999984e-207Initial program 15.5%
Taylor expanded in c0 around -inf 1.9%
fma-def1.9%
associate-/l*1.9%
unpow21.9%
unpow21.9%
*-commutative1.9%
unpow21.9%
associate-*r*1.9%
Simplified36.4%
Taylor expanded in c0 around 0 43.5%
associate-/l*44.2%
*-commutative44.2%
unpow244.2%
unpow244.2%
*-commutative44.2%
unpow244.2%
Simplified44.2%
*-un-lft-identity44.2%
associate-/l*46.3%
associate-/l*52.4%
Applied egg-rr52.4%
*-lft-identity52.4%
associate-/r/52.4%
Simplified52.4%
if 8.99999999999999984e-207 < h < 8.4000000000000007e-140Initial program 38.6%
times-frac38.6%
fma-def38.6%
times-frac38.6%
difference-of-squares54.0%
Simplified54.0%
*-un-lft-identity54.0%
associate-*l*54.0%
div-inv54.0%
clear-num54.0%
associate-*r/54.0%
*-commutative54.0%
times-frac61.7%
frac-times77.0%
pow277.0%
Applied egg-rr77.0%
*-lft-identity77.0%
*-commutative77.0%
associate-*l/77.0%
associate-/l*77.0%
*-commutative77.0%
Simplified77.0%
Taylor expanded in c0 around inf 61.7%
times-frac61.7%
unpow261.7%
unpow261.7%
unpow261.7%
unpow261.7%
Simplified61.7%
associate-*l/61.7%
times-frac61.7%
Applied egg-rr61.7%
unpow261.7%
times-frac61.7%
unpow261.7%
associate-*r/77.0%
Simplified77.0%
Taylor expanded in c0 around 0 77.0%
unpow277.0%
unpow277.0%
associate-*l*84.7%
Simplified84.7%
if 8.4000000000000007e-140 < h < 1.25000000000000006e-5Initial program 19.8%
Taylor expanded in c0 around -inf 11.2%
fma-def11.2%
associate-/l*7.6%
unpow27.6%
unpow27.6%
*-commutative7.6%
unpow27.6%
associate-*r*7.6%
Simplified31.5%
Taylor expanded in c0 around 0 51.0%
associate-/l*50.9%
*-commutative50.9%
unpow250.9%
unpow250.9%
*-commutative50.9%
unpow250.9%
Simplified50.9%
associate-/r/50.8%
times-frac58.4%
Applied egg-rr58.4%
if 1.25000000000000006e-5 < h < 4.5e11Initial program 71.4%
times-frac71.4%
fma-def71.4%
times-frac71.4%
difference-of-squares71.4%
Simplified71.4%
*-un-lft-identity71.4%
associate-*l*71.4%
div-inv71.4%
clear-num71.4%
associate-*r/71.4%
*-commutative71.4%
times-frac71.4%
frac-times87.4%
pow287.4%
Applied egg-rr87.4%
*-lft-identity87.4%
*-commutative87.4%
associate-*l/87.4%
associate-/l*87.4%
*-commutative87.4%
Simplified87.4%
Taylor expanded in c0 around inf 42.9%
times-frac71.4%
unpow271.4%
unpow271.4%
unpow271.4%
unpow271.4%
Simplified71.4%
frac-times86.2%
Applied egg-rr86.2%
if 5.2000000000000001e88 < h Initial program 45.0%
times-frac44.9%
fma-def44.9%
times-frac44.9%
difference-of-squares56.0%
Simplified56.0%
*-un-lft-identity56.0%
associate-*l*56.0%
div-inv56.0%
clear-num56.0%
associate-*r/56.0%
*-commutative56.0%
times-frac56.0%
frac-times63.4%
pow263.4%
Applied egg-rr63.4%
*-lft-identity63.4%
*-commutative63.4%
associate-*l/63.4%
associate-/l*63.4%
*-commutative63.4%
Simplified63.4%
Taylor expanded in c0 around inf 63.2%
times-frac63.5%
unpow263.5%
unpow263.5%
unpow263.5%
unpow263.5%
Simplified63.5%
associate-*l/60.0%
times-frac60.0%
Applied egg-rr60.0%
unpow260.0%
times-frac67.3%
unpow267.3%
associate-*r/67.3%
Simplified67.3%
pow167.3%
associate-*l*71.3%
associate-/l*67.5%
Applied egg-rr67.5%
unpow167.5%
associate-/r/71.2%
Simplified71.2%
Final simplification62.3%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ d (* M M)))
(t_1 (* d (* (/ d D) (* (/ c0 h) (/ (/ c0 (* w w)) D)))))
(t_2 (* 0.25 (* D (/ D (/ d (/ h t_0)))))))
(if (<= w -2.2e-130)
t_2
(if (<= w -1.26e-222)
t_1
(if (<= w 1.25e-275)
(/ (* (* D D) 0.25) (* t_0 (/ d h)))
(if (<= w 2.55e+16) t_1 t_2))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = d / (M * M);
double t_1 = d * ((d / D) * ((c0 / h) * ((c0 / (w * w)) / D)));
double t_2 = 0.25 * (D * (D / (d / (h / t_0))));
double tmp;
if (w <= -2.2e-130) {
tmp = t_2;
} else if (w <= -1.26e-222) {
tmp = t_1;
} else if (w <= 1.25e-275) {
tmp = ((D * D) * 0.25) / (t_0 * (d / h));
} else if (w <= 2.55e+16) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d_1 / (m * m)
t_1 = d_1 * ((d_1 / d) * ((c0 / h) * ((c0 / (w * w)) / d)))
t_2 = 0.25d0 * (d * (d / (d_1 / (h / t_0))))
if (w <= (-2.2d-130)) then
tmp = t_2
else if (w <= (-1.26d-222)) then
tmp = t_1
else if (w <= 1.25d-275) then
tmp = ((d * d) * 0.25d0) / (t_0 * (d_1 / h))
else if (w <= 2.55d+16) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = d / (M * M);
double t_1 = d * ((d / D) * ((c0 / h) * ((c0 / (w * w)) / D)));
double t_2 = 0.25 * (D * (D / (d / (h / t_0))));
double tmp;
if (w <= -2.2e-130) {
tmp = t_2;
} else if (w <= -1.26e-222) {
tmp = t_1;
} else if (w <= 1.25e-275) {
tmp = ((D * D) * 0.25) / (t_0 * (d / h));
} else if (w <= 2.55e+16) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = d / (M * M) t_1 = d * ((d / D) * ((c0 / h) * ((c0 / (w * w)) / D))) t_2 = 0.25 * (D * (D / (d / (h / t_0)))) tmp = 0 if w <= -2.2e-130: tmp = t_2 elif w <= -1.26e-222: tmp = t_1 elif w <= 1.25e-275: tmp = ((D * D) * 0.25) / (t_0 * (d / h)) elif w <= 2.55e+16: tmp = t_1 else: tmp = t_2 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(d / Float64(M * M)) t_1 = Float64(d * Float64(Float64(d / D) * Float64(Float64(c0 / h) * Float64(Float64(c0 / Float64(w * w)) / D)))) t_2 = Float64(0.25 * Float64(D * Float64(D / Float64(d / Float64(h / t_0))))) tmp = 0.0 if (w <= -2.2e-130) tmp = t_2; elseif (w <= -1.26e-222) tmp = t_1; elseif (w <= 1.25e-275) tmp = Float64(Float64(Float64(D * D) * 0.25) / Float64(t_0 * Float64(d / h))); elseif (w <= 2.55e+16) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = d / (M * M); t_1 = d * ((d / D) * ((c0 / h) * ((c0 / (w * w)) / D))); t_2 = 0.25 * (D * (D / (d / (h / t_0)))); tmp = 0.0; if (w <= -2.2e-130) tmp = t_2; elseif (w <= -1.26e-222) tmp = t_1; elseif (w <= 1.25e-275) tmp = ((D * D) * 0.25) / (t_0 * (d / h)); elseif (w <= 2.55e+16) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d * N[(N[(d / D), $MachinePrecision] * N[(N[(c0 / h), $MachinePrecision] * N[(N[(c0 / N[(w * w), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.25 * N[(D * N[(D / N[(d / N[(h / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -2.2e-130], t$95$2, If[LessEqual[w, -1.26e-222], t$95$1, If[LessEqual[w, 1.25e-275], N[(N[(N[(D * D), $MachinePrecision] * 0.25), $MachinePrecision] / N[(t$95$0 * N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, 2.55e+16], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{d}{M \cdot M}\\
t_1 := d \cdot \left(\frac{d}{D} \cdot \left(\frac{c0}{h} \cdot \frac{\frac{c0}{w \cdot w}}{D}\right)\right)\\
t_2 := 0.25 \cdot \left(D \cdot \frac{D}{\frac{d}{\frac{h}{t_0}}}\right)\\
\mathbf{if}\;w \leq -2.2 \cdot 10^{-130}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;w \leq -1.26 \cdot 10^{-222}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;w \leq 1.25 \cdot 10^{-275}:\\
\;\;\;\;\frac{\left(D \cdot D\right) \cdot 0.25}{t_0 \cdot \frac{d}{h}}\\
\mathbf{elif}\;w \leq 2.55 \cdot 10^{+16}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if w < -2.1999999999999999e-130 or 2.55e16 < w Initial program 13.6%
Taylor expanded in c0 around -inf 6.1%
fma-def6.1%
associate-/l*5.3%
unpow25.3%
unpow25.3%
*-commutative5.3%
unpow25.3%
associate-*r*5.3%
Simplified31.8%
Taylor expanded in c0 around 0 39.3%
associate-/l*39.6%
*-commutative39.6%
unpow239.6%
unpow239.6%
*-commutative39.6%
unpow239.6%
Simplified39.6%
*-un-lft-identity39.6%
associate-/l*46.0%
associate-/l*53.7%
Applied egg-rr53.7%
*-lft-identity53.7%
associate-/r/53.7%
unpow253.7%
associate-/l*56.5%
unpow256.5%
Simplified56.5%
if -2.1999999999999999e-130 < w < -1.25999999999999997e-222 or 1.24999999999999996e-275 < w < 2.55e16Initial program 42.1%
times-frac40.2%
fma-def40.2%
times-frac40.2%
difference-of-squares46.2%
Simplified46.2%
*-un-lft-identity46.2%
associate-*l*46.2%
div-inv46.2%
clear-num46.2%
associate-*r/46.2%
*-commutative46.2%
times-frac46.2%
frac-times52.3%
pow252.3%
Applied egg-rr52.3%
*-lft-identity52.3%
*-commutative52.3%
associate-*l/52.2%
associate-/l*52.3%
*-commutative52.3%
Simplified52.3%
Taylor expanded in c0 around inf 41.6%
times-frac41.6%
unpow241.6%
unpow241.6%
unpow241.6%
unpow241.6%
Simplified41.6%
associate-*l/41.7%
times-frac48.7%
Applied egg-rr48.7%
unpow248.7%
times-frac53.8%
unpow253.8%
associate-*r/55.8%
Simplified55.8%
pow155.8%
associate-*l*57.9%
associate-/l*57.8%
Applied egg-rr57.8%
unpow157.8%
associate-/r/57.9%
Simplified57.9%
if -1.25999999999999997e-222 < w < 1.24999999999999996e-275Initial program 20.2%
Taylor expanded in c0 around -inf 2.5%
fma-def2.5%
associate-/l*2.5%
unpow22.5%
unpow22.5%
*-commutative2.5%
unpow22.5%
associate-*r*2.5%
Simplified30.4%
add-cbrt-cube30.4%
associate-/r/22.9%
*-commutative22.9%
associate-/r/22.9%
*-commutative22.9%
associate-/r/22.9%
Applied egg-rr22.9%
associate-*l*22.9%
cube-unmult22.9%
*-commutative22.9%
unpow222.9%
times-frac20.6%
unpow220.6%
Simplified20.6%
Taylor expanded in c0 around 0 43.4%
associate-/l*43.3%
associate-*r/43.3%
unpow243.3%
*-commutative43.3%
associate-/r*45.8%
unpow245.8%
associate-*r/55.9%
unpow255.9%
associate-*l/58.2%
Simplified58.2%
Final simplification57.3%
(FPCore (c0 w h D d M) :precision binary64 (if (<= d 1.45e+248) (* 0.25 (* (* h (* M M)) (/ (/ (* D D) d) d))) 0.0))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (d <= 1.45e+248) {
tmp = 0.25 * ((h * (M * M)) * (((D * 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 <= 1.45d+248) then
tmp = 0.25d0 * ((h * (m * m)) * (((d * 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 <= 1.45e+248) {
tmp = 0.25 * ((h * (M * M)) * (((D * D) / d) / d));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if d <= 1.45e+248: tmp = 0.25 * ((h * (M * M)) * (((D * D) / d) / d)) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (d <= 1.45e+248) tmp = Float64(0.25 * Float64(Float64(h * Float64(M * M)) * Float64(Float64(Float64(D * D) / 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 <= 1.45e+248) tmp = 0.25 * ((h * (M * M)) * (((D * D) / d) / d)); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[d, 1.45e+248], N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.45 \cdot 10^{+248}:\\
\;\;\;\;0.25 \cdot \left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \frac{\frac{D \cdot D}{d}}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if d < 1.45e248Initial program 24.9%
Taylor expanded in c0 around -inf 4.8%
fma-def4.8%
associate-/l*4.4%
unpow24.4%
unpow24.4%
*-commutative4.4%
unpow24.4%
associate-*r*4.4%
Simplified28.2%
Taylor expanded in c0 around 0 36.3%
associate-/l*36.5%
*-commutative36.5%
unpow236.5%
unpow236.5%
*-commutative36.5%
unpow236.5%
Simplified36.5%
associate-/r/35.2%
times-frac42.0%
Applied egg-rr42.0%
*-commutative42.0%
associate-*l/42.0%
associate-*r/41.5%
Simplified41.5%
if 1.45e248 < d Initial program 34.8%
times-frac34.8%
fma-def34.8%
associate-/r*34.8%
difference-of-squares43.5%
Simplified48.0%
Taylor expanded in c0 around -inf 0.0%
associate-*r*0.0%
distribute-rgt1-in0.0%
metadata-eval0.0%
mul0-lft39.9%
metadata-eval39.9%
mul0-lft0.0%
metadata-eval0.0%
distribute-lft1-in0.0%
*-commutative0.0%
distribute-lft1-in0.0%
metadata-eval0.0%
mul0-lft39.9%
Simplified39.9%
Taylor expanded in c0 around 0 44.5%
Final simplification41.8%
(FPCore (c0 w h D d M) :precision binary64 (if (<= d 9.5e+212) (* 0.25 (* (* h (* M M)) (* (/ D d) (/ D d)))) 0.0))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (d <= 9.5e+212) {
tmp = 0.25 * ((h * (M * M)) * ((D / 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 <= 9.5d+212) then
tmp = 0.25d0 * ((h * (m * m)) * ((d / d_1) * (d / 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 <= 9.5e+212) {
tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if d <= 9.5e+212: tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (d <= 9.5e+212) tmp = Float64(0.25 * Float64(Float64(h * Float64(M * M)) * Float64(Float64(D / 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 <= 9.5e+212) tmp = 0.25 * ((h * (M * M)) * ((D / d) * (D / d))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[d, 9.5e+212], N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 9.5 \cdot 10^{+212}:\\
\;\;\;\;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\\
\end{array}
\end{array}
if d < 9.4999999999999993e212Initial program 23.8%
Taylor expanded in c0 around -inf 5.2%
fma-def5.2%
associate-/l*4.7%
unpow24.7%
unpow24.7%
*-commutative4.7%
unpow24.7%
associate-*r*4.7%
Simplified28.7%
Taylor expanded in c0 around 0 36.5%
associate-/l*36.6%
*-commutative36.6%
unpow236.6%
unpow236.6%
*-commutative36.6%
unpow236.6%
Simplified36.6%
associate-/r/35.2%
times-frac42.1%
Applied egg-rr42.1%
if 9.4999999999999993e212 < d Initial program 36.8%
times-frac36.8%
fma-def36.8%
associate-/r*36.8%
difference-of-squares42.1%
Simplified47.5%
Taylor expanded in c0 around -inf 0.0%
associate-*r*0.0%
distribute-rgt1-in0.0%
metadata-eval0.0%
mul0-lft35.0%
metadata-eval35.0%
mul0-lft0.0%
metadata-eval0.0%
distribute-lft1-in0.0%
*-commutative0.0%
distribute-lft1-in0.0%
metadata-eval0.0%
mul0-lft35.0%
Simplified35.0%
Taylor expanded in c0 around 0 43.1%
Final simplification42.3%
(FPCore (c0 w h D d M) :precision binary64 (* 0.25 (* D (/ D (/ d (/ h (/ d (* M M))))))))
double code(double c0, double w, double h, double D, double d, double M) {
return 0.25 * (D * (D / (d / (h / (d / (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
code = 0.25d0 * (d * (d / (d_1 / (h / (d_1 / (m * m))))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return 0.25 * (D * (D / (d / (h / (d / (M * M))))));
}
def code(c0, w, h, D, d, M): return 0.25 * (D * (D / (d / (h / (d / (M * M))))))
function code(c0, w, h, D, d, M) return Float64(0.25 * Float64(D * Float64(D / Float64(d / Float64(h / Float64(d / Float64(M * M))))))) end
function tmp = code(c0, w, h, D, d, M) tmp = 0.25 * (D * (D / (d / (h / (d / (M * M)))))); end
code[c0_, w_, h_, D_, d_, M_] := N[(0.25 * N[(D * N[(D / N[(d / N[(h / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.25 \cdot \left(D \cdot \frac{D}{\frac{d}{\frac{h}{\frac{d}{M \cdot M}}}}\right)
\end{array}
Initial program 25.8%
Taylor expanded in c0 around -inf 4.4%
fma-def4.4%
associate-/l*4.0%
unpow24.0%
unpow24.0%
*-commutative4.0%
unpow24.0%
associate-*r*4.0%
Simplified26.8%
Taylor expanded in c0 around 0 35.1%
associate-/l*35.2%
*-commutative35.2%
unpow235.2%
unpow235.2%
*-commutative35.2%
unpow235.2%
Simplified35.2%
*-un-lft-identity35.2%
associate-/l*39.8%
associate-/l*47.4%
Applied egg-rr47.4%
*-lft-identity47.4%
associate-/r/47.4%
unpow247.4%
associate-/l*48.7%
unpow248.7%
Simplified48.7%
Final simplification48.7%
(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 25.8%
times-frac25.0%
fma-def25.0%
associate-/r*25.0%
difference-of-squares31.3%
Simplified37.2%
Taylor expanded in c0 around -inf 3.0%
associate-*r*3.0%
distribute-rgt1-in3.0%
metadata-eval3.0%
mul0-lft31.3%
metadata-eval31.3%
mul0-lft2.9%
metadata-eval2.9%
distribute-lft1-in2.9%
*-commutative2.9%
distribute-lft1-in2.9%
metadata-eval2.9%
mul0-lft31.3%
Simplified31.3%
Taylor expanded in c0 around 0 36.3%
Final simplification36.3%
herbie shell --seed 2023242
(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))))))