
(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 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (c0 w h D d M) :precision binary64 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))) (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) end
function tmp = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)
\end{array}
\end{array}
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w))) (t_1 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
(if (<= (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M))))) INFINITY)
(* t_0 (* 2.0 (* (/ c0 (* (* w h) D)) (/ (* d d) D))))
(*
t_0
(fma
0.5
(* (* (/ D d) (/ D d)) (/ (* w (* h (* M M))) c0))
(* c0 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 * ((c0 / ((w * h) * D)) * ((d * d) / D)));
} else {
tmp = t_0 * fma(0.5, (((D / d) * (D / d)) * ((w * (h * (M * M))) / c0)), (c0 * 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(Float64(c0 / Float64(Float64(w * h) * D)) * Float64(Float64(d * d) / D)))); else tmp = Float64(t_0 * fma(0.5, Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(w * Float64(h * Float64(M * M))) / c0)), Float64(c0 * 0.0))); end return 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[(N[(c0 / N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(0.5 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(w * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision] + N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\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(\frac{c0}{\left(w \cdot h\right) \cdot D} \cdot \frac{d \cdot d}{D}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \mathsf{fma}\left(0.5, \left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}{c0}, c0 \cdot 0\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 76.2%
Simplified74.4%
Taylor expanded in c0 around inf 78.7%
times-frac75.7%
unpow275.7%
unpow275.7%
Simplified75.7%
frac-times78.7%
*-commutative78.7%
*-commutative78.7%
associate-*r*78.8%
*-commutative78.8%
*-commutative78.8%
Applied egg-rr78.8%
times-frac82.5%
*-commutative82.5%
Applied egg-rr82.5%
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%
div-inv0.0%
associate-*l*0.0%
Applied egg-rr0.0%
Taylor expanded in c0 around -inf 4.0%
fma-def4.0%
times-frac4.5%
unpow24.5%
unpow24.5%
times-frac4.6%
*-commutative4.6%
unpow24.6%
associate-*r*4.6%
Simplified44.6%
Final simplification55.8%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= w -2.4e+124)
0.0
(if (or (<= w 2.2e-39) (and (not (<= w 0.095)) (<= w 3.3e+101)))
(* (/ c0 (* 2.0 w)) (* 2.0 (* (* (/ d D) (/ d D)) (/ c0 (* w h)))))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (w <= -2.4e+124) {
tmp = 0.0;
} else if ((w <= 2.2e-39) || (!(w <= 0.095) && (w <= 3.3e+101))) {
tmp = (c0 / (2.0 * w)) * (2.0 * (((d / D) * (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) :: tmp
if (w <= (-2.4d+124)) then
tmp = 0.0d0
else if ((w <= 2.2d-39) .or. (.not. (w <= 0.095d0)) .and. (w <= 3.3d+101)) then
tmp = (c0 / (2.0d0 * w)) * (2.0d0 * (((d_1 / d) * (d_1 / d)) * (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 tmp;
if (w <= -2.4e+124) {
tmp = 0.0;
} else if ((w <= 2.2e-39) || (!(w <= 0.095) && (w <= 3.3e+101))) {
tmp = (c0 / (2.0 * w)) * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if w <= -2.4e+124: tmp = 0.0 elif (w <= 2.2e-39) or (not (w <= 0.095) and (w <= 3.3e+101)): tmp = (c0 / (2.0 * w)) * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h)))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (w <= -2.4e+124) tmp = 0.0; elseif ((w <= 2.2e-39) || (!(w <= 0.095) && (w <= 3.3e+101))) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(Float64(Float64(d / D) * 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) tmp = 0.0; if (w <= -2.4e+124) tmp = 0.0; elseif ((w <= 2.2e-39) || (~((w <= 0.095)) && (w <= 3.3e+101))) tmp = (c0 / (2.0 * w)) * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h)))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[w, -2.4e+124], 0.0, If[Or[LessEqual[w, 2.2e-39], And[N[Not[LessEqual[w, 0.095]], $MachinePrecision], LessEqual[w, 3.3e+101]]], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -2.4 \cdot 10^{+124}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 2.2 \cdot 10^{-39} \lor \neg \left(w \leq 0.095\right) \land w \leq 3.3 \cdot 10^{+101}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w \cdot h}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -2.40000000000000006e124 or 2.20000000000000001e-39 < w < 0.095000000000000001 or 3.30000000000000011e101 < w Initial program 12.2%
Simplified12.2%
Taylor expanded in c0 around -inf 2.0%
associate-*r*2.0%
distribute-rgt1-in2.0%
metadata-eval2.0%
mul0-lft45.2%
metadata-eval45.2%
mul0-lft3.5%
metadata-eval3.5%
distribute-lft1-in3.5%
*-commutative3.5%
distribute-lft1-in3.5%
metadata-eval3.5%
mul0-lft45.2%
Simplified45.2%
Taylor expanded in c0 around 0 45.2%
if -2.40000000000000006e124 < w < 2.20000000000000001e-39 or 0.095000000000000001 < w < 3.30000000000000011e101Initial program 26.3%
Simplified27.2%
Taylor expanded in c0 around inf 39.7%
times-frac40.1%
unpow240.1%
unpow240.1%
Simplified40.1%
frac-times51.4%
Applied egg-rr51.4%
Final simplification49.7%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (* d (* d (* c0 c0))) (* h (* (* w D) (* w D))))))
(if (<= M 2e-273)
0.0
(if (<= M 2.9e-224)
t_0
(if (<= M 7.2e-152)
0.0
(if (<= M 1.02e-87)
(* (/ c0 (* 2.0 w)) (* 2.0 (* c0 (/ (/ (* d d) (* D D)) (* w h)))))
(if (<= M 6.1e+66) 0.0 t_0)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (d * (d * (c0 * c0))) / (h * ((w * D) * (w * D)));
double tmp;
if (M <= 2e-273) {
tmp = 0.0;
} else if (M <= 2.9e-224) {
tmp = t_0;
} else if (M <= 7.2e-152) {
tmp = 0.0;
} else if (M <= 1.02e-87) {
tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d * d) / (D * D)) / (w * h))));
} else if (M <= 6.1e+66) {
tmp = 0.0;
} else {
tmp = t_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 = (d_1 * (d_1 * (c0 * c0))) / (h * ((w * d) * (w * d)))
if (m <= 2d-273) then
tmp = 0.0d0
else if (m <= 2.9d-224) then
tmp = t_0
else if (m <= 7.2d-152) then
tmp = 0.0d0
else if (m <= 1.02d-87) then
tmp = (c0 / (2.0d0 * w)) * (2.0d0 * (c0 * (((d_1 * d_1) / (d * d)) / (w * h))))
else if (m <= 6.1d+66) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (d * (d * (c0 * c0))) / (h * ((w * D) * (w * D)));
double tmp;
if (M <= 2e-273) {
tmp = 0.0;
} else if (M <= 2.9e-224) {
tmp = t_0;
} else if (M <= 7.2e-152) {
tmp = 0.0;
} else if (M <= 1.02e-87) {
tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d * d) / (D * D)) / (w * h))));
} else if (M <= 6.1e+66) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (d * (d * (c0 * c0))) / (h * ((w * D) * (w * D))) tmp = 0 if M <= 2e-273: tmp = 0.0 elif M <= 2.9e-224: tmp = t_0 elif M <= 7.2e-152: tmp = 0.0 elif M <= 1.02e-87: tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d * d) / (D * D)) / (w * h)))) elif M <= 6.1e+66: tmp = 0.0 else: tmp = t_0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(d * Float64(d * Float64(c0 * c0))) / Float64(h * Float64(Float64(w * D) * Float64(w * D)))) tmp = 0.0 if (M <= 2e-273) tmp = 0.0; elseif (M <= 2.9e-224) tmp = t_0; elseif (M <= 7.2e-152) tmp = 0.0; elseif (M <= 1.02e-87) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(c0 * Float64(Float64(Float64(d * d) / Float64(D * D)) / Float64(w * h))))); elseif (M <= 6.1e+66) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (d * (d * (c0 * c0))) / (h * ((w * D) * (w * D))); tmp = 0.0; if (M <= 2e-273) tmp = 0.0; elseif (M <= 2.9e-224) tmp = t_0; elseif (M <= 7.2e-152) tmp = 0.0; elseif (M <= 1.02e-87) tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d * d) / (D * D)) / (w * h)))); elseif (M <= 6.1e+66) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(d * N[(d * N[(c0 * c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(h * N[(N[(w * D), $MachinePrecision] * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 2e-273], 0.0, If[LessEqual[M, 2.9e-224], t$95$0, If[LessEqual[M, 7.2e-152], 0.0, If[LessEqual[M, 1.02e-87], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(c0 * N[(N[(N[(d * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 6.1e+66], 0.0, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{d \cdot \left(d \cdot \left(c0 \cdot c0\right)\right)}{h \cdot \left(\left(w \cdot D\right) \cdot \left(w \cdot D\right)\right)}\\
\mathbf{if}\;M \leq 2 \cdot 10^{-273}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \leq 2.9 \cdot 10^{-224}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;M \leq 7.2 \cdot 10^{-152}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \leq 1.02 \cdot 10^{-87}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \frac{\frac{d \cdot d}{D \cdot D}}{w \cdot h}\right)\right)\\
\mathbf{elif}\;M \leq 6.1 \cdot 10^{+66}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if M < 2e-273 or 2.9e-224 < M < 7.2e-152 or 1.02000000000000009e-87 < M < 6.10000000000000021e66Initial program 22.2%
Simplified22.8%
Taylor expanded in c0 around -inf 1.9%
associate-*r*1.9%
distribute-rgt1-in1.9%
metadata-eval1.9%
mul0-lft31.9%
metadata-eval31.9%
mul0-lft2.9%
metadata-eval2.9%
distribute-lft1-in2.9%
*-commutative2.9%
distribute-lft1-in2.9%
metadata-eval2.9%
mul0-lft31.9%
Simplified31.9%
Taylor expanded in c0 around 0 36.3%
if 2e-273 < M < 2.9e-224 or 6.10000000000000021e66 < M Initial program 21.2%
Simplified22.5%
Taylor expanded in c0 around inf 42.2%
times-frac41.7%
unpow241.7%
unpow241.7%
Simplified41.7%
Taylor expanded in c0 around 0 35.7%
unpow235.7%
unpow235.7%
associate-*r*35.7%
unpow235.7%
unpow235.7%
unswap-sqr45.4%
Simplified45.4%
Taylor expanded in d around 0 45.4%
unpow245.4%
unpow245.4%
associate-*r*53.1%
Simplified53.1%
if 7.2e-152 < M < 1.02000000000000009e-87Initial program 36.5%
Simplified36.5%
Taylor expanded in c0 around inf 45.3%
*-rgt-identity45.3%
*-commutative45.3%
associate-*r*36.6%
unpow236.6%
associate-*r/36.6%
*-commutative36.6%
associate-*l*36.9%
associate-*r/36.9%
*-rgt-identity36.9%
unpow236.9%
associate-*r*36.9%
*-commutative36.9%
associate-/r*37.4%
unpow237.4%
unpow237.4%
Simplified37.4%
Final simplification39.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w))))
(if (<= w -2.4e+123)
0.0
(if (<= w 5.8e-40)
(* t_0 (* 2.0 (* (* (/ d D) (/ d D)) (/ c0 (* w h)))))
(if (<= w 0.0235)
0.0
(if (<= w 8.5e+131)
(* t_0 (* 2.0 (* (/ c0 (* (* w h) D)) (/ (* d d) D))))
0.0))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double tmp;
if (w <= -2.4e+123) {
tmp = 0.0;
} else if (w <= 5.8e-40) {
tmp = t_0 * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))));
} else if (w <= 0.0235) {
tmp = 0.0;
} else if (w <= 8.5e+131) {
tmp = t_0 * (2.0 * ((c0 / ((w * h) * D)) * ((d * d) / D)));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = c0 / (2.0d0 * w)
if (w <= (-2.4d+123)) then
tmp = 0.0d0
else if (w <= 5.8d-40) then
tmp = t_0 * (2.0d0 * (((d_1 / d) * (d_1 / d)) * (c0 / (w * h))))
else if (w <= 0.0235d0) then
tmp = 0.0d0
else if (w <= 8.5d+131) then
tmp = t_0 * (2.0d0 * ((c0 / ((w * h) * d)) * ((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 t_0 = c0 / (2.0 * w);
double tmp;
if (w <= -2.4e+123) {
tmp = 0.0;
} else if (w <= 5.8e-40) {
tmp = t_0 * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))));
} else if (w <= 0.0235) {
tmp = 0.0;
} else if (w <= 8.5e+131) {
tmp = t_0 * (2.0 * ((c0 / ((w * h) * D)) * ((d * d) / D)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) tmp = 0 if w <= -2.4e+123: tmp = 0.0 elif w <= 5.8e-40: tmp = t_0 * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h)))) elif w <= 0.0235: tmp = 0.0 elif w <= 8.5e+131: tmp = t_0 * (2.0 * ((c0 / ((w * h) * D)) * ((d * d) / D))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) tmp = 0.0 if (w <= -2.4e+123) tmp = 0.0; elseif (w <= 5.8e-40) tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(c0 / Float64(w * h))))); elseif (w <= 0.0235) tmp = 0.0; elseif (w <= 8.5e+131) tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(c0 / Float64(Float64(w * h) * D)) * Float64(Float64(d * d) / D)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); tmp = 0.0; if (w <= -2.4e+123) tmp = 0.0; elseif (w <= 5.8e-40) tmp = t_0 * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h)))); elseif (w <= 0.0235) tmp = 0.0; elseif (w <= 8.5e+131) tmp = t_0 * (2.0 * ((c0 / ((w * h) * D)) * ((d * d) / D))); 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]}, If[LessEqual[w, -2.4e+123], 0.0, If[LessEqual[w, 5.8e-40], N[(t$95$0 * N[(2.0 * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, 0.0235], 0.0, If[LessEqual[w, 8.5e+131], N[(t$95$0 * N[(2.0 * N[(N[(c0 / N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;w \leq -2.4 \cdot 10^{+123}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 5.8 \cdot 10^{-40}:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w \cdot h}\right)\right)\\
\mathbf{elif}\;w \leq 0.0235:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 8.5 \cdot 10^{+131}:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(\frac{c0}{\left(w \cdot h\right) \cdot D} \cdot \frac{d \cdot d}{D}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -2.39999999999999989e123 or 5.7999999999999998e-40 < w < 0.0235 or 8.50000000000000063e131 < w Initial program 11.5%
Simplified11.6%
Taylor expanded in c0 around -inf 2.2%
associate-*r*2.2%
distribute-rgt1-in2.2%
metadata-eval2.2%
mul0-lft47.0%
metadata-eval47.0%
mul0-lft3.8%
metadata-eval3.8%
distribute-lft1-in3.8%
*-commutative3.8%
distribute-lft1-in3.8%
metadata-eval3.8%
mul0-lft47.0%
Simplified47.0%
Taylor expanded in c0 around 0 47.0%
if -2.39999999999999989e123 < w < 5.7999999999999998e-40Initial program 26.7%
Simplified27.2%
Taylor expanded in c0 around inf 39.4%
times-frac39.9%
unpow239.9%
unpow239.9%
Simplified39.9%
frac-times52.0%
Applied egg-rr52.0%
if 0.0235 < w < 8.50000000000000063e131Initial program 22.7%
Simplified26.3%
Taylor expanded in c0 around inf 38.0%
times-frac37.7%
unpow237.7%
unpow237.7%
Simplified37.7%
frac-times38.0%
*-commutative38.0%
*-commutative38.0%
associate-*r*38.3%
*-commutative38.3%
*-commutative38.3%
Applied egg-rr38.3%
times-frac45.9%
*-commutative45.9%
Applied egg-rr45.9%
Final simplification50.1%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= M 9.5e-274)
0.0
(if (or (<= M 1.9e-224)
(not
(or (<= M 2.5e-95) (and (not (<= M 1.65e-87)) (<= M 1.86e+68)))))
(/ (* d (* d (* c0 c0))) (* h (* (* w D) (* w D))))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (M <= 9.5e-274) {
tmp = 0.0;
} else if ((M <= 1.9e-224) || !((M <= 2.5e-95) || (!(M <= 1.65e-87) && (M <= 1.86e+68)))) {
tmp = (d * (d * (c0 * c0))) / (h * ((w * D) * (w * 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 (m <= 9.5d-274) then
tmp = 0.0d0
else if ((m <= 1.9d-224) .or. (.not. (m <= 2.5d-95) .or. (.not. (m <= 1.65d-87)) .and. (m <= 1.86d+68))) then
tmp = (d_1 * (d_1 * (c0 * c0))) / (h * ((w * d) * (w * 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 (M <= 9.5e-274) {
tmp = 0.0;
} else if ((M <= 1.9e-224) || !((M <= 2.5e-95) || (!(M <= 1.65e-87) && (M <= 1.86e+68)))) {
tmp = (d * (d * (c0 * c0))) / (h * ((w * D) * (w * D)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if M <= 9.5e-274: tmp = 0.0 elif (M <= 1.9e-224) or not ((M <= 2.5e-95) or (not (M <= 1.65e-87) and (M <= 1.86e+68))): tmp = (d * (d * (c0 * c0))) / (h * ((w * D) * (w * D))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (M <= 9.5e-274) tmp = 0.0; elseif ((M <= 1.9e-224) || !((M <= 2.5e-95) || (!(M <= 1.65e-87) && (M <= 1.86e+68)))) tmp = Float64(Float64(d * Float64(d * Float64(c0 * c0))) / Float64(h * Float64(Float64(w * D) * Float64(w * D)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (M <= 9.5e-274) tmp = 0.0; elseif ((M <= 1.9e-224) || ~(((M <= 2.5e-95) || (~((M <= 1.65e-87)) && (M <= 1.86e+68))))) tmp = (d * (d * (c0 * c0))) / (h * ((w * D) * (w * D))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 9.5e-274], 0.0, If[Or[LessEqual[M, 1.9e-224], N[Not[Or[LessEqual[M, 2.5e-95], And[N[Not[LessEqual[M, 1.65e-87]], $MachinePrecision], LessEqual[M, 1.86e+68]]]], $MachinePrecision]], N[(N[(d * N[(d * N[(c0 * c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(h * N[(N[(w * D), $MachinePrecision] * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 9.5 \cdot 10^{-274}:\\
\;\;\;\;0\\
\mathbf{elif}\;M \leq 1.9 \cdot 10^{-224} \lor \neg \left(M \leq 2.5 \cdot 10^{-95} \lor \neg \left(M \leq 1.65 \cdot 10^{-87}\right) \land M \leq 1.86 \cdot 10^{+68}\right):\\
\;\;\;\;\frac{d \cdot \left(d \cdot \left(c0 \cdot c0\right)\right)}{h \cdot \left(\left(w \cdot D\right) \cdot \left(w \cdot D\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if M < 9.5000000000000009e-274 or 1.90000000000000001e-224 < M < 2.4999999999999999e-95 or 1.65e-87 < M < 1.8600000000000001e68Initial program 22.5%
Simplified23.1%
Taylor expanded in c0 around -inf 1.8%
associate-*r*1.8%
distribute-rgt1-in1.8%
metadata-eval1.8%
mul0-lft31.5%
metadata-eval31.5%
mul0-lft2.8%
metadata-eval2.8%
distribute-lft1-in2.8%
*-commutative2.8%
distribute-lft1-in2.8%
metadata-eval2.8%
mul0-lft31.5%
Simplified31.5%
Taylor expanded in c0 around 0 35.8%
if 9.5000000000000009e-274 < M < 1.90000000000000001e-224 or 2.4999999999999999e-95 < M < 1.65e-87 or 1.8600000000000001e68 < M Initial program 22.9%
Simplified24.0%
Taylor expanded in c0 around inf 43.7%
times-frac43.2%
unpow243.2%
unpow243.2%
Simplified43.2%
Taylor expanded in c0 around 0 36.8%
unpow236.8%
unpow236.8%
associate-*r*36.8%
unpow236.8%
unpow236.8%
unswap-sqr45.7%
Simplified45.7%
Taylor expanded in d around 0 45.7%
unpow245.7%
unpow245.7%
associate-*r*52.7%
Simplified52.7%
Final simplification39.7%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= w -2.85e+224)
0.0
(if (<= w 2.6e+101)
(* (/ c0 (* 2.0 w)) (* 2.0 (/ (* (/ c0 w) (* (/ d D) (/ d D))) h)))
0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (w <= -2.85e+224) {
tmp = 0.0;
} else if (w <= 2.6e+101) {
tmp = (c0 / (2.0 * w)) * (2.0 * (((c0 / w) * ((d / D) * (d / D))) / h));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if (w <= (-2.85d+224)) then
tmp = 0.0d0
else if (w <= 2.6d+101) then
tmp = (c0 / (2.0d0 * w)) * (2.0d0 * (((c0 / w) * ((d_1 / d) * (d_1 / d))) / h))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (w <= -2.85e+224) {
tmp = 0.0;
} else if (w <= 2.6e+101) {
tmp = (c0 / (2.0 * w)) * (2.0 * (((c0 / w) * ((d / D) * (d / D))) / h));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if w <= -2.85e+224: tmp = 0.0 elif w <= 2.6e+101: tmp = (c0 / (2.0 * w)) * (2.0 * (((c0 / w) * ((d / D) * (d / D))) / h)) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (w <= -2.85e+224) tmp = 0.0; elseif (w <= 2.6e+101) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(Float64(Float64(c0 / w) * Float64(Float64(d / D) * Float64(d / D))) / h))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (w <= -2.85e+224) tmp = 0.0; elseif (w <= 2.6e+101) tmp = (c0 / (2.0 * w)) * (2.0 * (((c0 / w) * ((d / D) * (d / D))) / h)); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[w, -2.85e+224], 0.0, If[LessEqual[w, 2.6e+101], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(N[(c0 / w), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -2.85 \cdot 10^{+224}:\\
\;\;\;\;0\\
\mathbf{elif}\;w \leq 2.6 \cdot 10^{+101}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -2.84999999999999999e224 or 2.6e101 < w Initial program 16.7%
Simplified16.9%
Taylor expanded in c0 around -inf 3.0%
associate-*r*3.0%
distribute-rgt1-in3.0%
metadata-eval3.0%
mul0-lft51.6%
metadata-eval51.6%
mul0-lft5.4%
metadata-eval5.4%
distribute-lft1-in5.4%
*-commutative5.4%
distribute-lft1-in5.4%
metadata-eval5.4%
mul0-lft51.6%
Simplified51.6%
Taylor expanded in c0 around 0 51.6%
if -2.84999999999999999e224 < w < 2.6e101Initial program 23.8%
Simplified24.6%
Taylor expanded in c0 around inf 35.7%
times-frac36.0%
unpow236.0%
unpow236.0%
Simplified36.0%
frac-times47.4%
*-commutative47.4%
associate-/r*49.8%
associate-*l/50.0%
pow250.0%
Applied egg-rr50.0%
unpow250.0%
Applied egg-rr50.0%
Final simplification50.2%
(FPCore (c0 w h D d M) :precision binary64 0.0)
double code(double c0, double w, double h, double D, double d, double M) {
return 0.0;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = 0.0d0
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return 0.0;
}
def code(c0, w, h, D, d, M): return 0.0
function code(c0, w, h, D, d, M) return 0.0 end
function tmp = code(c0, w, h, D, d, M) tmp = 0.0; end
code[c0_, w_, h_, D_, d_, M_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 22.6%
Simplified23.3%
Taylor expanded in c0 around -inf 1.5%
associate-*r*1.5%
distribute-rgt1-in1.5%
metadata-eval1.5%
mul0-lft26.6%
metadata-eval26.6%
mul0-lft2.3%
metadata-eval2.3%
distribute-lft1-in2.3%
*-commutative2.3%
distribute-lft1-in2.3%
metadata-eval2.3%
mul0-lft26.6%
Simplified26.6%
Taylor expanded in c0 around 0 30.4%
Final simplification30.4%
herbie shell --seed 2023274
(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))))))