
(FPCore (c0 w h D d M) :precision binary64 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))) (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) end
function tmp = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (c0 w h D d M) :precision binary64 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))) (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) end
function tmp = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)
\end{array}
\end{array}
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
(if (<=
(* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))
INFINITY)
(- (/ (pow (* c0 d) 2.0) (* (- D) (* (* w h) (* w D)))))
(* 0.25 (/ (* h (* M M)) (pow (/ d D) 2.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 tmp;
if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= ((double) INFINITY)) {
tmp = -(pow((c0 * d), 2.0) / (-D * ((w * h) * (w * D))));
} else {
tmp = 0.25 * ((h * (M * M)) / pow((d / D), 2.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 tmp;
if (((c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = -(Math.pow((c0 * d), 2.0) / (-D * ((w * h) * (w * D))));
} else {
tmp = 0.25 * ((h * (M * M)) / Math.pow((d / D), 2.0));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) tmp = 0 if ((c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))) <= math.inf: tmp = -(math.pow((c0 * d), 2.0) / (-D * ((w * h) * (w * D)))) else: tmp = 0.25 * ((h * (M * M)) / math.pow((d / D), 2.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))) tmp = 0.0 if (Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) <= Inf) tmp = Float64(-Float64((Float64(c0 * d) ^ 2.0) / Float64(Float64(-D) * Float64(Float64(w * h) * Float64(w * D))))); else tmp = Float64(0.25 * Float64(Float64(h * Float64(M * M)) / (Float64(d / D) ^ 2.0))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = 0.0; if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= Inf) tmp = -(((c0 * d) ^ 2.0) / (-D * ((w * h) * (w * D)))); else tmp = 0.25 * ((h * (M * M)) / ((d / D) ^ 2.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]}, If[LessEqual[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], Infinity], (-N[(N[Power[N[(c0 * d), $MachinePrecision], 2.0], $MachinePrecision] / N[((-D) * N[(N[(w * h), $MachinePrecision] * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[Power[N[(d / D), $MachinePrecision], 2.0], $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)}\\
\mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;-\frac{{\left(c0 \cdot d\right)}^{2}}{\left(-D\right) \cdot \left(\left(w \cdot h\right) \cdot \left(w \cdot D\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{{\left(\frac{d}{D}\right)}^{2}}\\
\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 65.7%
associate-*l*63.2%
difference-of-squares63.2%
associate-*l*63.2%
associate-*l*64.5%
Simplified64.5%
Taylor expanded in c0 around inf 53.0%
times-frac49.3%
unpow249.3%
unpow249.3%
unpow249.3%
*-commutative49.3%
unpow249.3%
Simplified49.3%
frac-times53.0%
*-commutative53.0%
pow253.0%
pow253.0%
pow253.0%
pow253.0%
frac-2neg53.0%
pow-prod-down60.1%
pow260.1%
pow260.1%
*-commutative60.1%
Applied egg-rr60.1%
associate-*l*62.3%
distribute-rgt-neg-in62.3%
unpow262.3%
*-commutative62.3%
unpow262.3%
Simplified62.3%
Taylor expanded in D around 0 60.1%
unpow260.1%
associate-*r*63.8%
associate-*r*63.8%
neg-mul-163.8%
unpow263.8%
distribute-rgt-neg-in63.8%
associate-*r*66.0%
associate-*r*70.1%
distribute-lft-neg-out70.1%
Simplified70.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%
times-frac0.0%
fma-def0.0%
times-frac0.0%
difference-of-squares10.6%
Simplified10.7%
sqrt-prod10.6%
associate-*l*10.6%
div-inv10.6%
clear-num10.6%
associate-*r/10.6%
*-commutative10.6%
times-frac10.6%
associate-/l/12.0%
fma-neg12.0%
associate-/l/10.6%
frac-times16.0%
pow216.0%
Applied egg-rr16.0%
*-commutative16.0%
fma-udef16.0%
unsub-neg16.0%
associate-/r*16.1%
*-commutative16.1%
Simplified16.1%
Taylor expanded in c0 around -inf 0.6%
Simplified0.0%
Taylor expanded in c0 around 0 46.8%
*-commutative46.8%
*-commutative46.8%
associate-/l*44.5%
*-commutative44.5%
unpow244.5%
unpow244.5%
unpow244.5%
times-frac56.3%
unpow256.3%
Simplified56.3%
Final simplification60.8%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (pow (* c0 d) 2.0))
(t_1 (* 0.25 (/ (* h (* M M)) (pow (/ d D) 2.0)))))
(if (<= (* M M) 1.8e-195)
t_1
(if (<= (* M M) 5.5e-152)
(- (/ t_0 (* D (* (* D (* w w)) (- h)))))
(if (<= (* M M) 3.8e+250)
t_1
(/ (- t_0) (* D (* (* w (* w h)) (- D)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = pow((c0 * d), 2.0);
double t_1 = 0.25 * ((h * (M * M)) / pow((d / D), 2.0));
double tmp;
if ((M * M) <= 1.8e-195) {
tmp = t_1;
} else if ((M * M) <= 5.5e-152) {
tmp = -(t_0 / (D * ((D * (w * w)) * -h)));
} else if ((M * M) <= 3.8e+250) {
tmp = t_1;
} else {
tmp = -t_0 / (D * ((w * (w * h)) * -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) :: tmp
t_0 = (c0 * d_1) ** 2.0d0
t_1 = 0.25d0 * ((h * (m * m)) / ((d_1 / d) ** 2.0d0))
if ((m * m) <= 1.8d-195) then
tmp = t_1
else if ((m * m) <= 5.5d-152) then
tmp = -(t_0 / (d * ((d * (w * w)) * -h)))
else if ((m * m) <= 3.8d+250) then
tmp = t_1
else
tmp = -t_0 / (d * ((w * (w * h)) * -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 = Math.pow((c0 * d), 2.0);
double t_1 = 0.25 * ((h * (M * M)) / Math.pow((d / D), 2.0));
double tmp;
if ((M * M) <= 1.8e-195) {
tmp = t_1;
} else if ((M * M) <= 5.5e-152) {
tmp = -(t_0 / (D * ((D * (w * w)) * -h)));
} else if ((M * M) <= 3.8e+250) {
tmp = t_1;
} else {
tmp = -t_0 / (D * ((w * (w * h)) * -D));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = math.pow((c0 * d), 2.0) t_1 = 0.25 * ((h * (M * M)) / math.pow((d / D), 2.0)) tmp = 0 if (M * M) <= 1.8e-195: tmp = t_1 elif (M * M) <= 5.5e-152: tmp = -(t_0 / (D * ((D * (w * w)) * -h))) elif (M * M) <= 3.8e+250: tmp = t_1 else: tmp = -t_0 / (D * ((w * (w * h)) * -D)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 * d) ^ 2.0 t_1 = Float64(0.25 * Float64(Float64(h * Float64(M * M)) / (Float64(d / D) ^ 2.0))) tmp = 0.0 if (Float64(M * M) <= 1.8e-195) tmp = t_1; elseif (Float64(M * M) <= 5.5e-152) tmp = Float64(-Float64(t_0 / Float64(D * Float64(Float64(D * Float64(w * w)) * Float64(-h))))); elseif (Float64(M * M) <= 3.8e+250) tmp = t_1; else tmp = Float64(Float64(-t_0) / Float64(D * Float64(Float64(w * Float64(w * h)) * Float64(-D)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * d) ^ 2.0; t_1 = 0.25 * ((h * (M * M)) / ((d / D) ^ 2.0)); tmp = 0.0; if ((M * M) <= 1.8e-195) tmp = t_1; elseif ((M * M) <= 5.5e-152) tmp = -(t_0 / (D * ((D * (w * w)) * -h))); elseif ((M * M) <= 3.8e+250) tmp = t_1; else tmp = -t_0 / (D * ((w * (w * h)) * -D)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[Power[N[(c0 * d), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(M * M), $MachinePrecision], 1.8e-195], t$95$1, If[LessEqual[N[(M * M), $MachinePrecision], 5.5e-152], (-N[(t$95$0 / N[(D * N[(N[(D * N[(w * w), $MachinePrecision]), $MachinePrecision] * (-h)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[N[(M * M), $MachinePrecision], 3.8e+250], t$95$1, N[((-t$95$0) / N[(D * N[(N[(w * N[(w * h), $MachinePrecision]), $MachinePrecision] * (-D)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(c0 \cdot d\right)}^{2}\\
t_1 := 0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{{\left(\frac{d}{D}\right)}^{2}}\\
\mathbf{if}\;M \cdot M \leq 1.8 \cdot 10^{-195}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;M \cdot M \leq 5.5 \cdot 10^{-152}:\\
\;\;\;\;-\frac{t_0}{D \cdot \left(\left(D \cdot \left(w \cdot w\right)\right) \cdot \left(-h\right)\right)}\\
\mathbf{elif}\;M \cdot M \leq 3.8 \cdot 10^{+250}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-t_0}{D \cdot \left(\left(w \cdot \left(w \cdot h\right)\right) \cdot \left(-D\right)\right)}\\
\end{array}
\end{array}
if (*.f64 M M) < 1.8e-195 or 5.4999999999999998e-152 < (*.f64 M M) < 3.7999999999999997e250Initial program 23.2%
times-frac20.2%
fma-def20.2%
times-frac20.4%
difference-of-squares20.4%
Simplified20.7%
sqrt-prod19.8%
associate-*l*19.3%
div-inv19.3%
clear-num19.3%
associate-*r/18.3%
*-commutative18.3%
times-frac19.3%
associate-/l/21.0%
fma-neg21.0%
associate-/l/19.3%
frac-times25.4%
pow225.4%
Applied egg-rr25.4%
*-commutative25.4%
fma-udef25.4%
unsub-neg25.4%
associate-/r*25.5%
*-commutative25.5%
Simplified25.5%
Taylor expanded in c0 around -inf 6.5%
Simplified5.9%
Taylor expanded in c0 around 0 43.3%
*-commutative43.3%
*-commutative43.3%
associate-/l*43.8%
*-commutative43.8%
unpow243.8%
unpow243.8%
unpow243.8%
times-frac52.4%
unpow252.4%
Simplified52.4%
if 1.8e-195 < (*.f64 M M) < 5.4999999999999998e-152Initial program 45.8%
associate-*l*45.8%
difference-of-squares45.8%
associate-*l*45.8%
associate-*l*46.9%
Simplified46.9%
Taylor expanded in c0 around inf 37.1%
times-frac36.9%
unpow236.9%
unpow236.9%
unpow236.9%
*-commutative36.9%
unpow236.9%
Simplified36.9%
frac-times37.1%
*-commutative37.1%
pow237.1%
pow237.1%
pow237.1%
pow237.1%
frac-2neg37.1%
pow-prod-down54.5%
pow254.5%
pow254.5%
*-commutative54.5%
Applied egg-rr54.5%
associate-*l*64.0%
distribute-rgt-neg-in64.0%
unpow264.0%
*-commutative64.0%
unpow264.0%
Simplified64.0%
Taylor expanded in D around 0 64.0%
associate-*r*72.8%
unpow272.8%
*-commutative72.8%
Simplified72.8%
if 3.7999999999999997e250 < (*.f64 M M) Initial program 12.5%
associate-*l*12.5%
difference-of-squares46.7%
associate-*l*46.7%
associate-*l*46.7%
Simplified46.7%
Taylor expanded in c0 around inf 54.3%
times-frac52.4%
unpow252.4%
unpow252.4%
unpow252.4%
*-commutative52.4%
unpow252.4%
Simplified52.4%
frac-times54.3%
*-commutative54.3%
pow254.3%
pow254.3%
pow254.3%
pow254.3%
frac-2neg54.3%
pow-prod-down61.3%
pow261.3%
pow261.3%
*-commutative61.3%
Applied egg-rr61.3%
associate-*l*63.2%
distribute-rgt-neg-in63.2%
unpow263.2%
*-commutative63.2%
unpow263.2%
Simplified63.2%
Taylor expanded in w around 0 63.2%
unpow263.2%
associate-*r*65.0%
Simplified65.0%
Final simplification56.0%
(FPCore (c0 w h D d M) :precision binary64 (if (<= (* M M) 2.7e+246) (* 0.25 (/ (* h (* M M)) (pow (/ d D) 2.0))) (/ (- (pow (* c0 d) 2.0)) (* D (* (* w (* w h)) (- D))))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M * M) <= 2.7e+246) {
tmp = 0.25 * ((h * (M * M)) / pow((d / D), 2.0));
} else {
tmp = -pow((c0 * d), 2.0) / (D * ((w * (w * h)) * -D));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if ((m * m) <= 2.7d+246) then
tmp = 0.25d0 * ((h * (m * m)) / ((d_1 / d) ** 2.0d0))
else
tmp = -((c0 * d_1) ** 2.0d0) / (d * ((w * (w * h)) * -d))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M * M) <= 2.7e+246) {
tmp = 0.25 * ((h * (M * M)) / Math.pow((d / D), 2.0));
} else {
tmp = -Math.pow((c0 * d), 2.0) / (D * ((w * (w * h)) * -D));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (M * M) <= 2.7e+246: tmp = 0.25 * ((h * (M * M)) / math.pow((d / D), 2.0)) else: tmp = -math.pow((c0 * d), 2.0) / (D * ((w * (w * h)) * -D)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (Float64(M * M) <= 2.7e+246) tmp = Float64(0.25 * Float64(Float64(h * Float64(M * M)) / (Float64(d / D) ^ 2.0))); else tmp = Float64(Float64(-(Float64(c0 * d) ^ 2.0)) / Float64(D * Float64(Float64(w * Float64(w * h)) * Float64(-D)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((M * M) <= 2.7e+246) tmp = 0.25 * ((h * (M * M)) / ((d / D) ^ 2.0)); else tmp = -((c0 * d) ^ 2.0) / (D * ((w * (w * h)) * -D)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[N[(M * M), $MachinePrecision], 2.7e+246], N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[Power[N[(c0 * d), $MachinePrecision], 2.0], $MachinePrecision]) / N[(D * N[(N[(w * N[(w * h), $MachinePrecision]), $MachinePrecision] * (-D)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \cdot M \leq 2.7 \cdot 10^{+246}:\\
\;\;\;\;0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{{\left(\frac{d}{D}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-{\left(c0 \cdot d\right)}^{2}}{D \cdot \left(\left(w \cdot \left(w \cdot h\right)\right) \cdot \left(-D\right)\right)}\\
\end{array}
\end{array}
if (*.f64 M M) < 2.7e246Initial program 24.4%
times-frac21.6%
fma-def21.6%
times-frac21.8%
difference-of-squares21.8%
Simplified22.1%
sqrt-prod21.3%
associate-*l*20.8%
div-inv20.8%
clear-num20.8%
associate-*r/19.8%
*-commutative19.8%
times-frac20.8%
associate-/l/22.4%
fma-neg22.4%
associate-/l/20.8%
frac-times26.5%
pow226.5%
Applied egg-rr26.5%
*-commutative26.5%
fma-udef26.5%
unsub-neg26.5%
associate-/r*26.7%
*-commutative26.7%
Simplified26.7%
Taylor expanded in c0 around -inf 6.2%
Simplified5.6%
Taylor expanded in c0 around 0 42.0%
*-commutative42.0%
*-commutative42.0%
associate-/l*42.5%
*-commutative42.5%
unpow242.5%
unpow242.5%
unpow242.5%
times-frac51.1%
unpow251.1%
Simplified51.1%
if 2.7e246 < (*.f64 M M) Initial program 12.5%
associate-*l*12.5%
difference-of-squares46.7%
associate-*l*46.7%
associate-*l*46.7%
Simplified46.7%
Taylor expanded in c0 around inf 54.3%
times-frac52.4%
unpow252.4%
unpow252.4%
unpow252.4%
*-commutative52.4%
unpow252.4%
Simplified52.4%
frac-times54.3%
*-commutative54.3%
pow254.3%
pow254.3%
pow254.3%
pow254.3%
frac-2neg54.3%
pow-prod-down61.3%
pow261.3%
pow261.3%
*-commutative61.3%
Applied egg-rr61.3%
associate-*l*63.2%
distribute-rgt-neg-in63.2%
unpow263.2%
*-commutative63.2%
unpow263.2%
Simplified63.2%
Taylor expanded in w around 0 63.2%
unpow263.2%
associate-*r*65.0%
Simplified65.0%
Final simplification54.1%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (pow (/ d D) 2.0)))
(if (<= (* M M) 5.9e+133)
(* 0.25 (/ (* h (* M M)) t_0))
(* (/ t_0 h) (* c0 (/ c0 (* w w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = pow((d / D), 2.0);
double tmp;
if ((M * M) <= 5.9e+133) {
tmp = 0.25 * ((h * (M * M)) / t_0);
} else {
tmp = (t_0 / h) * (c0 * (c0 / (w * 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) :: tmp
t_0 = (d_1 / d) ** 2.0d0
if ((m * m) <= 5.9d+133) then
tmp = 0.25d0 * ((h * (m * m)) / t_0)
else
tmp = (t_0 / h) * (c0 * (c0 / (w * 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 tmp;
if ((M * M) <= 5.9e+133) {
tmp = 0.25 * ((h * (M * M)) / t_0);
} else {
tmp = (t_0 / h) * (c0 * (c0 / (w * w)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = math.pow((d / D), 2.0) tmp = 0 if (M * M) <= 5.9e+133: tmp = 0.25 * ((h * (M * M)) / t_0) else: tmp = (t_0 / h) * (c0 * (c0 / (w * w))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(d / D) ^ 2.0 tmp = 0.0 if (Float64(M * M) <= 5.9e+133) tmp = Float64(0.25 * Float64(Float64(h * Float64(M * M)) / t_0)); else tmp = Float64(Float64(t_0 / h) * Float64(c0 * Float64(c0 / Float64(w * w)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (d / D) ^ 2.0; tmp = 0.0; if ((M * M) <= 5.9e+133) tmp = 0.25 * ((h * (M * M)) / t_0); else tmp = (t_0 / h) * (c0 * (c0 / (w * 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]}, If[LessEqual[N[(M * M), $MachinePrecision], 5.9e+133], N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / h), $MachinePrecision] * N[(c0 * N[(c0 / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{2}\\
\mathbf{if}\;M \cdot M \leq 5.9 \cdot 10^{+133}:\\
\;\;\;\;0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{h} \cdot \left(c0 \cdot \frac{c0}{w \cdot w}\right)\\
\end{array}
\end{array}
if (*.f64 M M) < 5.8999999999999997e133Initial program 24.1%
times-frac21.0%
fma-def21.0%
times-frac21.3%
difference-of-squares21.3%
Simplified21.6%
sqrt-prod20.7%
associate-*l*20.2%
div-inv20.2%
clear-num20.2%
associate-*r/19.2%
*-commutative19.2%
times-frac20.2%
associate-/l/21.4%
fma-neg21.4%
associate-/l/20.2%
frac-times25.8%
pow225.8%
Applied egg-rr25.8%
*-commutative25.8%
fma-udef25.8%
unsub-neg25.8%
associate-/r*26.0%
*-commutative26.0%
Simplified26.0%
Taylor expanded in c0 around -inf 6.6%
Simplified6.0%
Taylor expanded in c0 around 0 42.9%
*-commutative42.9%
*-commutative42.9%
associate-/l*43.5%
*-commutative43.5%
unpow243.5%
unpow243.5%
unpow243.5%
times-frac52.6%
unpow252.6%
Simplified52.6%
if 5.8999999999999997e133 < (*.f64 M M) Initial program 15.8%
associate-*l*15.7%
difference-of-squares43.1%
associate-*l*43.1%
associate-*l*44.5%
Simplified44.5%
Taylor expanded in c0 around inf 47.9%
times-frac47.8%
unpow247.8%
unpow247.8%
unpow247.8%
*-commutative47.8%
unpow247.8%
Simplified47.8%
frac-times53.5%
associate-*r/53.7%
pow253.7%
Applied egg-rr53.7%
unpow253.7%
unpow253.7%
times-frac53.6%
unpow253.6%
associate-*r/53.7%
unpow253.7%
Simplified53.7%
Final simplification52.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (pow (/ d D) 2.0)))
(if (<= (* M M) 2.4e+138)
(* 0.25 (/ (* h (* M M)) t_0))
(* t_0 (* c0 (/ c0 (* w (* w h))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = pow((d / D), 2.0);
double tmp;
if ((M * M) <= 2.4e+138) {
tmp = 0.25 * ((h * (M * M)) / t_0);
} else {
tmp = t_0 * (c0 * (c0 / (w * (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) :: tmp
t_0 = (d_1 / d) ** 2.0d0
if ((m * m) <= 2.4d+138) then
tmp = 0.25d0 * ((h * (m * m)) / t_0)
else
tmp = t_0 * (c0 * (c0 / (w * (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 = Math.pow((d / D), 2.0);
double tmp;
if ((M * M) <= 2.4e+138) {
tmp = 0.25 * ((h * (M * M)) / t_0);
} else {
tmp = t_0 * (c0 * (c0 / (w * (w * h))));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = math.pow((d / D), 2.0) tmp = 0 if (M * M) <= 2.4e+138: tmp = 0.25 * ((h * (M * M)) / t_0) else: tmp = t_0 * (c0 * (c0 / (w * (w * h)))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(d / D) ^ 2.0 tmp = 0.0 if (Float64(M * M) <= 2.4e+138) tmp = Float64(0.25 * Float64(Float64(h * Float64(M * M)) / t_0)); else tmp = Float64(t_0 * Float64(c0 * Float64(c0 / Float64(w * Float64(w * h))))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (d / D) ^ 2.0; tmp = 0.0; if ((M * M) <= 2.4e+138) tmp = 0.25 * ((h * (M * M)) / t_0); else tmp = t_0 * (c0 * (c0 / (w * (w * h)))); 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]}, If[LessEqual[N[(M * M), $MachinePrecision], 2.4e+138], N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(c0 * N[(c0 / N[(w * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{2}\\
\mathbf{if}\;M \cdot M \leq 2.4 \cdot 10^{+138}:\\
\;\;\;\;0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(c0 \cdot \frac{c0}{w \cdot \left(w \cdot h\right)}\right)\\
\end{array}
\end{array}
if (*.f64 M M) < 2.4000000000000001e138Initial program 24.1%
times-frac21.0%
fma-def21.0%
times-frac21.3%
difference-of-squares21.3%
Simplified21.6%
sqrt-prod20.7%
associate-*l*20.2%
div-inv20.2%
clear-num20.2%
associate-*r/19.2%
*-commutative19.2%
times-frac20.2%
associate-/l/21.4%
fma-neg21.4%
associate-/l/20.2%
frac-times25.8%
pow225.8%
Applied egg-rr25.8%
*-commutative25.8%
fma-udef25.8%
unsub-neg25.8%
associate-/r*26.0%
*-commutative26.0%
Simplified26.0%
Taylor expanded in c0 around -inf 6.6%
Simplified6.0%
Taylor expanded in c0 around 0 42.9%
*-commutative42.9%
*-commutative42.9%
associate-/l*43.5%
*-commutative43.5%
unpow243.5%
unpow243.5%
unpow243.5%
times-frac52.6%
unpow252.6%
Simplified52.6%
if 2.4000000000000001e138 < (*.f64 M M) Initial program 15.8%
associate-*l*15.7%
difference-of-squares43.1%
associate-*l*43.1%
associate-*l*44.5%
Simplified44.5%
Taylor expanded in c0 around inf 47.9%
pow247.9%
pow247.9%
pow247.9%
times-frac47.8%
frac-times53.5%
pow253.5%
*-commutative53.5%
pow253.5%
associate-/l*53.6%
Applied egg-rr53.6%
associate-/r/53.6%
*-commutative53.6%
associate-*l*55.1%
Applied egg-rr55.1%
Final simplification53.3%
(FPCore (c0 w h D d M) :precision binary64 (if (<= (* M M) 2.1e+252) (* 0.25 (/ (* h (* M M)) (pow (/ d D) 2.0))) (/ (pow (* c0 d) 2.0) (* (* D D) (* h (* w w))))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M * M) <= 2.1e+252) {
tmp = 0.25 * ((h * (M * M)) / pow((d / D), 2.0));
} else {
tmp = pow((c0 * d), 2.0) / ((D * D) * (h * (w * 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) :: tmp
if ((m * m) <= 2.1d+252) then
tmp = 0.25d0 * ((h * (m * m)) / ((d_1 / d) ** 2.0d0))
else
tmp = ((c0 * d_1) ** 2.0d0) / ((d * d) * (h * (w * w)))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M * M) <= 2.1e+252) {
tmp = 0.25 * ((h * (M * M)) / Math.pow((d / D), 2.0));
} else {
tmp = Math.pow((c0 * d), 2.0) / ((D * D) * (h * (w * w)));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (M * M) <= 2.1e+252: tmp = 0.25 * ((h * (M * M)) / math.pow((d / D), 2.0)) else: tmp = math.pow((c0 * d), 2.0) / ((D * D) * (h * (w * w))) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (Float64(M * M) <= 2.1e+252) tmp = Float64(0.25 * Float64(Float64(h * Float64(M * M)) / (Float64(d / D) ^ 2.0))); else tmp = Float64((Float64(c0 * d) ^ 2.0) / Float64(Float64(D * D) * Float64(h * Float64(w * w)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((M * M) <= 2.1e+252) tmp = 0.25 * ((h * (M * M)) / ((d / D) ^ 2.0)); else tmp = ((c0 * d) ^ 2.0) / ((D * D) * (h * (w * w))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[N[(M * M), $MachinePrecision], 2.1e+252], N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(c0 * d), $MachinePrecision], 2.0], $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \cdot M \leq 2.1 \cdot 10^{+252}:\\
\;\;\;\;0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{{\left(\frac{d}{D}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(c0 \cdot d\right)}^{2}}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\\
\end{array}
\end{array}
if (*.f64 M M) < 2.1000000000000001e252Initial program 24.4%
times-frac21.6%
fma-def21.6%
times-frac21.8%
difference-of-squares21.8%
Simplified22.1%
sqrt-prod21.3%
associate-*l*20.8%
div-inv20.8%
clear-num20.8%
associate-*r/19.8%
*-commutative19.8%
times-frac20.8%
associate-/l/22.4%
fma-neg22.4%
associate-/l/20.8%
frac-times26.5%
pow226.5%
Applied egg-rr26.5%
*-commutative26.5%
fma-udef26.5%
unsub-neg26.5%
associate-/r*26.7%
*-commutative26.7%
Simplified26.7%
Taylor expanded in c0 around -inf 6.2%
Simplified5.6%
Taylor expanded in c0 around 0 42.0%
*-commutative42.0%
*-commutative42.0%
associate-/l*42.5%
*-commutative42.5%
unpow242.5%
unpow242.5%
unpow242.5%
times-frac51.1%
unpow251.1%
Simplified51.1%
if 2.1000000000000001e252 < (*.f64 M M) Initial program 12.5%
associate-*l*12.5%
difference-of-squares46.7%
associate-*l*46.7%
associate-*l*46.7%
Simplified46.7%
Taylor expanded in c0 around inf 54.3%
times-frac52.4%
unpow252.4%
unpow252.4%
unpow252.4%
*-commutative52.4%
unpow252.4%
Simplified52.4%
frac-times54.3%
pow254.3%
pow254.3%
pow-prod-down61.3%
Applied egg-rr61.3%
Final simplification53.3%
(FPCore (c0 w h D d M) :precision binary64 (if (<= (* M M) 4.2e+133) (* 0.25 (/ (* h (* M M)) (pow (/ d D) 2.0))) (* (* (/ d D) (/ d D)) (/ c0 (/ (* h (* w w)) c0)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M * M) <= 4.2e+133) {
tmp = 0.25 * ((h * (M * M)) / pow((d / D), 2.0));
} else {
tmp = ((d / D) * (d / D)) * (c0 / ((h * (w * w)) / c0));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if ((m * m) <= 4.2d+133) then
tmp = 0.25d0 * ((h * (m * m)) / ((d_1 / d) ** 2.0d0))
else
tmp = ((d_1 / d) * (d_1 / d)) * (c0 / ((h * (w * w)) / c0))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M * M) <= 4.2e+133) {
tmp = 0.25 * ((h * (M * M)) / Math.pow((d / D), 2.0));
} else {
tmp = ((d / D) * (d / D)) * (c0 / ((h * (w * w)) / c0));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (M * M) <= 4.2e+133: tmp = 0.25 * ((h * (M * M)) / math.pow((d / D), 2.0)) else: tmp = ((d / D) * (d / D)) * (c0 / ((h * (w * w)) / c0)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (Float64(M * M) <= 4.2e+133) tmp = Float64(0.25 * Float64(Float64(h * Float64(M * M)) / (Float64(d / D) ^ 2.0))); else tmp = Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(c0 / Float64(Float64(h * Float64(w * w)) / c0))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((M * M) <= 4.2e+133) tmp = 0.25 * ((h * (M * M)) / ((d / D) ^ 2.0)); else tmp = ((d / D) * (d / D)) * (c0 / ((h * (w * w)) / c0)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[N[(M * M), $MachinePrecision], 4.2e+133], N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(c0 / N[(N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \cdot M \leq 4.2 \cdot 10^{+133}:\\
\;\;\;\;0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{{\left(\frac{d}{D}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{\frac{h \cdot \left(w \cdot w\right)}{c0}}\\
\end{array}
\end{array}
if (*.f64 M M) < 4.2e133Initial program 24.1%
times-frac21.0%
fma-def21.0%
times-frac21.3%
difference-of-squares21.3%
Simplified21.6%
sqrt-prod20.7%
associate-*l*20.2%
div-inv20.2%
clear-num20.2%
associate-*r/19.2%
*-commutative19.2%
times-frac20.2%
associate-/l/21.4%
fma-neg21.4%
associate-/l/20.2%
frac-times25.8%
pow225.8%
Applied egg-rr25.8%
*-commutative25.8%
fma-udef25.8%
unsub-neg25.8%
associate-/r*26.0%
*-commutative26.0%
Simplified26.0%
Taylor expanded in c0 around -inf 6.6%
Simplified6.0%
Taylor expanded in c0 around 0 42.9%
*-commutative42.9%
*-commutative42.9%
associate-/l*43.5%
*-commutative43.5%
unpow243.5%
unpow243.5%
unpow243.5%
times-frac52.6%
unpow252.6%
Simplified52.6%
if 4.2e133 < (*.f64 M M) Initial program 15.8%
associate-*l*15.7%
difference-of-squares43.1%
associate-*l*43.1%
associate-*l*44.5%
Simplified44.5%
Taylor expanded in c0 around inf 47.9%
times-frac47.8%
unpow247.8%
unpow247.8%
unpow247.8%
*-commutative47.8%
unpow247.8%
Simplified47.8%
frac-times53.5%
Applied egg-rr53.5%
*-un-lft-identity53.5%
associate-/l*53.6%
Applied egg-rr53.6%
Final simplification52.9%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= (* M M) 1.4e-100)
0.0
(if (or (<= (* M M) 3.2e+21) (not (<= (* M M) 5.8e+48)))
(* (* (/ d D) (/ d D)) (* (/ c0 (* w w)) (/ c0 h)))
(* 0.25 (/ (* D D) (/ (* d d) (* h (* M M))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M * M) <= 1.4e-100) {
tmp = 0.0;
} else if (((M * M) <= 3.2e+21) || !((M * M) <= 5.8e+48)) {
tmp = ((d / D) * (d / D)) * ((c0 / (w * w)) * (c0 / h));
} else {
tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if ((m * m) <= 1.4d-100) then
tmp = 0.0d0
else if (((m * m) <= 3.2d+21) .or. (.not. ((m * m) <= 5.8d+48))) then
tmp = ((d_1 / d) * (d_1 / d)) * ((c0 / (w * w)) * (c0 / h))
else
tmp = 0.25d0 * ((d * d) / ((d_1 * d_1) / (h * (m * m))))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M * M) <= 1.4e-100) {
tmp = 0.0;
} else if (((M * M) <= 3.2e+21) || !((M * M) <= 5.8e+48)) {
tmp = ((d / D) * (d / D)) * ((c0 / (w * w)) * (c0 / h));
} else {
tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (M * M) <= 1.4e-100: tmp = 0.0 elif ((M * M) <= 3.2e+21) or not ((M * M) <= 5.8e+48): tmp = ((d / D) * (d / D)) * ((c0 / (w * w)) * (c0 / h)) else: tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M)))) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (Float64(M * M) <= 1.4e-100) tmp = 0.0; elseif ((Float64(M * M) <= 3.2e+21) || !(Float64(M * M) <= 5.8e+48)) tmp = Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(Float64(c0 / Float64(w * w)) * Float64(c0 / h))); else tmp = Float64(0.25 * Float64(Float64(D * D) / Float64(Float64(d * d) / Float64(h * Float64(M * M))))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((M * M) <= 1.4e-100) tmp = 0.0; elseif (((M * M) <= 3.2e+21) || ~(((M * M) <= 5.8e+48))) tmp = ((d / D) * (d / D)) * ((c0 / (w * w)) * (c0 / h)); else tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M)))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[N[(M * M), $MachinePrecision], 1.4e-100], 0.0, If[Or[LessEqual[N[(M * M), $MachinePrecision], 3.2e+21], N[Not[LessEqual[N[(M * M), $MachinePrecision], 5.8e+48]], $MachinePrecision]], N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 / N[(w * w), $MachinePrecision]), $MachinePrecision] * N[(c0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] / N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \cdot M \leq 1.4 \cdot 10^{-100}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \cdot M \leq 3.2 \cdot 10^{+21} \lor \neg \left(M \cdot M \leq 5.8 \cdot 10^{+48}\right):\\
\;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \left(\frac{c0}{w \cdot w} \cdot \frac{c0}{h}\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\
\end{array}
\end{array}
if (*.f64 M M) < 1.39999999999999998e-100Initial program 24.5%
times-frac20.5%
fma-def20.5%
associate-/r*20.5%
difference-of-squares20.5%
Simplified23.8%
Taylor expanded in c0 around -inf 9.6%
associate-*r*9.6%
distribute-rgt1-in9.6%
metadata-eval9.6%
mul0-lft42.8%
metadata-eval42.8%
mul0-lft9.6%
metadata-eval9.6%
distribute-lft1-in9.6%
*-commutative9.6%
distribute-lft1-in9.6%
metadata-eval9.6%
mul0-lft42.8%
Simplified42.8%
Taylor expanded in c0 around 0 52.3%
if 1.39999999999999998e-100 < (*.f64 M M) < 3.2e21 or 5.7999999999999998e48 < (*.f64 M M) Initial program 19.7%
associate-*l*19.7%
difference-of-squares37.4%
associate-*l*37.4%
associate-*l*38.3%
Simplified38.3%
Taylor expanded in c0 around inf 39.6%
times-frac39.5%
unpow239.5%
unpow239.5%
unpow239.5%
*-commutative39.5%
unpow239.5%
Simplified39.5%
frac-times46.3%
Applied egg-rr46.3%
Taylor expanded in c0 around 0 46.3%
associate-/r*46.4%
unpow246.4%
associate-*r/47.5%
unpow247.5%
associate-*l/47.3%
Simplified47.3%
if 3.2e21 < (*.f64 M M) < 5.7999999999999998e48Initial program 0.2%
times-frac0.2%
fma-def0.2%
times-frac0.2%
difference-of-squares0.2%
Simplified0.2%
sqrt-prod0.0%
associate-*l*0.0%
div-inv0.0%
clear-num0.0%
associate-*r/0.0%
*-commutative0.0%
times-frac0.0%
associate-/l/0.0%
fma-neg0.0%
associate-/l/0.0%
frac-times0.0%
pow20.0%
Applied egg-rr0.0%
*-commutative0.0%
fma-udef0.0%
unsub-neg0.0%
associate-/r*0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in c0 around -inf 0.0%
Simplified0.0%
Taylor expanded in c0 around 0 73.0%
associate-/l*72.8%
*-commutative72.8%
unpow272.8%
unpow272.8%
*-commutative72.8%
unpow272.8%
Simplified72.8%
Final simplification50.8%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= (* M M) 2.45e-98)
0.0
(if (or (<= (* M M) 4e+21) (not (<= (* M M) 6.5e+50)))
(* (* (/ d D) (/ d D)) (/ c0 (/ (* h (* w w)) c0)))
(* 0.25 (/ (* D D) (/ (* d d) (* h (* M M))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M * M) <= 2.45e-98) {
tmp = 0.0;
} else if (((M * M) <= 4e+21) || !((M * M) <= 6.5e+50)) {
tmp = ((d / D) * (d / D)) * (c0 / ((h * (w * w)) / c0));
} else {
tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if ((m * m) <= 2.45d-98) then
tmp = 0.0d0
else if (((m * m) <= 4d+21) .or. (.not. ((m * m) <= 6.5d+50))) then
tmp = ((d_1 / d) * (d_1 / d)) * (c0 / ((h * (w * w)) / c0))
else
tmp = 0.25d0 * ((d * d) / ((d_1 * d_1) / (h * (m * m))))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M * M) <= 2.45e-98) {
tmp = 0.0;
} else if (((M * M) <= 4e+21) || !((M * M) <= 6.5e+50)) {
tmp = ((d / D) * (d / D)) * (c0 / ((h * (w * w)) / c0));
} else {
tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (M * M) <= 2.45e-98: tmp = 0.0 elif ((M * M) <= 4e+21) or not ((M * M) <= 6.5e+50): tmp = ((d / D) * (d / D)) * (c0 / ((h * (w * w)) / c0)) else: tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M)))) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (Float64(M * M) <= 2.45e-98) tmp = 0.0; elseif ((Float64(M * M) <= 4e+21) || !(Float64(M * M) <= 6.5e+50)) tmp = Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(c0 / Float64(Float64(h * Float64(w * w)) / c0))); else tmp = Float64(0.25 * Float64(Float64(D * D) / Float64(Float64(d * d) / Float64(h * Float64(M * M))))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((M * M) <= 2.45e-98) tmp = 0.0; elseif (((M * M) <= 4e+21) || ~(((M * M) <= 6.5e+50))) tmp = ((d / D) * (d / D)) * (c0 / ((h * (w * w)) / c0)); else tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M)))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[N[(M * M), $MachinePrecision], 2.45e-98], 0.0, If[Or[LessEqual[N[(M * M), $MachinePrecision], 4e+21], N[Not[LessEqual[N[(M * M), $MachinePrecision], 6.5e+50]], $MachinePrecision]], N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(c0 / N[(N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] / N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \cdot M \leq 2.45 \cdot 10^{-98}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \cdot M \leq 4 \cdot 10^{+21} \lor \neg \left(M \cdot M \leq 6.5 \cdot 10^{+50}\right):\\
\;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{\frac{h \cdot \left(w \cdot w\right)}{c0}}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\
\end{array}
\end{array}
if (*.f64 M M) < 2.45000000000000007e-98Initial program 24.5%
times-frac20.5%
fma-def20.5%
associate-/r*20.5%
difference-of-squares20.5%
Simplified23.8%
Taylor expanded in c0 around -inf 9.6%
associate-*r*9.6%
distribute-rgt1-in9.6%
metadata-eval9.6%
mul0-lft42.8%
metadata-eval42.8%
mul0-lft9.6%
metadata-eval9.6%
distribute-lft1-in9.6%
*-commutative9.6%
distribute-lft1-in9.6%
metadata-eval9.6%
mul0-lft42.8%
Simplified42.8%
Taylor expanded in c0 around 0 52.3%
if 2.45000000000000007e-98 < (*.f64 M M) < 4e21 or 6.5000000000000003e50 < (*.f64 M M) Initial program 19.7%
associate-*l*19.7%
difference-of-squares37.4%
associate-*l*37.4%
associate-*l*38.3%
Simplified38.3%
Taylor expanded in c0 around inf 39.6%
times-frac39.5%
unpow239.5%
unpow239.5%
unpow239.5%
*-commutative39.5%
unpow239.5%
Simplified39.5%
frac-times46.3%
Applied egg-rr46.3%
*-un-lft-identity46.3%
associate-/l*48.2%
Applied egg-rr48.2%
if 4e21 < (*.f64 M M) < 6.5000000000000003e50Initial program 0.2%
times-frac0.2%
fma-def0.2%
times-frac0.2%
difference-of-squares0.2%
Simplified0.2%
sqrt-prod0.0%
associate-*l*0.0%
div-inv0.0%
clear-num0.0%
associate-*r/0.0%
*-commutative0.0%
times-frac0.0%
associate-/l/0.0%
fma-neg0.0%
associate-/l/0.0%
frac-times0.0%
pow20.0%
Applied egg-rr0.0%
*-commutative0.0%
fma-udef0.0%
unsub-neg0.0%
associate-/r*0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in c0 around -inf 0.0%
Simplified0.0%
Taylor expanded in c0 around 0 73.0%
associate-/l*72.8%
*-commutative72.8%
unpow272.8%
unpow272.8%
*-commutative72.8%
unpow272.8%
Simplified72.8%
Final simplification51.2%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= (* d d) 6.5e-305)
0.0
(if (<= (* d d) 1.62e+308)
(* 0.25 (/ (* D D) (/ (* d d) (* h (* M M)))))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((d * d) <= 6.5e-305) {
tmp = 0.0;
} else if ((d * d) <= 1.62e+308) {
tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if ((d_1 * d_1) <= 6.5d-305) then
tmp = 0.0d0
else if ((d_1 * d_1) <= 1.62d+308) then
tmp = 0.25d0 * ((d * d) / ((d_1 * d_1) / (h * (m * m))))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((d * d) <= 6.5e-305) {
tmp = 0.0;
} else if ((d * d) <= 1.62e+308) {
tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (d * d) <= 6.5e-305: tmp = 0.0 elif (d * d) <= 1.62e+308: tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M)))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (Float64(d * d) <= 6.5e-305) tmp = 0.0; elseif (Float64(d * d) <= 1.62e+308) tmp = Float64(0.25 * Float64(Float64(D * D) / Float64(Float64(d * d) / Float64(h * Float64(M * M))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((d * d) <= 6.5e-305) tmp = 0.0; elseif ((d * d) <= 1.62e+308) tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M)))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[N[(d * d), $MachinePrecision], 6.5e-305], 0.0, If[LessEqual[N[(d * d), $MachinePrecision], 1.62e+308], N[(0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] / N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \cdot d \leq 6.5 \cdot 10^{-305}:\\
\;\;\;\;0\\
\mathbf{elif}\;d \cdot d \leq 1.62 \cdot 10^{+308}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if (*.f64 d d) < 6.49999999999999991e-305 or 1.62e308 < (*.f64 d d) Initial program 16.1%
times-frac16.0%
fma-def16.1%
associate-/r*16.1%
difference-of-squares20.3%
Simplified25.6%
Taylor expanded in c0 around -inf 0.2%
associate-*r*0.2%
distribute-rgt1-in0.2%
metadata-eval0.2%
mul0-lft36.3%
metadata-eval36.3%
mul0-lft0.2%
metadata-eval0.2%
distribute-lft1-in0.2%
*-commutative0.2%
distribute-lft1-in0.2%
metadata-eval0.2%
mul0-lft36.3%
Simplified36.3%
Taylor expanded in c0 around 0 42.3%
if 6.49999999999999991e-305 < (*.f64 d d) < 1.62e308Initial program 26.8%
times-frac22.7%
fma-def22.7%
times-frac22.7%
difference-of-squares32.3%
Simplified33.0%
sqrt-prod31.8%
associate-*l*31.1%
div-inv31.1%
clear-num31.1%
associate-*r/29.7%
*-commutative29.7%
times-frac31.1%
associate-/l/32.5%
fma-neg32.5%
associate-/l/31.1%
frac-times32.5%
pow232.5%
Applied egg-rr32.5%
*-commutative32.5%
fma-udef32.5%
unsub-neg32.5%
associate-/r*32.7%
*-commutative32.7%
Simplified32.7%
Taylor expanded in c0 around -inf 9.8%
Simplified9.0%
Taylor expanded in c0 around 0 47.5%
associate-/l*46.8%
*-commutative46.8%
unpow246.8%
unpow246.8%
*-commutative46.8%
unpow246.8%
Simplified46.8%
Final simplification44.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 21.8%
times-frac19.6%
fma-def19.6%
associate-/r*19.6%
difference-of-squares26.7%
Simplified30.0%
Taylor expanded in c0 around -inf 5.4%
associate-*r*5.4%
distribute-rgt1-in5.4%
metadata-eval5.4%
mul0-lft31.4%
metadata-eval31.4%
mul0-lft5.4%
metadata-eval5.4%
distribute-lft1-in5.4%
*-commutative5.4%
distribute-lft1-in5.4%
metadata-eval5.4%
mul0-lft31.4%
Simplified31.4%
Taylor expanded in c0 around 0 37.2%
Final simplification37.2%
herbie shell --seed 2023195
(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))))))