
(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 (pow (/ d D) 2.0))
(t_2 (* t_0 (* (/ 2.0 w) (* t_1 (/ c0 h))))))
(if (<= (* M M) 1.4e-172)
0.0
(if (<= (* M M) 3.4e-121)
t_2
(if (<= (* M M) 3e-73)
0.0
(if (<= (* M M) 1.1e+54)
t_2
(if (<= (* M M) 7.5e+105)
(* (/ (* M M) (* c0 (* (/ t_1 (* w h)) -2.0))) (- t_0))
(/ (* c0 (* 2.0 (* t_1 (/ c0 (* w h))))) (* 2.0 w)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = pow((d / D), 2.0);
double t_2 = t_0 * ((2.0 / w) * (t_1 * (c0 / h)));
double tmp;
if ((M * M) <= 1.4e-172) {
tmp = 0.0;
} else if ((M * M) <= 3.4e-121) {
tmp = t_2;
} else if ((M * M) <= 3e-73) {
tmp = 0.0;
} else if ((M * M) <= 1.1e+54) {
tmp = t_2;
} else if ((M * M) <= 7.5e+105) {
tmp = ((M * M) / (c0 * ((t_1 / (w * h)) * -2.0))) * -t_0;
} else {
tmp = (c0 * (2.0 * (t_1 * (c0 / (w * h))))) / (2.0 * w);
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = c0 / (2.0d0 * w)
t_1 = (d_1 / d) ** 2.0d0
t_2 = t_0 * ((2.0d0 / w) * (t_1 * (c0 / h)))
if ((m * m) <= 1.4d-172) then
tmp = 0.0d0
else if ((m * m) <= 3.4d-121) then
tmp = t_2
else if ((m * m) <= 3d-73) then
tmp = 0.0d0
else if ((m * m) <= 1.1d+54) then
tmp = t_2
else if ((m * m) <= 7.5d+105) then
tmp = ((m * m) / (c0 * ((t_1 / (w * h)) * (-2.0d0)))) * -t_0
else
tmp = (c0 * (2.0d0 * (t_1 * (c0 / (w * h))))) / (2.0d0 * w)
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = Math.pow((d / D), 2.0);
double t_2 = t_0 * ((2.0 / w) * (t_1 * (c0 / h)));
double tmp;
if ((M * M) <= 1.4e-172) {
tmp = 0.0;
} else if ((M * M) <= 3.4e-121) {
tmp = t_2;
} else if ((M * M) <= 3e-73) {
tmp = 0.0;
} else if ((M * M) <= 1.1e+54) {
tmp = t_2;
} else if ((M * M) <= 7.5e+105) {
tmp = ((M * M) / (c0 * ((t_1 / (w * h)) * -2.0))) * -t_0;
} else {
tmp = (c0 * (2.0 * (t_1 * (c0 / (w * h))))) / (2.0 * w);
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) t_1 = math.pow((d / D), 2.0) t_2 = t_0 * ((2.0 / w) * (t_1 * (c0 / h))) tmp = 0 if (M * M) <= 1.4e-172: tmp = 0.0 elif (M * M) <= 3.4e-121: tmp = t_2 elif (M * M) <= 3e-73: tmp = 0.0 elif (M * M) <= 1.1e+54: tmp = t_2 elif (M * M) <= 7.5e+105: tmp = ((M * M) / (c0 * ((t_1 / (w * h)) * -2.0))) * -t_0 else: tmp = (c0 * (2.0 * (t_1 * (c0 / (w * h))))) / (2.0 * w) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) t_1 = Float64(d / D) ^ 2.0 t_2 = Float64(t_0 * Float64(Float64(2.0 / w) * Float64(t_1 * Float64(c0 / h)))) tmp = 0.0 if (Float64(M * M) <= 1.4e-172) tmp = 0.0; elseif (Float64(M * M) <= 3.4e-121) tmp = t_2; elseif (Float64(M * M) <= 3e-73) tmp = 0.0; elseif (Float64(M * M) <= 1.1e+54) tmp = t_2; elseif (Float64(M * M) <= 7.5e+105) tmp = Float64(Float64(Float64(M * M) / Float64(c0 * Float64(Float64(t_1 / Float64(w * h)) * -2.0))) * Float64(-t_0)); else tmp = Float64(Float64(c0 * Float64(2.0 * Float64(t_1 * Float64(c0 / Float64(w * h))))) / Float64(2.0 * w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); t_1 = (d / D) ^ 2.0; t_2 = t_0 * ((2.0 / w) * (t_1 * (c0 / h))); tmp = 0.0; if ((M * M) <= 1.4e-172) tmp = 0.0; elseif ((M * M) <= 3.4e-121) tmp = t_2; elseif ((M * M) <= 3e-73) tmp = 0.0; elseif ((M * M) <= 1.1e+54) tmp = t_2; elseif ((M * M) <= 7.5e+105) tmp = ((M * M) / (c0 * ((t_1 / (w * h)) * -2.0))) * -t_0; else tmp = (c0 * (2.0 * (t_1 * (c0 / (w * h))))) / (2.0 * w); 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[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * N[(N[(2.0 / w), $MachinePrecision] * N[(t$95$1 * N[(c0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(M * M), $MachinePrecision], 1.4e-172], 0.0, If[LessEqual[N[(M * M), $MachinePrecision], 3.4e-121], t$95$2, If[LessEqual[N[(M * M), $MachinePrecision], 3e-73], 0.0, If[LessEqual[N[(M * M), $MachinePrecision], 1.1e+54], t$95$2, If[LessEqual[N[(M * M), $MachinePrecision], 7.5e+105], N[(N[(N[(M * M), $MachinePrecision] / N[(c0 * N[(N[(t$95$1 / N[(w * h), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-t$95$0)), $MachinePrecision], N[(N[(c0 * N[(2.0 * N[(t$95$1 * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := {\left(\frac{d}{D}\right)}^{2}\\
t_2 := t_0 \cdot \left(\frac{2}{w} \cdot \left(t_1 \cdot \frac{c0}{h}\right)\right)\\
\mathbf{if}\;M \cdot M \leq 1.4 \cdot 10^{-172}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \cdot M \leq 3.4 \cdot 10^{-121}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;M \cdot M \leq 3 \cdot 10^{-73}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \cdot M \leq 1.1 \cdot 10^{+54}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;M \cdot M \leq 7.5 \cdot 10^{+105}:\\
\;\;\;\;\frac{M \cdot M}{c0 \cdot \left(\frac{t_1}{w \cdot h} \cdot -2\right)} \cdot \left(-t_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \left(2 \cdot \left(t_1 \cdot \frac{c0}{w \cdot h}\right)\right)}{2 \cdot w}\\
\end{array}
\end{array}
if (*.f64 M M) < 1.40000000000000006e-172 or 3.40000000000000001e-121 < (*.f64 M M) < 3e-73Initial program 28.8%
Simplified26.8%
*-un-lft-identity26.8%
associate-/r*28.4%
Applied egg-rr28.4%
Taylor expanded in c0 around -inf 10.6%
associate-/l*9.8%
distribute-rgt1-in9.8%
metadata-eval9.8%
mul0-lft36.9%
unpow236.9%
Simplified36.9%
Taylor expanded in w around 0 51.7%
if 1.40000000000000006e-172 < (*.f64 M M) < 3.40000000000000001e-121 or 3e-73 < (*.f64 M M) < 1.09999999999999995e54Initial program 39.3%
Simplified45.8%
Taylor expanded in c0 around inf 39.9%
*-commutative39.9%
associate-*r*37.0%
unpow237.0%
*-rgt-identity37.0%
associate-*r/37.0%
*-commutative37.0%
associate-*l*40.0%
associate-*r/40.0%
*-rgt-identity40.0%
unpow240.0%
associate-*r*43.0%
*-commutative43.0%
associate-/r*49.3%
unpow249.3%
unpow249.3%
Simplified49.3%
frac-times56.2%
associate-*r/56.2%
associate-*l/59.2%
frac-times49.3%
times-frac39.9%
clear-num40.0%
associate-*r*37.0%
associate-*r*37.2%
Applied egg-rr37.2%
associate-*l/37.2%
un-div-inv37.2%
associate-/l*40.6%
associate-*l*40.4%
Applied egg-rr40.4%
associate-*l/40.4%
associate-/r/40.4%
unpow240.4%
unpow240.4%
*-commutative40.4%
*-commutative40.4%
times-frac49.8%
unpow249.8%
unpow249.8%
times-frac62.9%
unpow262.9%
Simplified62.9%
if 1.09999999999999995e54 < (*.f64 M M) < 7.5000000000000002e105Initial program 0.4%
div-inv0.4%
associate-*l*0.4%
Applied egg-rr0.4%
flip-+0.0%
Applied egg-rr0.0%
unpow20.0%
associate--r-0.4%
+-inverses51.3%
unpow251.3%
*-commutative51.3%
Simplified51.3%
Taylor expanded in c0 around -inf 50.3%
associate-*r/50.3%
neg-mul-150.3%
unpow250.3%
*-commutative50.3%
sub-neg50.3%
mul-1-neg50.3%
distribute-rgt-out50.3%
associate-/r*50.7%
unpow250.7%
unpow250.7%
times-frac60.8%
unpow260.8%
metadata-eval60.8%
Simplified60.8%
if 7.5000000000000002e105 < (*.f64 M M) Initial program 17.2%
Simplified17.3%
Taylor expanded in c0 around inf 39.6%
*-commutative39.6%
associate-*r*40.8%
unpow240.8%
*-rgt-identity40.8%
associate-*r/40.8%
*-commutative40.8%
associate-*l*40.8%
associate-*r/40.8%
*-rgt-identity40.8%
unpow240.8%
associate-*r*39.6%
*-commutative39.6%
associate-/r*39.7%
unpow239.7%
unpow239.7%
Simplified39.7%
associate-*l/39.8%
frac-times48.1%
associate-*r/50.2%
associate-*l/50.1%
*-commutative50.1%
pow250.1%
*-commutative50.1%
*-commutative50.1%
Applied egg-rr50.1%
Final simplification52.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_1 (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
(if (<= t_1 INFINITY) t_1 0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_1 = (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) t_1 = (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M)))) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_1 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0\\
\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 76.1%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
Simplified17.9%
*-un-lft-identity17.9%
associate-/r*21.0%
Applied egg-rr21.0%
Taylor expanded in c0 around -inf 0.7%
associate-/l*0.1%
distribute-rgt1-in0.1%
metadata-eval0.1%
mul0-lft27.9%
unpow227.9%
Simplified27.9%
Taylor expanded in w around 0 40.5%
Final simplification52.2%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (pow (/ d D) 2.0))
(t_1 (* (/ c0 (* 2.0 w)) (* (/ 2.0 w) (* t_0 (/ c0 h))))))
(if (<= M 1.9e-88)
0.0
(if (<= M 2.8e-58)
t_1
(if (<= M 4.3e-39)
0.0
(if (<= M 1.05e+28)
t_1
(if (<= M 8.5e+52)
0.0
(/ (* c0 (* 2.0 (* t_0 (/ c0 (* w h))))) (* 2.0 w)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = pow((d / D), 2.0);
double t_1 = (c0 / (2.0 * w)) * ((2.0 / w) * (t_0 * (c0 / h)));
double tmp;
if (M <= 1.9e-88) {
tmp = 0.0;
} else if (M <= 2.8e-58) {
tmp = t_1;
} else if (M <= 4.3e-39) {
tmp = 0.0;
} else if (M <= 1.05e+28) {
tmp = t_1;
} else if (M <= 8.5e+52) {
tmp = 0.0;
} else {
tmp = (c0 * (2.0 * (t_0 * (c0 / (w * h))))) / (2.0 * w);
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (d_1 / d) ** 2.0d0
t_1 = (c0 / (2.0d0 * w)) * ((2.0d0 / w) * (t_0 * (c0 / h)))
if (m <= 1.9d-88) then
tmp = 0.0d0
else if (m <= 2.8d-58) then
tmp = t_1
else if (m <= 4.3d-39) then
tmp = 0.0d0
else if (m <= 1.05d+28) then
tmp = t_1
else if (m <= 8.5d+52) then
tmp = 0.0d0
else
tmp = (c0 * (2.0d0 * (t_0 * (c0 / (w * h))))) / (2.0d0 * w)
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 = Math.pow((d / D), 2.0);
double t_1 = (c0 / (2.0 * w)) * ((2.0 / w) * (t_0 * (c0 / h)));
double tmp;
if (M <= 1.9e-88) {
tmp = 0.0;
} else if (M <= 2.8e-58) {
tmp = t_1;
} else if (M <= 4.3e-39) {
tmp = 0.0;
} else if (M <= 1.05e+28) {
tmp = t_1;
} else if (M <= 8.5e+52) {
tmp = 0.0;
} else {
tmp = (c0 * (2.0 * (t_0 * (c0 / (w * h))))) / (2.0 * w);
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = math.pow((d / D), 2.0) t_1 = (c0 / (2.0 * w)) * ((2.0 / w) * (t_0 * (c0 / h))) tmp = 0 if M <= 1.9e-88: tmp = 0.0 elif M <= 2.8e-58: tmp = t_1 elif M <= 4.3e-39: tmp = 0.0 elif M <= 1.05e+28: tmp = t_1 elif M <= 8.5e+52: tmp = 0.0 else: tmp = (c0 * (2.0 * (t_0 * (c0 / (w * h))))) / (2.0 * w) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(d / D) ^ 2.0 t_1 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(2.0 / w) * Float64(t_0 * Float64(c0 / h)))) tmp = 0.0 if (M <= 1.9e-88) tmp = 0.0; elseif (M <= 2.8e-58) tmp = t_1; elseif (M <= 4.3e-39) tmp = 0.0; elseif (M <= 1.05e+28) tmp = t_1; elseif (M <= 8.5e+52) tmp = 0.0; else tmp = Float64(Float64(c0 * Float64(2.0 * Float64(t_0 * Float64(c0 / Float64(w * h))))) / Float64(2.0 * w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (d / D) ^ 2.0; t_1 = (c0 / (2.0 * w)) * ((2.0 / w) * (t_0 * (c0 / h))); tmp = 0.0; if (M <= 1.9e-88) tmp = 0.0; elseif (M <= 2.8e-58) tmp = t_1; elseif (M <= 4.3e-39) tmp = 0.0; elseif (M <= 1.05e+28) tmp = t_1; elseif (M <= 8.5e+52) tmp = 0.0; else tmp = (c0 * (2.0 * (t_0 * (c0 / (w * h))))) / (2.0 * w); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 / w), $MachinePrecision] * N[(t$95$0 * N[(c0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 1.9e-88], 0.0, If[LessEqual[M, 2.8e-58], t$95$1, If[LessEqual[M, 4.3e-39], 0.0, If[LessEqual[M, 1.05e+28], t$95$1, If[LessEqual[M, 8.5e+52], 0.0, N[(N[(c0 * N[(2.0 * N[(t$95$0 * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{2}\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(\frac{2}{w} \cdot \left(t_0 \cdot \frac{c0}{h}\right)\right)\\
\mathbf{if}\;M \leq 1.9 \cdot 10^{-88}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \leq 2.8 \cdot 10^{-58}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;M \leq 4.3 \cdot 10^{-39}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \leq 1.05 \cdot 10^{+28}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;M \leq 8.5 \cdot 10^{+52}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \left(2 \cdot \left(t_0 \cdot \frac{c0}{w \cdot h}\right)\right)}{2 \cdot w}\\
\end{array}
\end{array}
if M < 1.90000000000000006e-88 or 2.8000000000000001e-58 < M < 4.2999999999999999e-39 or 1.04999999999999995e28 < M < 8.49999999999999994e52Initial program 25.9%
Simplified30.2%
*-un-lft-identity30.2%
associate-/r*32.7%
Applied egg-rr32.7%
Taylor expanded in c0 around -inf 6.8%
associate-/l*6.2%
distribute-rgt1-in6.2%
metadata-eval6.2%
mul0-lft30.0%
unpow230.0%
Simplified30.0%
Taylor expanded in w around 0 40.4%
if 1.90000000000000006e-88 < M < 2.8000000000000001e-58 or 4.2999999999999999e-39 < M < 1.04999999999999995e28Initial program 29.6%
Simplified36.8%
Taylor expanded in c0 around inf 30.4%
*-commutative30.4%
associate-*r*23.9%
unpow223.9%
*-rgt-identity23.9%
associate-*r/23.9%
*-commutative23.9%
associate-*l*30.4%
associate-*r/30.5%
*-rgt-identity30.5%
unpow230.5%
associate-*r*36.9%
*-commutative36.9%
associate-/r*44.0%
unpow244.0%
unpow244.0%
Simplified44.0%
frac-times44.9%
associate-*r/44.9%
associate-*l/51.5%
frac-times44.0%
times-frac30.4%
clear-num30.5%
associate-*r*23.9%
associate-*r*24.4%
Applied egg-rr24.4%
associate-*l/24.4%
un-div-inv24.4%
associate-/l*24.4%
associate-*l*23.9%
Applied egg-rr23.9%
associate-*l/23.9%
associate-/r/23.9%
unpow223.9%
unpow223.9%
*-commutative23.9%
*-commutative23.9%
times-frac38.1%
unpow238.1%
unpow238.1%
times-frac52.5%
unpow252.5%
Simplified52.5%
if 8.49999999999999994e52 < M Initial program 19.0%
Simplified19.0%
Taylor expanded in c0 around inf 50.5%
*-commutative50.5%
associate-*r*53.0%
unpow253.0%
*-rgt-identity53.0%
associate-*r/53.0%
*-commutative53.0%
associate-*l*53.0%
associate-*r/53.0%
*-rgt-identity53.0%
unpow253.0%
associate-*r*50.5%
*-commutative50.5%
associate-/r*50.5%
unpow250.5%
unpow250.5%
Simplified50.5%
associate-*l/50.6%
frac-times55.5%
associate-*r/57.8%
associate-*l/57.7%
*-commutative57.7%
pow257.7%
*-commutative57.7%
*-commutative57.7%
Applied egg-rr57.7%
Final simplification43.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w)))
(t_1 (* t_0 (* (/ 2.0 w) (* (pow (/ d D) 2.0) (/ c0 h))))))
(if (<= M 3e-88)
0.0
(if (<= M 3.2e-61)
t_1
(if (<= M 2.4e-38)
0.0
(if (<= M 1.85e+27)
t_1
(if (<= M 8.2e+52)
0.0
(* t_0 (* 2.0 (/ (* c0 (* (/ d D) (/ d D))) (* w h)))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = t_0 * ((2.0 / w) * (pow((d / D), 2.0) * (c0 / h)));
double tmp;
if (M <= 3e-88) {
tmp = 0.0;
} else if (M <= 3.2e-61) {
tmp = t_1;
} else if (M <= 2.4e-38) {
tmp = 0.0;
} else if (M <= 1.85e+27) {
tmp = t_1;
} else if (M <= 8.2e+52) {
tmp = 0.0;
} else {
tmp = t_0 * (2.0 * ((c0 * ((d / D) * (d / D))) / (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = c0 / (2.0d0 * w)
t_1 = t_0 * ((2.0d0 / w) * (((d_1 / d) ** 2.0d0) * (c0 / h)))
if (m <= 3d-88) then
tmp = 0.0d0
else if (m <= 3.2d-61) then
tmp = t_1
else if (m <= 2.4d-38) then
tmp = 0.0d0
else if (m <= 1.85d+27) then
tmp = t_1
else if (m <= 8.2d+52) then
tmp = 0.0d0
else
tmp = t_0 * (2.0d0 * ((c0 * ((d_1 / d) * (d_1 / d))) / (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 t_0 = c0 / (2.0 * w);
double t_1 = t_0 * ((2.0 / w) * (Math.pow((d / D), 2.0) * (c0 / h)));
double tmp;
if (M <= 3e-88) {
tmp = 0.0;
} else if (M <= 3.2e-61) {
tmp = t_1;
} else if (M <= 2.4e-38) {
tmp = 0.0;
} else if (M <= 1.85e+27) {
tmp = t_1;
} else if (M <= 8.2e+52) {
tmp = 0.0;
} else {
tmp = t_0 * (2.0 * ((c0 * ((d / D) * (d / D))) / (w * h)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) t_1 = t_0 * ((2.0 / w) * (math.pow((d / D), 2.0) * (c0 / h))) tmp = 0 if M <= 3e-88: tmp = 0.0 elif M <= 3.2e-61: tmp = t_1 elif M <= 2.4e-38: tmp = 0.0 elif M <= 1.85e+27: tmp = t_1 elif M <= 8.2e+52: tmp = 0.0 else: tmp = t_0 * (2.0 * ((c0 * ((d / D) * (d / D))) / (w * h))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) t_1 = Float64(t_0 * Float64(Float64(2.0 / w) * Float64((Float64(d / D) ^ 2.0) * Float64(c0 / h)))) tmp = 0.0 if (M <= 3e-88) tmp = 0.0; elseif (M <= 3.2e-61) tmp = t_1; elseif (M <= 2.4e-38) tmp = 0.0; elseif (M <= 1.85e+27) tmp = t_1; elseif (M <= 8.2e+52) tmp = 0.0; else tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(c0 * Float64(Float64(d / D) * Float64(d / D))) / Float64(w * h)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); t_1 = t_0 * ((2.0 / w) * (((d / D) ^ 2.0) * (c0 / h))); tmp = 0.0; if (M <= 3e-88) tmp = 0.0; elseif (M <= 3.2e-61) tmp = t_1; elseif (M <= 2.4e-38) tmp = 0.0; elseif (M <= 1.85e+27) tmp = t_1; elseif (M <= 8.2e+52) tmp = 0.0; else tmp = t_0 * (2.0 * ((c0 * ((d / D) * (d / D))) / (w * h))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(2.0 / w), $MachinePrecision] * N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] * N[(c0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 3e-88], 0.0, If[LessEqual[M, 3.2e-61], t$95$1, If[LessEqual[M, 2.4e-38], 0.0, If[LessEqual[M, 1.85e+27], t$95$1, If[LessEqual[M, 8.2e+52], 0.0, N[(t$95$0 * N[(2.0 * N[(N[(c0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := t_0 \cdot \left(\frac{2}{w} \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{h}\right)\right)\\
\mathbf{if}\;M \leq 3 \cdot 10^{-88}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \leq 3.2 \cdot 10^{-61}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;M \leq 2.4 \cdot 10^{-38}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \leq 1.85 \cdot 10^{+27}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;M \leq 8.2 \cdot 10^{+52}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \frac{c0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{w \cdot h}\right)\\
\end{array}
\end{array}
if M < 2.9999999999999999e-88 or 3.2000000000000001e-61 < M < 2.40000000000000022e-38 or 1.85000000000000001e27 < M < 8.1999999999999999e52Initial program 25.9%
Simplified30.2%
*-un-lft-identity30.2%
associate-/r*32.7%
Applied egg-rr32.7%
Taylor expanded in c0 around -inf 6.8%
associate-/l*6.2%
distribute-rgt1-in6.2%
metadata-eval6.2%
mul0-lft30.0%
unpow230.0%
Simplified30.0%
Taylor expanded in w around 0 40.4%
if 2.9999999999999999e-88 < M < 3.2000000000000001e-61 or 2.40000000000000022e-38 < M < 1.85000000000000001e27Initial program 29.6%
Simplified36.8%
Taylor expanded in c0 around inf 30.4%
*-commutative30.4%
associate-*r*23.9%
unpow223.9%
*-rgt-identity23.9%
associate-*r/23.9%
*-commutative23.9%
associate-*l*30.4%
associate-*r/30.5%
*-rgt-identity30.5%
unpow230.5%
associate-*r*36.9%
*-commutative36.9%
associate-/r*44.0%
unpow244.0%
unpow244.0%
Simplified44.0%
frac-times44.9%
associate-*r/44.9%
associate-*l/51.5%
frac-times44.0%
times-frac30.4%
clear-num30.5%
associate-*r*23.9%
associate-*r*24.4%
Applied egg-rr24.4%
associate-*l/24.4%
un-div-inv24.4%
associate-/l*24.4%
associate-*l*23.9%
Applied egg-rr23.9%
associate-*l/23.9%
associate-/r/23.9%
unpow223.9%
unpow223.9%
*-commutative23.9%
*-commutative23.9%
times-frac38.1%
unpow238.1%
unpow238.1%
times-frac52.5%
unpow252.5%
Simplified52.5%
if 8.1999999999999999e52 < M Initial program 19.0%
Simplified19.0%
Taylor expanded in c0 around inf 50.5%
*-commutative50.5%
associate-*r*53.0%
unpow253.0%
*-rgt-identity53.0%
associate-*r/53.0%
*-commutative53.0%
associate-*l*53.0%
associate-*r/53.0%
*-rgt-identity53.0%
unpow253.0%
associate-*r*50.5%
*-commutative50.5%
associate-/r*50.5%
unpow250.5%
unpow250.5%
Simplified50.5%
frac-times55.4%
associate-*r/55.6%
associate-*l/55.5%
*-commutative55.5%
associate-*r/55.6%
pow255.6%
*-commutative55.6%
Applied egg-rr55.6%
pow255.6%
Applied egg-rr55.6%
Final simplification43.5%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= M 5e-38)
0.0
(if (or (<= M 2.95e+25) (not (<= M 8.2e+52)))
(* (/ c0 (* 2.0 w)) (* 2.0 (* c0 (/ (* (/ d D) (/ d D)) (* w h)))))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (M <= 5e-38) {
tmp = 0.0;
} else if ((M <= 2.95e+25) || !(M <= 8.2e+52)) {
tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d / D) * (d / D)) / (w * h))));
} 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 (m <= 5d-38) then
tmp = 0.0d0
else if ((m <= 2.95d+25) .or. (.not. (m <= 8.2d+52))) then
tmp = (c0 / (2.0d0 * w)) * (2.0d0 * (c0 * (((d_1 / d) * (d_1 / d)) / (w * h))))
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 (M <= 5e-38) {
tmp = 0.0;
} else if ((M <= 2.95e+25) || !(M <= 8.2e+52)) {
tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d / D) * (d / D)) / (w * h))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if M <= 5e-38: tmp = 0.0 elif (M <= 2.95e+25) or not (M <= 8.2e+52): tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d / D) * (d / D)) / (w * h)))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (M <= 5e-38) tmp = 0.0; elseif ((M <= 2.95e+25) || !(M <= 8.2e+52)) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(c0 * Float64(Float64(Float64(d / D) * Float64(d / D)) / Float64(w * h))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (M <= 5e-38) tmp = 0.0; elseif ((M <= 2.95e+25) || ~((M <= 8.2e+52))) tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d / D) * (d / D)) / (w * h)))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 5e-38], 0.0, If[Or[LessEqual[M, 2.95e+25], N[Not[LessEqual[M, 8.2e+52]], $MachinePrecision]], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(c0 * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 5 \cdot 10^{-38}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \leq 2.95 \cdot 10^{+25} \lor \neg \left(M \leq 8.2 \cdot 10^{+52}\right):\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \frac{\frac{d}{D} \cdot \frac{d}{D}}{w \cdot h}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if M < 5.00000000000000033e-38 or 2.95e25 < M < 8.1999999999999999e52Initial program 26.3%
Simplified30.5%
*-un-lft-identity30.5%
associate-/r*33.0%
Applied egg-rr33.0%
Taylor expanded in c0 around -inf 6.6%
associate-/l*6.1%
distribute-rgt1-in6.1%
metadata-eval6.1%
mul0-lft29.3%
unpow229.3%
Simplified29.3%
Taylor expanded in w around 0 39.4%
if 5.00000000000000033e-38 < M < 2.95e25 or 8.1999999999999999e52 < M Initial program 19.6%
Simplified21.6%
Taylor expanded in c0 around inf 45.8%
*-commutative45.8%
associate-*r*47.9%
unpow247.9%
*-rgt-identity47.9%
associate-*r/47.9%
*-commutative47.9%
associate-*l*47.9%
associate-*r/47.9%
*-rgt-identity47.9%
unpow247.9%
associate-*r*45.8%
*-commutative45.8%
associate-/r*47.7%
unpow247.7%
unpow247.7%
Simplified47.7%
frac-times51.9%
Applied egg-rr51.9%
Final simplification41.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* (/ d D) (/ d D))) (t_1 (/ c0 (* 2.0 w))))
(if (<= M 8.5e-39)
0.0
(if (<= M 2.9e+24)
(* t_1 (* 2.0 (* c0 (/ t_0 (* w h)))))
(if (<= M 1.1e+53) 0.0 (* t_1 (* 2.0 (/ (* c0 t_0) (* w h)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (d / D) * (d / D);
double t_1 = c0 / (2.0 * w);
double tmp;
if (M <= 8.5e-39) {
tmp = 0.0;
} else if (M <= 2.9e+24) {
tmp = t_1 * (2.0 * (c0 * (t_0 / (w * h))));
} else if (M <= 1.1e+53) {
tmp = 0.0;
} else {
tmp = t_1 * (2.0 * ((c0 * t_0) / (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (d_1 / d) * (d_1 / d)
t_1 = c0 / (2.0d0 * w)
if (m <= 8.5d-39) then
tmp = 0.0d0
else if (m <= 2.9d+24) then
tmp = t_1 * (2.0d0 * (c0 * (t_0 / (w * h))))
else if (m <= 1.1d+53) then
tmp = 0.0d0
else
tmp = t_1 * (2.0d0 * ((c0 * t_0) / (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 t_0 = (d / D) * (d / D);
double t_1 = c0 / (2.0 * w);
double tmp;
if (M <= 8.5e-39) {
tmp = 0.0;
} else if (M <= 2.9e+24) {
tmp = t_1 * (2.0 * (c0 * (t_0 / (w * h))));
} else if (M <= 1.1e+53) {
tmp = 0.0;
} else {
tmp = t_1 * (2.0 * ((c0 * t_0) / (w * h)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (d / D) * (d / D) t_1 = c0 / (2.0 * w) tmp = 0 if M <= 8.5e-39: tmp = 0.0 elif M <= 2.9e+24: tmp = t_1 * (2.0 * (c0 * (t_0 / (w * h)))) elif M <= 1.1e+53: tmp = 0.0 else: tmp = t_1 * (2.0 * ((c0 * t_0) / (w * h))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(d / D) * Float64(d / D)) t_1 = Float64(c0 / Float64(2.0 * w)) tmp = 0.0 if (M <= 8.5e-39) tmp = 0.0; elseif (M <= 2.9e+24) tmp = Float64(t_1 * Float64(2.0 * Float64(c0 * Float64(t_0 / Float64(w * h))))); elseif (M <= 1.1e+53) tmp = 0.0; else tmp = Float64(t_1 * Float64(2.0 * Float64(Float64(c0 * t_0) / Float64(w * h)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (d / D) * (d / D); t_1 = c0 / (2.0 * w); tmp = 0.0; if (M <= 8.5e-39) tmp = 0.0; elseif (M <= 2.9e+24) tmp = t_1 * (2.0 * (c0 * (t_0 / (w * h)))); elseif (M <= 1.1e+53) tmp = 0.0; else tmp = t_1 * (2.0 * ((c0 * t_0) / (w * h))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 8.5e-39], 0.0, If[LessEqual[M, 2.9e+24], N[(t$95$1 * N[(2.0 * N[(c0 * N[(t$95$0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 1.1e+53], 0.0, N[(t$95$1 * N[(2.0 * N[(N[(c0 * t$95$0), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{d}{D} \cdot \frac{d}{D}\\
t_1 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;M \leq 8.5 \cdot 10^{-39}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \leq 2.9 \cdot 10^{+24}:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \left(c0 \cdot \frac{t_0}{w \cdot h}\right)\right)\\
\mathbf{elif}\;M \leq 1.1 \cdot 10^{+53}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \frac{c0 \cdot t_0}{w \cdot h}\right)\\
\end{array}
\end{array}
if M < 8.5000000000000005e-39 or 2.89999999999999979e24 < M < 1.09999999999999999e53Initial program 26.3%
Simplified30.5%
*-un-lft-identity30.5%
associate-/r*33.0%
Applied egg-rr33.0%
Taylor expanded in c0 around -inf 6.6%
associate-/l*6.1%
distribute-rgt1-in6.1%
metadata-eval6.1%
mul0-lft29.3%
unpow229.3%
Simplified29.3%
Taylor expanded in w around 0 39.4%
if 8.5000000000000005e-39 < M < 2.89999999999999979e24Initial program 22.6%
Simplified33.7%
Taylor expanded in c0 around inf 23.7%
*-commutative23.7%
associate-*r*24.4%
unpow224.4%
*-rgt-identity24.4%
associate-*r/24.4%
*-commutative24.4%
associate-*l*24.4%
associate-*r/24.4%
*-rgt-identity24.4%
unpow224.4%
associate-*r*23.7%
*-commutative23.7%
associate-/r*34.8%
unpow234.8%
unpow234.8%
Simplified34.8%
frac-times35.6%
Applied egg-rr35.6%
if 1.09999999999999999e53 < M Initial program 19.0%
Simplified19.0%
Taylor expanded in c0 around inf 50.5%
*-commutative50.5%
associate-*r*53.0%
unpow253.0%
*-rgt-identity53.0%
associate-*r/53.0%
*-commutative53.0%
associate-*l*53.0%
associate-*r/53.0%
*-rgt-identity53.0%
unpow253.0%
associate-*r*50.5%
*-commutative50.5%
associate-/r*50.5%
unpow250.5%
unpow250.5%
Simplified50.5%
frac-times55.4%
associate-*r/55.6%
associate-*l/55.5%
*-commutative55.5%
associate-*r/55.6%
pow255.6%
*-commutative55.6%
Applied egg-rr55.6%
pow255.6%
Applied egg-rr55.6%
Final simplification41.9%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= M 5.5e-27)
0.0
(if (or (<= M 2.5e+26) (not (<= M 1.5e+53)))
(* (/ (* d d) (* D D)) (/ (* c0 c0) (* h (* w w))))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (M <= 5.5e-27) {
tmp = 0.0;
} else if ((M <= 2.5e+26) || !(M <= 1.5e+53)) {
tmp = ((d * d) / (D * D)) * ((c0 * c0) / (h * (w * w)));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 5.5d-27) then
tmp = 0.0d0
else if ((m <= 2.5d+26) .or. (.not. (m <= 1.5d+53))) then
tmp = ((d_1 * d_1) / (d * d)) * ((c0 * c0) / (h * (w * w)))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (M <= 5.5e-27) {
tmp = 0.0;
} else if ((M <= 2.5e+26) || !(M <= 1.5e+53)) {
tmp = ((d * d) / (D * D)) * ((c0 * c0) / (h * (w * w)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if M <= 5.5e-27: tmp = 0.0 elif (M <= 2.5e+26) or not (M <= 1.5e+53): tmp = ((d * d) / (D * D)) * ((c0 * c0) / (h * (w * w))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (M <= 5.5e-27) tmp = 0.0; elseif ((M <= 2.5e+26) || !(M <= 1.5e+53)) tmp = Float64(Float64(Float64(d * d) / Float64(D * D)) * Float64(Float64(c0 * c0) / Float64(h * Float64(w * w)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (M <= 5.5e-27) tmp = 0.0; elseif ((M <= 2.5e+26) || ~((M <= 1.5e+53))) tmp = ((d * d) / (D * D)) * ((c0 * c0) / (h * (w * w))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 5.5e-27], 0.0, If[Or[LessEqual[M, 2.5e+26], N[Not[LessEqual[M, 1.5e+53]], $MachinePrecision]], 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], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 5.5 \cdot 10^{-27}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \leq 2.5 \cdot 10^{+26} \lor \neg \left(M \leq 1.5 \cdot 10^{+53}\right):\\
\;\;\;\;\frac{d \cdot d}{D \cdot D} \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if M < 5.5000000000000002e-27 or 2.5e26 < M < 1.49999999999999999e53Initial program 26.4%
Simplified30.5%
*-un-lft-identity30.5%
associate-/r*33.0%
Applied egg-rr33.0%
Taylor expanded in c0 around -inf 6.5%
associate-/l*6.0%
distribute-rgt1-in6.0%
metadata-eval6.0%
mul0-lft28.9%
unpow228.9%
Simplified28.9%
Taylor expanded in w around 0 38.9%
if 5.5000000000000002e-27 < M < 2.5e26 or 1.49999999999999999e53 < M Initial program 18.8%
Simplified48.1%
*-un-lft-identity48.1%
associate-/r*48.1%
Applied egg-rr48.1%
Taylor expanded in c0 around inf 38.2%
times-frac40.3%
unpow240.3%
unpow240.3%
unpow240.3%
*-commutative40.3%
unpow240.3%
Simplified40.3%
Final simplification39.2%
(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.0%
Simplified33.8%
*-un-lft-identity33.8%
associate-/r*35.9%
Applied egg-rr35.9%
Taylor expanded in c0 around -inf 5.4%
associate-/l*4.9%
distribute-rgt1-in4.9%
metadata-eval4.9%
mul0-lft23.9%
unpow223.9%
Simplified23.9%
Taylor expanded in w around 0 32.5%
Final simplification32.5%
herbie shell --seed 2023309
(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))))))