
(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 9 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)
(/
(* c0 (pow (* (* (sqrt (/ c0 (* w h))) (/ d D)) (sqrt 2.0)) 2.0))
(* 2.0 w))
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 tmp;
if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= ((double) INFINITY)) {
tmp = (c0 * pow(((sqrt((c0 / (w * h))) * (d / D)) * sqrt(2.0)), 2.0)) / (2.0 * w);
} 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 tmp;
if (((c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = (c0 * Math.pow(((Math.sqrt((c0 / (w * h))) * (d / D)) * Math.sqrt(2.0)), 2.0)) / (2.0 * w);
} else {
tmp = 0.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 = (c0 * math.pow(((math.sqrt((c0 / (w * h))) * (d / D)) * math.sqrt(2.0)), 2.0)) / (2.0 * w) 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))) 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(c0 * (Float64(Float64(sqrt(Float64(c0 / Float64(w * h))) * Float64(d / D)) * sqrt(2.0)) ^ 2.0)) / Float64(2.0 * w)); 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)); tmp = 0.0; if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= Inf) tmp = (c0 * (((sqrt((c0 / (w * h))) * (d / D)) * sqrt(2.0)) ^ 2.0)) / (2.0 * w); 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]}, 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[(c0 * N[Power[N[(N[(N[Sqrt[N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], 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)}\\
\mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;\frac{c0 \cdot {\left(\left(\sqrt{\frac{c0}{w \cdot h}} \cdot \frac{d}{D}\right) \cdot \sqrt{2}\right)}^{2}}{2 \cdot w}\\
\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 77.0%
+-commutative77.0%
+-commutative77.0%
times-frac74.2%
fma-neg74.2%
Simplified76.7%
Taylor expanded in c0 around inf 79.0%
*-commutative79.0%
associate-/l/80.1%
associate-*l/80.0%
associate-/l*78.8%
*-commutative78.8%
Simplified78.8%
expm1-log1p-u46.9%
expm1-udef49.3%
Applied egg-rr49.2%
expm1-def46.7%
expm1-log1p77.3%
*-commutative77.3%
associate-/l*77.3%
associate-/r*80.0%
Simplified80.0%
associate-*l/82.4%
associate-/r/82.4%
associate-/l/81.2%
*-commutative81.2%
Applied egg-rr81.2%
Applied egg-rr84.3%
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%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified0.7%
Taylor expanded in c0 around -inf 2.2%
mul-1-neg2.2%
distribute-lft-in0.4%
Simplified42.0%
Taylor expanded in c0 around 0 47.0%
Final simplification58.2%
(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)
(/
(* c0 (/ (* 2.0 (/ (* c0 (pow d 2.0)) (pow D 2.0))) (* w h)))
(* 2.0 w))
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 tmp;
if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= ((double) INFINITY)) {
tmp = (c0 * ((2.0 * ((c0 * pow(d, 2.0)) / pow(D, 2.0))) / (w * h))) / (2.0 * w);
} 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 tmp;
if (((c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = (c0 * ((2.0 * ((c0 * Math.pow(d, 2.0)) / Math.pow(D, 2.0))) / (w * h))) / (2.0 * w);
} else {
tmp = 0.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 = (c0 * ((2.0 * ((c0 * math.pow(d, 2.0)) / math.pow(D, 2.0))) / (w * h))) / (2.0 * w) 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))) 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(c0 * Float64(Float64(2.0 * Float64(Float64(c0 * (d ^ 2.0)) / (D ^ 2.0))) / Float64(w * h))) / Float64(2.0 * w)); 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)); tmp = 0.0; if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= Inf) tmp = (c0 * ((2.0 * ((c0 * (d ^ 2.0)) / (D ^ 2.0))) / (w * h))) / (2.0 * w); 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]}, 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[(c0 * N[(N[(2.0 * N[(N[(c0 * N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[D, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], 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)}\\
\mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;\frac{c0 \cdot \frac{2 \cdot \frac{c0 \cdot {d}^{2}}{{D}^{2}}}{w \cdot h}}{2 \cdot w}\\
\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 77.0%
+-commutative77.0%
+-commutative77.0%
times-frac74.2%
fma-neg74.2%
Simplified76.7%
Taylor expanded in c0 around inf 79.0%
*-commutative79.0%
associate-/l/80.1%
associate-*l/80.0%
associate-/l*78.8%
*-commutative78.8%
Simplified78.8%
expm1-log1p-u46.9%
expm1-udef49.3%
Applied egg-rr49.2%
expm1-def46.7%
expm1-log1p77.3%
*-commutative77.3%
associate-/l*77.3%
associate-/r*80.0%
Simplified80.0%
associate-*l/82.4%
associate-/r/82.4%
associate-/l/81.2%
*-commutative81.2%
Applied egg-rr81.2%
Taylor expanded in d around 0 81.6%
associate-/r*84.0%
*-commutative84.0%
associate-*r/84.0%
*-commutative84.0%
Simplified84.0%
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%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified0.7%
Taylor expanded in c0 around -inf 2.2%
mul-1-neg2.2%
distribute-lft-in0.4%
Simplified42.0%
Taylor expanded in c0 around 0 47.0%
Final simplification58.1%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w))) (t_1 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
(if (<= (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M))))) INFINITY)
(* t_0 (* 2.0 (pow (* (sqrt (/ c0 (* w h))) (/ d D)) 2.0)))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= ((double) INFINITY)) {
tmp = t_0 * (2.0 * pow((sqrt((c0 / (w * h))) * (d / D)), 2.0));
} 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 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = t_0 * (2.0 * Math.pow((Math.sqrt((c0 / (w * h))) * (d / D)), 2.0));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) t_1 = (c0 * (d * d)) / ((w * h) * (D * D)) tmp = 0 if (t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))) <= math.inf: tmp = t_0 * (2.0 * math.pow((math.sqrt((c0 / (w * h))) * (d / D)), 2.0)) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) tmp = 0.0 if (Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= Inf) tmp = Float64(t_0 * Float64(2.0 * (Float64(sqrt(Float64(c0 / Float64(w * h))) * Float64(d / D)) ^ 2.0))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); t_1 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = 0.0; if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= Inf) tmp = t_0 * (2.0 * ((sqrt((c0 / (w * h))) * (d / D)) ^ 2.0)); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 * N[(2.0 * N[Power[N[(N[Sqrt[N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;t\_0 \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_1 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;t\_0 \cdot \left(2 \cdot {\left(\sqrt{\frac{c0}{w \cdot h}} \cdot \frac{d}{D}\right)}^{2}\right)\\
\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 77.0%
+-commutative77.0%
+-commutative77.0%
times-frac74.2%
fma-neg74.2%
Simplified76.7%
Taylor expanded in c0 around inf 79.0%
*-commutative79.0%
associate-/l/80.1%
associate-*l/80.0%
associate-/l*78.8%
*-commutative78.8%
Simplified78.8%
add-cbrt-cube77.3%
pow1/377.0%
pow377.0%
clear-num77.0%
unpow277.0%
unpow277.0%
frac-times77.0%
pow277.0%
pow-flip77.0%
metadata-eval77.0%
Applied egg-rr77.0%
Applied egg-rr83.2%
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%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified0.7%
Taylor expanded in c0 around -inf 2.2%
mul-1-neg2.2%
distribute-lft-in0.4%
Simplified42.0%
Taylor expanded in c0 around 0 47.0%
Final simplification57.9%
(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)
(* (* c0 (/ 2.0 (/ (pow (/ d D) -2.0) (/ c0 (* w h))))) (/ 1.0 (* 2.0 w)))
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 tmp;
if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= ((double) INFINITY)) {
tmp = (c0 * (2.0 / (pow((d / D), -2.0) / (c0 / (w * h))))) * (1.0 / (2.0 * w));
} 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 tmp;
if (((c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = (c0 * (2.0 / (Math.pow((d / D), -2.0) / (c0 / (w * h))))) * (1.0 / (2.0 * w));
} else {
tmp = 0.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 = (c0 * (2.0 / (math.pow((d / D), -2.0) / (c0 / (w * h))))) * (1.0 / (2.0 * w)) 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))) 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(c0 * Float64(2.0 / Float64((Float64(d / D) ^ -2.0) / Float64(c0 / Float64(w * h))))) * Float64(1.0 / Float64(2.0 * w))); 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)); tmp = 0.0; if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= Inf) tmp = (c0 * (2.0 / (((d / D) ^ -2.0) / (c0 / (w * h))))) * (1.0 / (2.0 * w)); 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]}, 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[(c0 * N[(2.0 / N[(N[Power[N[(d / D), $MachinePrecision], -2.0], $MachinePrecision] / N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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)}\\
\mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;\left(c0 \cdot \frac{2}{\frac{{\left(\frac{d}{D}\right)}^{-2}}{\frac{c0}{w \cdot h}}}\right) \cdot \frac{1}{2 \cdot w}\\
\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 77.0%
+-commutative77.0%
+-commutative77.0%
times-frac74.2%
fma-neg74.2%
Simplified76.7%
Taylor expanded in c0 around inf 79.0%
*-commutative79.0%
associate-/l/80.1%
associate-*l/80.0%
associate-/l*78.8%
*-commutative78.8%
Simplified78.8%
expm1-log1p-u46.9%
expm1-udef49.3%
Applied egg-rr49.2%
expm1-def46.7%
expm1-log1p77.3%
*-commutative77.3%
associate-/l*77.3%
associate-/r*80.0%
Simplified80.0%
associate-*l/82.4%
associate-/r/82.4%
associate-/l/81.2%
*-commutative81.2%
Applied egg-rr81.2%
div-inv81.2%
*-commutative81.2%
associate-/l/82.4%
associate-/r/82.4%
*-commutative82.4%
Applied egg-rr82.4%
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%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified0.7%
Taylor expanded in c0 around -inf 2.2%
mul-1-neg2.2%
distribute-lft-in0.4%
Simplified42.0%
Taylor expanded in c0 around 0 47.0%
Final simplification57.6%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ 1.0 (/ d D))))
(if (<= w -2.6e-52)
0.0
(if (<= w 1.6e-73)
(* (/ c0 (* 2.0 w)) (/ 2.0 (/ (* t_0 t_0) (/ (/ c0 w) h))))
(if (<= w 5.8e-14)
0.0
(if (<= w 2.9e+65)
(/ (* (/ c0 2.0) (* (/ c0 w) (* 2.0 (pow (/ d D) 2.0)))) (* w h))
0.0))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = 1.0 / (d / D);
double tmp;
if (w <= -2.6e-52) {
tmp = 0.0;
} else if (w <= 1.6e-73) {
tmp = (c0 / (2.0 * w)) * (2.0 / ((t_0 * t_0) / ((c0 / w) / h)));
} else if (w <= 5.8e-14) {
tmp = 0.0;
} else if (w <= 2.9e+65) {
tmp = ((c0 / 2.0) * ((c0 / w) * (2.0 * pow((d / D), 2.0)))) / (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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 / (d_1 / d)
if (w <= (-2.6d-52)) then
tmp = 0.0d0
else if (w <= 1.6d-73) then
tmp = (c0 / (2.0d0 * w)) * (2.0d0 / ((t_0 * t_0) / ((c0 / w) / h)))
else if (w <= 5.8d-14) then
tmp = 0.0d0
else if (w <= 2.9d+65) then
tmp = ((c0 / 2.0d0) * ((c0 / w) * (2.0d0 * ((d_1 / d) ** 2.0d0)))) / (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 t_0 = 1.0 / (d / D);
double tmp;
if (w <= -2.6e-52) {
tmp = 0.0;
} else if (w <= 1.6e-73) {
tmp = (c0 / (2.0 * w)) * (2.0 / ((t_0 * t_0) / ((c0 / w) / h)));
} else if (w <= 5.8e-14) {
tmp = 0.0;
} else if (w <= 2.9e+65) {
tmp = ((c0 / 2.0) * ((c0 / w) * (2.0 * Math.pow((d / D), 2.0)))) / (w * h);
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = 1.0 / (d / D) tmp = 0 if w <= -2.6e-52: tmp = 0.0 elif w <= 1.6e-73: tmp = (c0 / (2.0 * w)) * (2.0 / ((t_0 * t_0) / ((c0 / w) / h))) elif w <= 5.8e-14: tmp = 0.0 elif w <= 2.9e+65: tmp = ((c0 / 2.0) * ((c0 / w) * (2.0 * math.pow((d / D), 2.0)))) / (w * h) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(1.0 / Float64(d / D)) tmp = 0.0 if (w <= -2.6e-52) tmp = 0.0; elseif (w <= 1.6e-73) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 / Float64(Float64(t_0 * t_0) / Float64(Float64(c0 / w) / h)))); elseif (w <= 5.8e-14) tmp = 0.0; elseif (w <= 2.9e+65) tmp = Float64(Float64(Float64(c0 / 2.0) * Float64(Float64(c0 / w) * Float64(2.0 * (Float64(d / D) ^ 2.0)))) / Float64(w * h)); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = 1.0 / (d / D); tmp = 0.0; if (w <= -2.6e-52) tmp = 0.0; elseif (w <= 1.6e-73) tmp = (c0 / (2.0 * w)) * (2.0 / ((t_0 * t_0) / ((c0 / w) / h))); elseif (w <= 5.8e-14) tmp = 0.0; elseif (w <= 2.9e+65) tmp = ((c0 / 2.0) * ((c0 / w) * (2.0 * ((d / D) ^ 2.0)))) / (w * h); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(1.0 / N[(d / D), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -2.6e-52], 0.0, If[LessEqual[w, 1.6e-73], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 / N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, 5.8e-14], 0.0, If[LessEqual[w, 2.9e+65], N[(N[(N[(c0 / 2.0), $MachinePrecision] * N[(N[(c0 / w), $MachinePrecision] * N[(2.0 * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision], 0.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\frac{d}{D}}\\
\mathbf{if}\;w \leq -2.6 \cdot 10^{-52}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 1.6 \cdot 10^{-73}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{2}{\frac{t\_0 \cdot t\_0}{\frac{\frac{c0}{w}}{h}}}\\
\mathbf{elif}\;w \leq 5.8 \cdot 10^{-14}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 2.9 \cdot 10^{+65}:\\
\;\;\;\;\frac{\frac{c0}{2} \cdot \left(\frac{c0}{w} \cdot \left(2 \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)}{w \cdot h}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -2.5999999999999999e-52 or 1.59999999999999993e-73 < w < 5.8000000000000005e-14 or 2.9e65 < w Initial program 13.4%
+-commutative13.4%
+-commutative13.4%
times-frac12.3%
fma-neg12.3%
Simplified13.4%
Taylor expanded in c0 around -inf 6.0%
mul-1-neg6.0%
distribute-lft-in2.8%
Simplified52.0%
Taylor expanded in c0 around 0 52.1%
if -2.5999999999999999e-52 < w < 1.59999999999999993e-73Initial program 29.2%
+-commutative29.2%
+-commutative29.2%
times-frac28.5%
fma-neg28.5%
Simplified29.2%
Taylor expanded in c0 around inf 42.2%
*-commutative42.2%
associate-/l/42.2%
associate-*l/42.2%
associate-/l*41.5%
*-commutative41.5%
Simplified41.5%
expm1-log1p-u21.6%
expm1-udef21.6%
Applied egg-rr25.7%
expm1-def27.1%
expm1-log1p49.2%
*-commutative49.2%
associate-/l*49.2%
associate-/r*50.8%
Simplified50.8%
metadata-eval50.8%
pow-prod-up50.8%
unpow-150.8%
unpow-150.8%
Applied egg-rr50.8%
associate-/l/52.3%
div-inv52.3%
Applied egg-rr52.3%
associate-*r/52.3%
*-rgt-identity52.3%
Simplified52.3%
if 5.8000000000000005e-14 < w < 2.9e65Initial program 33.8%
+-commutative33.8%
+-commutative33.8%
times-frac33.8%
fma-neg33.8%
Simplified39.4%
Taylor expanded in c0 around inf 39.7%
*-commutative39.7%
associate-/l/50.3%
associate-*l/50.3%
associate-/l*50.6%
*-commutative50.6%
Simplified50.6%
expm1-log1p-u28.2%
expm1-udef28.2%
Applied egg-rr41.4%
expm1-def34.2%
expm1-log1p62.3%
*-commutative62.3%
associate-/l*62.4%
associate-/r*62.4%
Simplified62.4%
metadata-eval62.4%
pow-prod-up62.2%
unpow-162.2%
unpow-162.2%
Applied egg-rr62.2%
associate-/r*62.2%
pow262.2%
inv-pow62.2%
pow-pow62.4%
metadata-eval62.4%
pow-to-exp28.4%
*-commutative28.4%
associate-/r/28.4%
*-commutative28.4%
pow-to-exp62.4%
associate-/l/62.4%
associate-*r/62.4%
frac-times69.6%
Applied egg-rr69.5%
Final simplification53.4%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= w -1.9e-52)
0.0
(if (or (<= w 3.1e-73) (and (not (<= w 2.2e-16)) (<= w 6.5e+65)))
(*
(/ c0 (* 2.0 w))
(* 2.0 (/ (/ c0 (* w h)) (/ (* D (/ 1.0 d)) (/ d D)))))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (w <= -1.9e-52) {
tmp = 0.0;
} else if ((w <= 3.1e-73) || (!(w <= 2.2e-16) && (w <= 6.5e+65))) {
tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / (w * h)) / ((D * (1.0 / 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 (w <= (-1.9d-52)) then
tmp = 0.0d0
else if ((w <= 3.1d-73) .or. (.not. (w <= 2.2d-16)) .and. (w <= 6.5d+65)) then
tmp = (c0 / (2.0d0 * w)) * (2.0d0 * ((c0 / (w * h)) / ((d * (1.0d0 / d_1)) / (d_1 / d))))
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 (w <= -1.9e-52) {
tmp = 0.0;
} else if ((w <= 3.1e-73) || (!(w <= 2.2e-16) && (w <= 6.5e+65))) {
tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / (w * h)) / ((D * (1.0 / d)) / (d / D))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if w <= -1.9e-52: tmp = 0.0 elif (w <= 3.1e-73) or (not (w <= 2.2e-16) and (w <= 6.5e+65)): tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / (w * h)) / ((D * (1.0 / d)) / (d / D)))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (w <= -1.9e-52) tmp = 0.0; elseif ((w <= 3.1e-73) || (!(w <= 2.2e-16) && (w <= 6.5e+65))) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(Float64(c0 / Float64(w * h)) / Float64(Float64(D * Float64(1.0 / 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 (w <= -1.9e-52) tmp = 0.0; elseif ((w <= 3.1e-73) || (~((w <= 2.2e-16)) && (w <= 6.5e+65))) tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / (w * h)) / ((D * (1.0 / d)) / (d / D)))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[w, -1.9e-52], 0.0, If[Or[LessEqual[w, 3.1e-73], And[N[Not[LessEqual[w, 2.2e-16]], $MachinePrecision], LessEqual[w, 6.5e+65]]], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] / N[(N[(D * N[(1.0 / d), $MachinePrecision]), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.9 \cdot 10^{-52}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 3.1 \cdot 10^{-73} \lor \neg \left(w \leq 2.2 \cdot 10^{-16}\right) \land w \leq 6.5 \cdot 10^{+65}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\frac{c0}{w \cdot h}}{\frac{D \cdot \frac{1}{d}}{\frac{d}{D}}}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -1.9000000000000002e-52 or 3.09999999999999969e-73 < w < 2.2e-16 or 6.5000000000000003e65 < w Initial program 13.4%
+-commutative13.4%
+-commutative13.4%
times-frac12.3%
fma-neg12.3%
Simplified13.4%
Taylor expanded in c0 around -inf 6.0%
mul-1-neg6.0%
distribute-lft-in2.8%
Simplified52.0%
Taylor expanded in c0 around 0 52.1%
if -1.9000000000000002e-52 < w < 3.09999999999999969e-73 or 2.2e-16 < w < 6.5000000000000003e65Initial program 29.7%
+-commutative29.7%
+-commutative29.7%
times-frac29.1%
fma-neg29.1%
Simplified30.4%
Taylor expanded in c0 around inf 41.9%
*-commutative41.9%
associate-/l/43.2%
associate-*l/43.2%
associate-/l*42.6%
*-commutative42.6%
Simplified42.6%
add-cbrt-cube41.9%
pow1/341.7%
pow341.7%
clear-num41.7%
unpow241.7%
unpow241.7%
frac-times46.4%
pow246.4%
pow-flip46.4%
metadata-eval46.4%
Applied egg-rr46.4%
unpow1/346.7%
rem-cbrt-cube52.2%
metadata-eval52.2%
pow-div52.2%
inv-pow52.2%
pow152.2%
associate-/r/52.2%
Applied egg-rr52.2%
Final simplification52.1%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* w h))) (t_1 (/ c0 (* 2.0 w))))
(if (<= w -4.8e-53)
0.0
(if (<= w 2.1e-73)
(* t_1 (* 2.0 (/ t_0 (/ (* D (/ 1.0 d)) (/ d D)))))
(if (<= w 1.2e-9)
0.0
(if (<= w 1.1e+65)
(* t_1 (/ 2.0 (/ (* (/ 1.0 (/ d D)) (/ D d)) t_0)))
0.0))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (w * h);
double t_1 = c0 / (2.0 * w);
double tmp;
if (w <= -4.8e-53) {
tmp = 0.0;
} else if (w <= 2.1e-73) {
tmp = t_1 * (2.0 * (t_0 / ((D * (1.0 / d)) / (d / D))));
} else if (w <= 1.2e-9) {
tmp = 0.0;
} else if (w <= 1.1e+65) {
tmp = t_1 * (2.0 / (((1.0 / (d / D)) * (D / d)) / t_0));
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = c0 / (w * h)
t_1 = c0 / (2.0d0 * w)
if (w <= (-4.8d-53)) then
tmp = 0.0d0
else if (w <= 2.1d-73) then
tmp = t_1 * (2.0d0 * (t_0 / ((d * (1.0d0 / d_1)) / (d_1 / d))))
else if (w <= 1.2d-9) then
tmp = 0.0d0
else if (w <= 1.1d+65) then
tmp = t_1 * (2.0d0 / (((1.0d0 / (d_1 / d)) * (d / d_1)) / t_0))
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 t_0 = c0 / (w * h);
double t_1 = c0 / (2.0 * w);
double tmp;
if (w <= -4.8e-53) {
tmp = 0.0;
} else if (w <= 2.1e-73) {
tmp = t_1 * (2.0 * (t_0 / ((D * (1.0 / d)) / (d / D))));
} else if (w <= 1.2e-9) {
tmp = 0.0;
} else if (w <= 1.1e+65) {
tmp = t_1 * (2.0 / (((1.0 / (d / D)) * (D / d)) / t_0));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (w * h) t_1 = c0 / (2.0 * w) tmp = 0 if w <= -4.8e-53: tmp = 0.0 elif w <= 2.1e-73: tmp = t_1 * (2.0 * (t_0 / ((D * (1.0 / d)) / (d / D)))) elif w <= 1.2e-9: tmp = 0.0 elif w <= 1.1e+65: tmp = t_1 * (2.0 / (((1.0 / (d / D)) * (D / d)) / t_0)) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(w * h)) t_1 = Float64(c0 / Float64(2.0 * w)) tmp = 0.0 if (w <= -4.8e-53) tmp = 0.0; elseif (w <= 2.1e-73) tmp = Float64(t_1 * Float64(2.0 * Float64(t_0 / Float64(Float64(D * Float64(1.0 / d)) / Float64(d / D))))); elseif (w <= 1.2e-9) tmp = 0.0; elseif (w <= 1.1e+65) tmp = Float64(t_1 * Float64(2.0 / Float64(Float64(Float64(1.0 / Float64(d / D)) * Float64(D / d)) / t_0))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (w * h); t_1 = c0 / (2.0 * w); tmp = 0.0; if (w <= -4.8e-53) tmp = 0.0; elseif (w <= 2.1e-73) tmp = t_1 * (2.0 * (t_0 / ((D * (1.0 / d)) / (d / D)))); elseif (w <= 1.2e-9) tmp = 0.0; elseif (w <= 1.1e+65) tmp = t_1 * (2.0 / (((1.0 / (d / D)) * (D / d)) / t_0)); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -4.8e-53], 0.0, If[LessEqual[w, 2.1e-73], N[(t$95$1 * N[(2.0 * N[(t$95$0 / N[(N[(D * N[(1.0 / d), $MachinePrecision]), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, 1.2e-9], 0.0, If[LessEqual[w, 1.1e+65], N[(t$95$1 * N[(2.0 / N[(N[(N[(1.0 / N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;w \leq -4.8 \cdot 10^{-53}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 2.1 \cdot 10^{-73}:\\
\;\;\;\;t\_1 \cdot \left(2 \cdot \frac{t\_0}{\frac{D \cdot \frac{1}{d}}{\frac{d}{D}}}\right)\\
\mathbf{elif}\;w \leq 1.2 \cdot 10^{-9}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 1.1 \cdot 10^{+65}:\\
\;\;\;\;t\_1 \cdot \frac{2}{\frac{\frac{1}{\frac{d}{D}} \cdot \frac{D}{d}}{t\_0}}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -4.80000000000000015e-53 or 2.0999999999999999e-73 < w < 1.2e-9 or 1.0999999999999999e65 < w Initial program 13.4%
+-commutative13.4%
+-commutative13.4%
times-frac12.3%
fma-neg12.3%
Simplified13.4%
Taylor expanded in c0 around -inf 6.0%
mul-1-neg6.0%
distribute-lft-in2.8%
Simplified52.0%
Taylor expanded in c0 around 0 52.1%
if -4.80000000000000015e-53 < w < 2.0999999999999999e-73Initial program 29.2%
+-commutative29.2%
+-commutative29.2%
times-frac28.5%
fma-neg28.5%
Simplified29.2%
Taylor expanded in c0 around inf 42.2%
*-commutative42.2%
associate-/l/42.2%
associate-*l/42.2%
associate-/l*41.5%
*-commutative41.5%
Simplified41.5%
add-cbrt-cube40.7%
pow1/340.6%
pow340.6%
clear-num40.6%
unpow240.6%
unpow240.6%
frac-times45.1%
pow245.1%
pow-flip45.1%
metadata-eval45.1%
Applied egg-rr45.1%
unpow1/345.4%
rem-cbrt-cube50.8%
metadata-eval50.8%
pow-div50.8%
inv-pow50.8%
pow150.8%
associate-/r/50.8%
Applied egg-rr50.8%
if 1.2e-9 < w < 1.0999999999999999e65Initial program 33.8%
+-commutative33.8%
+-commutative33.8%
times-frac33.8%
fma-neg33.8%
Simplified39.4%
Taylor expanded in c0 around inf 39.7%
*-commutative39.7%
associate-/l/50.3%
associate-*l/50.3%
associate-/l*50.6%
*-commutative50.6%
Simplified50.6%
expm1-log1p-u28.2%
expm1-udef28.2%
Applied egg-rr41.4%
expm1-def34.2%
expm1-log1p62.3%
*-commutative62.3%
associate-/l*62.4%
associate-/r*62.4%
Simplified62.4%
metadata-eval62.4%
pow-prod-up62.2%
unpow-162.2%
unpow-162.2%
Applied egg-rr62.2%
Taylor expanded in d around 0 62.4%
Final simplification52.1%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ 1.0 (/ d D))) (t_1 (/ c0 (* 2.0 w))))
(if (<= w -2.1e-53)
0.0
(if (<= w 2.9e-73)
(* t_1 (/ 2.0 (/ (* t_0 t_0) (/ (/ c0 w) h))))
(if (<= w 6.2e-12)
0.0
(if (<= w 2.6e+64)
(* t_1 (/ 2.0 (/ (* t_0 (/ D d)) (/ c0 (* w h)))))
0.0))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = 1.0 / (d / D);
double t_1 = c0 / (2.0 * w);
double tmp;
if (w <= -2.1e-53) {
tmp = 0.0;
} else if (w <= 2.9e-73) {
tmp = t_1 * (2.0 / ((t_0 * t_0) / ((c0 / w) / h)));
} else if (w <= 6.2e-12) {
tmp = 0.0;
} else if (w <= 2.6e+64) {
tmp = t_1 * (2.0 / ((t_0 * (D / d)) / (c0 / (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 / (d_1 / d)
t_1 = c0 / (2.0d0 * w)
if (w <= (-2.1d-53)) then
tmp = 0.0d0
else if (w <= 2.9d-73) then
tmp = t_1 * (2.0d0 / ((t_0 * t_0) / ((c0 / w) / h)))
else if (w <= 6.2d-12) then
tmp = 0.0d0
else if (w <= 2.6d+64) then
tmp = t_1 * (2.0d0 / ((t_0 * (d / d_1)) / (c0 / (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 t_0 = 1.0 / (d / D);
double t_1 = c0 / (2.0 * w);
double tmp;
if (w <= -2.1e-53) {
tmp = 0.0;
} else if (w <= 2.9e-73) {
tmp = t_1 * (2.0 / ((t_0 * t_0) / ((c0 / w) / h)));
} else if (w <= 6.2e-12) {
tmp = 0.0;
} else if (w <= 2.6e+64) {
tmp = t_1 * (2.0 / ((t_0 * (D / d)) / (c0 / (w * h))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = 1.0 / (d / D) t_1 = c0 / (2.0 * w) tmp = 0 if w <= -2.1e-53: tmp = 0.0 elif w <= 2.9e-73: tmp = t_1 * (2.0 / ((t_0 * t_0) / ((c0 / w) / h))) elif w <= 6.2e-12: tmp = 0.0 elif w <= 2.6e+64: tmp = t_1 * (2.0 / ((t_0 * (D / d)) / (c0 / (w * h)))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(1.0 / Float64(d / D)) t_1 = Float64(c0 / Float64(2.0 * w)) tmp = 0.0 if (w <= -2.1e-53) tmp = 0.0; elseif (w <= 2.9e-73) tmp = Float64(t_1 * Float64(2.0 / Float64(Float64(t_0 * t_0) / Float64(Float64(c0 / w) / h)))); elseif (w <= 6.2e-12) tmp = 0.0; elseif (w <= 2.6e+64) tmp = Float64(t_1 * Float64(2.0 / Float64(Float64(t_0 * Float64(D / d)) / Float64(c0 / Float64(w * h))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = 1.0 / (d / D); t_1 = c0 / (2.0 * w); tmp = 0.0; if (w <= -2.1e-53) tmp = 0.0; elseif (w <= 2.9e-73) tmp = t_1 * (2.0 / ((t_0 * t_0) / ((c0 / w) / h))); elseif (w <= 6.2e-12) tmp = 0.0; elseif (w <= 2.6e+64) tmp = t_1 * (2.0 / ((t_0 * (D / d)) / (c0 / (w * h)))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(1.0 / N[(d / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -2.1e-53], 0.0, If[LessEqual[w, 2.9e-73], N[(t$95$1 * N[(2.0 / N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, 6.2e-12], 0.0, If[LessEqual[w, 2.6e+64], N[(t$95$1 * N[(2.0 / N[(N[(t$95$0 * N[(D / d), $MachinePrecision]), $MachinePrecision] / N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\frac{d}{D}}\\
t_1 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;w \leq -2.1 \cdot 10^{-53}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 2.9 \cdot 10^{-73}:\\
\;\;\;\;t\_1 \cdot \frac{2}{\frac{t\_0 \cdot t\_0}{\frac{\frac{c0}{w}}{h}}}\\
\mathbf{elif}\;w \leq 6.2 \cdot 10^{-12}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 2.6 \cdot 10^{+64}:\\
\;\;\;\;t\_1 \cdot \frac{2}{\frac{t\_0 \cdot \frac{D}{d}}{\frac{c0}{w \cdot h}}}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -2.09999999999999977e-53 or 2.9e-73 < w < 6.2000000000000002e-12 or 2.59999999999999997e64 < w Initial program 13.4%
+-commutative13.4%
+-commutative13.4%
times-frac12.3%
fma-neg12.3%
Simplified13.4%
Taylor expanded in c0 around -inf 6.0%
mul-1-neg6.0%
distribute-lft-in2.8%
Simplified52.0%
Taylor expanded in c0 around 0 52.1%
if -2.09999999999999977e-53 < w < 2.9e-73Initial program 29.2%
+-commutative29.2%
+-commutative29.2%
times-frac28.5%
fma-neg28.5%
Simplified29.2%
Taylor expanded in c0 around inf 42.2%
*-commutative42.2%
associate-/l/42.2%
associate-*l/42.2%
associate-/l*41.5%
*-commutative41.5%
Simplified41.5%
expm1-log1p-u21.6%
expm1-udef21.6%
Applied egg-rr25.7%
expm1-def27.1%
expm1-log1p49.2%
*-commutative49.2%
associate-/l*49.2%
associate-/r*50.8%
Simplified50.8%
metadata-eval50.8%
pow-prod-up50.8%
unpow-150.8%
unpow-150.8%
Applied egg-rr50.8%
associate-/l/52.3%
div-inv52.3%
Applied egg-rr52.3%
associate-*r/52.3%
*-rgt-identity52.3%
Simplified52.3%
if 6.2000000000000002e-12 < w < 2.59999999999999997e64Initial program 33.8%
+-commutative33.8%
+-commutative33.8%
times-frac33.8%
fma-neg33.8%
Simplified39.4%
Taylor expanded in c0 around inf 39.7%
*-commutative39.7%
associate-/l/50.3%
associate-*l/50.3%
associate-/l*50.6%
*-commutative50.6%
Simplified50.6%
expm1-log1p-u28.2%
expm1-udef28.2%
Applied egg-rr41.4%
expm1-def34.2%
expm1-log1p62.3%
*-commutative62.3%
associate-/l*62.4%
associate-/r*62.4%
Simplified62.4%
metadata-eval62.4%
pow-prod-up62.2%
unpow-162.2%
unpow-162.2%
Applied egg-rr62.2%
Taylor expanded in d around 0 62.4%
Final simplification52.9%
(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 23.1%
+-commutative23.1%
+-commutative23.1%
times-frac22.3%
fma-neg22.3%
Simplified23.5%
Taylor expanded in c0 around -inf 3.3%
mul-1-neg3.3%
distribute-lft-in2.0%
Simplified31.4%
Taylor expanded in c0 around 0 35.0%
Final simplification35.0%
herbie shell --seed 2024026
(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))))))