
(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))))
(t_1 (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
(if (<= t_1 INFINITY) t_1 (* (/ 0.25 d) (/ D (/ d (* D (* h (* 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));
double t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (0.25 / d) * (D / (d / (D * (h * (M * M)))));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_1 = (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (0.25 / d) * (D / (d / (D * (h * (M * M)))));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) t_1 = (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M)))) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (0.25 / d) * (D / (d / (D * (h * (M * M))))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_1 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(0.25 / d) * Float64(D / Float64(d / Float64(D * Float64(h * Float64(M * M)))))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = (0.25 / d) * (D / (d / (D * (h * (M * M))))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(0.25 / d), $MachinePrecision] * N[(D / N[(d / N[(D * N[(h * N[(M * M), $MachinePrecision]), $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)}\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25}{d} \cdot \frac{D}{\frac{d}{D \cdot \left(h \cdot \left(M \cdot M\right)\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 84.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%
Taylor expanded in c0 around -inf 0.8%
fma-def0.8%
times-frac1.4%
unpow21.4%
unpow21.4%
*-commutative1.4%
unpow21.4%
associate-*r*1.4%
Simplified42.2%
Taylor expanded in c0 around 0 46.8%
associate-*r/46.8%
*-commutative46.8%
*-commutative46.8%
unpow246.8%
unpow246.8%
unpow246.8%
Simplified46.8%
*-un-lft-identity46.8%
times-frac56.6%
associate-*l*66.4%
Applied egg-rr66.4%
*-lft-identity66.4%
associate-/l*67.7%
Simplified67.7%
Final simplification74.0%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* h (* M M)))
(t_1 (* (* w h) (* D D)))
(t_2 (/ c0 (* 2.0 w)))
(t_3
(*
t_2
(+
(* (/ (/ c0 h) w) (pow (/ d D) 2.0))
(* (* d (/ d (* D D))) (/ c0 (* w h))))))
(t_4 (* t_2 (* 2.0 (* d (/ (* c0 d) t_1)))))
(t_5 (* (/ 0.25 d) (/ D (/ d (* D t_0))))))
(if (<= c0 -6.2e+265)
t_4
(if (<= c0 -1.4e+231)
t_5
(if (<= c0 -0.0018)
t_3
(if (<= c0 -5.5e-116)
(* (/ c0 w) (/ (* 0.5 (/ (pow (/ D d) 2.0) (/ c0 (* w t_0)))) 2.0))
(if (<= c0 -5.8e-199)
t_4
(if (<= c0 9.8e-119)
(* t_2 (* c0 0.0))
(if (<= c0 7.5e-97)
(*
t_2
(fma
-0.5
(* (/ (* D D) (* d d)) (* h (* (* M M) (/ w c0))))
(/ (* 2.0 (* c0 (* d d))) t_1)))
(if (<= c0 1.6e+216) t_5 t_3))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = h * (M * M);
double t_1 = (w * h) * (D * D);
double t_2 = c0 / (2.0 * w);
double t_3 = t_2 * ((((c0 / h) / w) * pow((d / D), 2.0)) + ((d * (d / (D * D))) * (c0 / (w * h))));
double t_4 = t_2 * (2.0 * (d * ((c0 * d) / t_1)));
double t_5 = (0.25 / d) * (D / (d / (D * t_0)));
double tmp;
if (c0 <= -6.2e+265) {
tmp = t_4;
} else if (c0 <= -1.4e+231) {
tmp = t_5;
} else if (c0 <= -0.0018) {
tmp = t_3;
} else if (c0 <= -5.5e-116) {
tmp = (c0 / w) * ((0.5 * (pow((D / d), 2.0) / (c0 / (w * t_0)))) / 2.0);
} else if (c0 <= -5.8e-199) {
tmp = t_4;
} else if (c0 <= 9.8e-119) {
tmp = t_2 * (c0 * 0.0);
} else if (c0 <= 7.5e-97) {
tmp = t_2 * fma(-0.5, (((D * D) / (d * d)) * (h * ((M * M) * (w / c0)))), ((2.0 * (c0 * (d * d))) / t_1));
} else if (c0 <= 1.6e+216) {
tmp = t_5;
} else {
tmp = t_3;
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(h * Float64(M * M)) t_1 = Float64(Float64(w * h) * Float64(D * D)) t_2 = Float64(c0 / Float64(2.0 * w)) t_3 = Float64(t_2 * Float64(Float64(Float64(Float64(c0 / h) / w) * (Float64(d / D) ^ 2.0)) + Float64(Float64(d * Float64(d / Float64(D * D))) * Float64(c0 / Float64(w * h))))) t_4 = Float64(t_2 * Float64(2.0 * Float64(d * Float64(Float64(c0 * d) / t_1)))) t_5 = Float64(Float64(0.25 / d) * Float64(D / Float64(d / Float64(D * t_0)))) tmp = 0.0 if (c0 <= -6.2e+265) tmp = t_4; elseif (c0 <= -1.4e+231) tmp = t_5; elseif (c0 <= -0.0018) tmp = t_3; elseif (c0 <= -5.5e-116) tmp = Float64(Float64(c0 / w) * Float64(Float64(0.5 * Float64((Float64(D / d) ^ 2.0) / Float64(c0 / Float64(w * t_0)))) / 2.0)); elseif (c0 <= -5.8e-199) tmp = t_4; elseif (c0 <= 9.8e-119) tmp = Float64(t_2 * Float64(c0 * 0.0)); elseif (c0 <= 7.5e-97) tmp = Float64(t_2 * fma(-0.5, Float64(Float64(Float64(D * D) / Float64(d * d)) * Float64(h * Float64(Float64(M * M) * Float64(w / c0)))), Float64(Float64(2.0 * Float64(c0 * Float64(d * d))) / t_1))); elseif (c0 <= 1.6e+216) tmp = t_5; else tmp = t_3; end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * N[(N[(N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision] * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(d * N[(d / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 * N[(2.0 * N[(d * N[(N[(c0 * d), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(0.25 / d), $MachinePrecision] * N[(D / N[(d / N[(D * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -6.2e+265], t$95$4, If[LessEqual[c0, -1.4e+231], t$95$5, If[LessEqual[c0, -0.0018], t$95$3, If[LessEqual[c0, -5.5e-116], N[(N[(c0 / w), $MachinePrecision] * N[(N[(0.5 * N[(N[Power[N[(D / d), $MachinePrecision], 2.0], $MachinePrecision] / N[(c0 / N[(w * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, -5.8e-199], t$95$4, If[LessEqual[c0, 9.8e-119], N[(t$95$2 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 7.5e-97], N[(t$95$2 * N[(-0.5 * N[(N[(N[(D * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M * M), $MachinePrecision] * N[(w / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 * N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 1.6e+216], t$95$5, t$95$3]]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := h \cdot \left(M \cdot M\right)\\
t_1 := \left(w \cdot h\right) \cdot \left(D \cdot D\right)\\
t_2 := \frac{c0}{2 \cdot w}\\
t_3 := t_2 \cdot \left(\frac{\frac{c0}{h}}{w} \cdot {\left(\frac{d}{D}\right)}^{2} + \left(d \cdot \frac{d}{D \cdot D}\right) \cdot \frac{c0}{w \cdot h}\right)\\
t_4 := t_2 \cdot \left(2 \cdot \left(d \cdot \frac{c0 \cdot d}{t_1}\right)\right)\\
t_5 := \frac{0.25}{d} \cdot \frac{D}{\frac{d}{D \cdot t_0}}\\
\mathbf{if}\;c0 \leq -6.2 \cdot 10^{+265}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;c0 \leq -1.4 \cdot 10^{+231}:\\
\;\;\;\;t_5\\
\mathbf{elif}\;c0 \leq -0.0018:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c0 \leq -5.5 \cdot 10^{-116}:\\
\;\;\;\;\frac{c0}{w} \cdot \frac{0.5 \cdot \frac{{\left(\frac{D}{d}\right)}^{2}}{\frac{c0}{w \cdot t_0}}}{2}\\
\mathbf{elif}\;c0 \leq -5.8 \cdot 10^{-199}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;c0 \leq 9.8 \cdot 10^{-119}:\\
\;\;\;\;t_2 \cdot \left(c0 \cdot 0\right)\\
\mathbf{elif}\;c0 \leq 7.5 \cdot 10^{-97}:\\
\;\;\;\;t_2 \cdot \mathsf{fma}\left(-0.5, \frac{D \cdot D}{d \cdot d} \cdot \left(h \cdot \left(\left(M \cdot M\right) \cdot \frac{w}{c0}\right)\right), \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{t_1}\right)\\
\mathbf{elif}\;c0 \leq 1.6 \cdot 10^{+216}:\\
\;\;\;\;t_5\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if c0 < -6.20000000000000016e265 or -5.4999999999999998e-116 < c0 < -5.8e-199Initial program 44.1%
associate-*l*43.9%
difference-of-squares57.2%
associate-*l*57.3%
associate-*l*57.3%
Simplified57.3%
Taylor expanded in c0 around inf 58.0%
*-commutative58.0%
associate-*r*57.9%
unpow257.9%
associate-*r/57.9%
unpow257.9%
associate-*r*68.2%
associate-*r/68.2%
unpow268.2%
associate-*r*71.4%
*-commutative71.4%
unpow271.4%
Simplified71.4%
if -6.20000000000000016e265 < c0 < -1.4e231 or 7.5e-97 < c0 < 1.59999999999999985e216Initial program 20.4%
Taylor expanded in c0 around -inf 6.5%
fma-def6.5%
times-frac7.9%
unpow27.9%
unpow27.9%
*-commutative7.9%
unpow27.9%
associate-*r*7.9%
Simplified44.2%
Taylor expanded in c0 around 0 47.6%
associate-*r/47.6%
*-commutative47.6%
*-commutative47.6%
unpow247.6%
unpow247.6%
unpow247.6%
Simplified47.6%
*-un-lft-identity47.6%
times-frac51.0%
associate-*l*63.5%
Applied egg-rr63.5%
*-lft-identity63.5%
associate-/l*66.5%
Simplified66.5%
if -1.4e231 < c0 < -0.0018 or 1.59999999999999985e216 < c0 Initial program 42.9%
times-frac41.7%
fma-def41.7%
times-frac43.0%
difference-of-squares52.7%
Simplified51.4%
fma-udef52.6%
associate-/l/52.6%
pow252.6%
associate-*l*53.8%
div-inv53.8%
clear-num53.8%
associate-*r/53.8%
*-commutative53.8%
Applied egg-rr63.9%
Taylor expanded in c0 around inf 52.6%
times-frac52.8%
unpow252.8%
associate-*r/61.8%
unpow261.8%
Simplified61.8%
if -0.0018 < c0 < -5.4999999999999998e-116Initial program 28.3%
Taylor expanded in c0 around -inf 8.0%
fma-def8.0%
times-frac8.0%
unpow28.0%
unpow28.0%
*-commutative8.0%
unpow28.0%
associate-*r*8.0%
Simplified56.8%
associate-*r/56.8%
times-frac60.9%
Applied egg-rr60.9%
associate-*l/60.9%
pow260.9%
mul0-rgt60.9%
*-commutative60.9%
Applied egg-rr60.9%
times-frac60.9%
fma-udef60.9%
+-rgt-identity60.9%
associate-/l*60.9%
Simplified60.9%
if -5.8e-199 < c0 < 9.8e-119Initial program 19.3%
associate-*l*19.3%
difference-of-squares19.3%
associate-*l*19.3%
associate-*l*19.3%
Simplified19.3%
Taylor expanded in c0 around -inf 2.3%
associate-*r*2.3%
distribute-rgt1-in2.3%
metadata-eval2.3%
mul0-lft57.4%
metadata-eval57.4%
mul0-lft4.4%
metadata-eval4.4%
distribute-lft1-in4.4%
*-commutative4.4%
distribute-lft1-in4.4%
metadata-eval4.4%
mul0-lft57.4%
Simplified57.4%
if 9.8e-119 < c0 < 7.5e-97Initial program 81.3%
associate-*l*65.0%
difference-of-squares65.0%
associate-*l*63.9%
associate-*l*61.3%
Simplified61.3%
Applied egg-rr5.1%
unpow25.1%
associate--r-5.6%
+-inverses6.0%
unpow26.0%
associate-/l/6.0%
associate-/l/6.0%
Simplified6.0%
Taylor expanded in M around 0 99.7%
+-commutative99.7%
*-commutative99.7%
fma-def99.7%
Simplified99.7%
Final simplification63.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* h (* M M)))
(t_1 (/ c0 (* 2.0 w)))
(t_2
(*
t_1
(+
(* (/ (/ c0 h) w) (pow (/ d D) 2.0))
(* (* d (/ d (* D D))) (/ c0 (* w h))))))
(t_3 (* t_1 (* 2.0 (* d (/ (* c0 d) (* (* w h) (* D D)))))))
(t_4 (* (/ 0.25 d) (/ D (/ d (* D t_0))))))
(if (<= c0 -6.5e+271)
t_3
(if (<= c0 -2.05e+228)
t_4
(if (<= c0 -0.000135)
t_2
(if (<= c0 -3.1e-116)
(* (/ c0 w) (/ (* 0.5 (/ (pow (/ D d) 2.0) (/ c0 (* w t_0)))) 2.0))
(if (<= c0 -4.6e-194)
t_3
(if (<= c0 1.3e-123)
(* t_1 (* c0 0.0))
(if (or (<= c0 8.5e-97) (not (<= c0 4.8e+216))) t_2 t_4)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = h * (M * M);
double t_1 = c0 / (2.0 * w);
double t_2 = t_1 * ((((c0 / h) / w) * pow((d / D), 2.0)) + ((d * (d / (D * D))) * (c0 / (w * h))));
double t_3 = t_1 * (2.0 * (d * ((c0 * d) / ((w * h) * (D * D)))));
double t_4 = (0.25 / d) * (D / (d / (D * t_0)));
double tmp;
if (c0 <= -6.5e+271) {
tmp = t_3;
} else if (c0 <= -2.05e+228) {
tmp = t_4;
} else if (c0 <= -0.000135) {
tmp = t_2;
} else if (c0 <= -3.1e-116) {
tmp = (c0 / w) * ((0.5 * (pow((D / d), 2.0) / (c0 / (w * t_0)))) / 2.0);
} else if (c0 <= -4.6e-194) {
tmp = t_3;
} else if (c0 <= 1.3e-123) {
tmp = t_1 * (c0 * 0.0);
} else if ((c0 <= 8.5e-97) || !(c0 <= 4.8e+216)) {
tmp = t_2;
} else {
tmp = t_4;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = h * (m * m)
t_1 = c0 / (2.0d0 * w)
t_2 = t_1 * ((((c0 / h) / w) * ((d_1 / d) ** 2.0d0)) + ((d_1 * (d_1 / (d * d))) * (c0 / (w * h))))
t_3 = t_1 * (2.0d0 * (d_1 * ((c0 * d_1) / ((w * h) * (d * d)))))
t_4 = (0.25d0 / d_1) * (d / (d_1 / (d * t_0)))
if (c0 <= (-6.5d+271)) then
tmp = t_3
else if (c0 <= (-2.05d+228)) then
tmp = t_4
else if (c0 <= (-0.000135d0)) then
tmp = t_2
else if (c0 <= (-3.1d-116)) then
tmp = (c0 / w) * ((0.5d0 * (((d / d_1) ** 2.0d0) / (c0 / (w * t_0)))) / 2.0d0)
else if (c0 <= (-4.6d-194)) then
tmp = t_3
else if (c0 <= 1.3d-123) then
tmp = t_1 * (c0 * 0.0d0)
else if ((c0 <= 8.5d-97) .or. (.not. (c0 <= 4.8d+216))) then
tmp = t_2
else
tmp = t_4
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 = h * (M * M);
double t_1 = c0 / (2.0 * w);
double t_2 = t_1 * ((((c0 / h) / w) * Math.pow((d / D), 2.0)) + ((d * (d / (D * D))) * (c0 / (w * h))));
double t_3 = t_1 * (2.0 * (d * ((c0 * d) / ((w * h) * (D * D)))));
double t_4 = (0.25 / d) * (D / (d / (D * t_0)));
double tmp;
if (c0 <= -6.5e+271) {
tmp = t_3;
} else if (c0 <= -2.05e+228) {
tmp = t_4;
} else if (c0 <= -0.000135) {
tmp = t_2;
} else if (c0 <= -3.1e-116) {
tmp = (c0 / w) * ((0.5 * (Math.pow((D / d), 2.0) / (c0 / (w * t_0)))) / 2.0);
} else if (c0 <= -4.6e-194) {
tmp = t_3;
} else if (c0 <= 1.3e-123) {
tmp = t_1 * (c0 * 0.0);
} else if ((c0 <= 8.5e-97) || !(c0 <= 4.8e+216)) {
tmp = t_2;
} else {
tmp = t_4;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = h * (M * M) t_1 = c0 / (2.0 * w) t_2 = t_1 * ((((c0 / h) / w) * math.pow((d / D), 2.0)) + ((d * (d / (D * D))) * (c0 / (w * h)))) t_3 = t_1 * (2.0 * (d * ((c0 * d) / ((w * h) * (D * D))))) t_4 = (0.25 / d) * (D / (d / (D * t_0))) tmp = 0 if c0 <= -6.5e+271: tmp = t_3 elif c0 <= -2.05e+228: tmp = t_4 elif c0 <= -0.000135: tmp = t_2 elif c0 <= -3.1e-116: tmp = (c0 / w) * ((0.5 * (math.pow((D / d), 2.0) / (c0 / (w * t_0)))) / 2.0) elif c0 <= -4.6e-194: tmp = t_3 elif c0 <= 1.3e-123: tmp = t_1 * (c0 * 0.0) elif (c0 <= 8.5e-97) or not (c0 <= 4.8e+216): tmp = t_2 else: tmp = t_4 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(h * Float64(M * M)) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(t_1 * Float64(Float64(Float64(Float64(c0 / h) / w) * (Float64(d / D) ^ 2.0)) + Float64(Float64(d * Float64(d / Float64(D * D))) * Float64(c0 / Float64(w * h))))) t_3 = Float64(t_1 * Float64(2.0 * Float64(d * Float64(Float64(c0 * d) / Float64(Float64(w * h) * Float64(D * D)))))) t_4 = Float64(Float64(0.25 / d) * Float64(D / Float64(d / Float64(D * t_0)))) tmp = 0.0 if (c0 <= -6.5e+271) tmp = t_3; elseif (c0 <= -2.05e+228) tmp = t_4; elseif (c0 <= -0.000135) tmp = t_2; elseif (c0 <= -3.1e-116) tmp = Float64(Float64(c0 / w) * Float64(Float64(0.5 * Float64((Float64(D / d) ^ 2.0) / Float64(c0 / Float64(w * t_0)))) / 2.0)); elseif (c0 <= -4.6e-194) tmp = t_3; elseif (c0 <= 1.3e-123) tmp = Float64(t_1 * Float64(c0 * 0.0)); elseif ((c0 <= 8.5e-97) || !(c0 <= 4.8e+216)) tmp = t_2; else tmp = t_4; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = h * (M * M); t_1 = c0 / (2.0 * w); t_2 = t_1 * ((((c0 / h) / w) * ((d / D) ^ 2.0)) + ((d * (d / (D * D))) * (c0 / (w * h)))); t_3 = t_1 * (2.0 * (d * ((c0 * d) / ((w * h) * (D * D))))); t_4 = (0.25 / d) * (D / (d / (D * t_0))); tmp = 0.0; if (c0 <= -6.5e+271) tmp = t_3; elseif (c0 <= -2.05e+228) tmp = t_4; elseif (c0 <= -0.000135) tmp = t_2; elseif (c0 <= -3.1e-116) tmp = (c0 / w) * ((0.5 * (((D / d) ^ 2.0) / (c0 / (w * t_0)))) / 2.0); elseif (c0 <= -4.6e-194) tmp = t_3; elseif (c0 <= 1.3e-123) tmp = t_1 * (c0 * 0.0); elseif ((c0 <= 8.5e-97) || ~((c0 <= 4.8e+216))) tmp = t_2; else tmp = t_4; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(N[(N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision] * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(d * N[(d / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(2.0 * N[(d * N[(N[(c0 * d), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(0.25 / d), $MachinePrecision] * N[(D / N[(d / N[(D * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -6.5e+271], t$95$3, If[LessEqual[c0, -2.05e+228], t$95$4, If[LessEqual[c0, -0.000135], t$95$2, If[LessEqual[c0, -3.1e-116], N[(N[(c0 / w), $MachinePrecision] * N[(N[(0.5 * N[(N[Power[N[(D / d), $MachinePrecision], 2.0], $MachinePrecision] / N[(c0 / N[(w * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, -4.6e-194], t$95$3, If[LessEqual[c0, 1.3e-123], N[(t$95$1 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[c0, 8.5e-97], N[Not[LessEqual[c0, 4.8e+216]], $MachinePrecision]], t$95$2, t$95$4]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := h \cdot \left(M \cdot M\right)\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := t_1 \cdot \left(\frac{\frac{c0}{h}}{w} \cdot {\left(\frac{d}{D}\right)}^{2} + \left(d \cdot \frac{d}{D \cdot D}\right) \cdot \frac{c0}{w \cdot h}\right)\\
t_3 := t_1 \cdot \left(2 \cdot \left(d \cdot \frac{c0 \cdot d}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)\right)\\
t_4 := \frac{0.25}{d} \cdot \frac{D}{\frac{d}{D \cdot t_0}}\\
\mathbf{if}\;c0 \leq -6.5 \cdot 10^{+271}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c0 \leq -2.05 \cdot 10^{+228}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;c0 \leq -0.000135:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c0 \leq -3.1 \cdot 10^{-116}:\\
\;\;\;\;\frac{c0}{w} \cdot \frac{0.5 \cdot \frac{{\left(\frac{D}{d}\right)}^{2}}{\frac{c0}{w \cdot t_0}}}{2}\\
\mathbf{elif}\;c0 \leq -4.6 \cdot 10^{-194}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c0 \leq 1.3 \cdot 10^{-123}:\\
\;\;\;\;t_1 \cdot \left(c0 \cdot 0\right)\\
\mathbf{elif}\;c0 \leq 8.5 \cdot 10^{-97} \lor \neg \left(c0 \leq 4.8 \cdot 10^{+216}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_4\\
\end{array}
\end{array}
if c0 < -6.49999999999999998e271 or -3.10000000000000018e-116 < c0 < -4.60000000000000005e-194Initial program 44.1%
associate-*l*43.9%
difference-of-squares57.2%
associate-*l*57.3%
associate-*l*57.3%
Simplified57.3%
Taylor expanded in c0 around inf 58.0%
*-commutative58.0%
associate-*r*57.9%
unpow257.9%
associate-*r/57.9%
unpow257.9%
associate-*r*68.2%
associate-*r/68.2%
unpow268.2%
associate-*r*71.4%
*-commutative71.4%
unpow271.4%
Simplified71.4%
if -6.49999999999999998e271 < c0 < -2.05e228 or 8.5000000000000002e-97 < c0 < 4.7999999999999999e216Initial program 20.4%
Taylor expanded in c0 around -inf 6.5%
fma-def6.5%
times-frac7.9%
unpow27.9%
unpow27.9%
*-commutative7.9%
unpow27.9%
associate-*r*7.9%
Simplified44.2%
Taylor expanded in c0 around 0 47.6%
associate-*r/47.6%
*-commutative47.6%
*-commutative47.6%
unpow247.6%
unpow247.6%
unpow247.6%
Simplified47.6%
*-un-lft-identity47.6%
times-frac51.0%
associate-*l*63.5%
Applied egg-rr63.5%
*-lft-identity63.5%
associate-/l*66.5%
Simplified66.5%
if -2.05e228 < c0 < -1.35000000000000002e-4 or 1.29999999999999998e-123 < c0 < 8.5000000000000002e-97 or 4.7999999999999999e216 < c0 Initial program 45.1%
times-frac44.0%
fma-def44.0%
times-frac45.2%
difference-of-squares54.3%
Simplified53.1%
fma-udef54.2%
associate-/l/54.2%
pow254.2%
associate-*l*55.3%
div-inv55.3%
clear-num55.3%
associate-*r/55.4%
*-commutative55.4%
Applied egg-rr64.9%
Taylor expanded in c0 around inf 55.2%
times-frac55.5%
unpow255.5%
associate-*r/63.9%
unpow263.9%
Simplified63.9%
if -1.35000000000000002e-4 < c0 < -3.10000000000000018e-116Initial program 28.3%
Taylor expanded in c0 around -inf 8.0%
fma-def8.0%
times-frac8.0%
unpow28.0%
unpow28.0%
*-commutative8.0%
unpow28.0%
associate-*r*8.0%
Simplified56.8%
associate-*r/56.8%
times-frac60.9%
Applied egg-rr60.9%
associate-*l/60.9%
pow260.9%
mul0-rgt60.9%
*-commutative60.9%
Applied egg-rr60.9%
times-frac60.9%
fma-udef60.9%
+-rgt-identity60.9%
associate-/l*60.9%
Simplified60.9%
if -4.60000000000000005e-194 < c0 < 1.29999999999999998e-123Initial program 19.3%
associate-*l*19.3%
difference-of-squares19.3%
associate-*l*19.3%
associate-*l*19.3%
Simplified19.3%
Taylor expanded in c0 around -inf 2.3%
associate-*r*2.3%
distribute-rgt1-in2.3%
metadata-eval2.3%
mul0-lft57.4%
metadata-eval57.4%
mul0-lft4.4%
metadata-eval4.4%
distribute-lft1-in4.4%
*-commutative4.4%
distribute-lft1-in4.4%
metadata-eval4.4%
mul0-lft57.4%
Simplified57.4%
Final simplification63.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* h (* M M)))
(t_1 (* (* w h) (* D D)))
(t_2 (/ c0 (* 2.0 w)))
(t_3 (* t_2 (* 2.0 (* d (/ (* c0 d) t_1)))))
(t_4 (* (/ 0.25 d) (/ D (/ d (* D t_0))))))
(if (<= c0 -4.4e+267)
t_3
(if (<= c0 -1.28e+227)
t_4
(if (<= c0 -0.0025)
t_3
(if (<= c0 -8.5e-115)
(* (/ c0 w) (/ (* 0.5 (/ (pow (/ D d) 2.0) (/ c0 (* w t_0)))) 2.0))
(if (<= c0 -8e-204)
t_3
(if (<= c0 1.15e-120)
(* t_2 (* c0 0.0))
(if (<= c0 3.1e-95)
(* t_2 (/ (* 2.0 (* c0 (* d d))) t_1))
(if (<= c0 7.4e+221) t_4 t_3))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = h * (M * M);
double t_1 = (w * h) * (D * D);
double t_2 = c0 / (2.0 * w);
double t_3 = t_2 * (2.0 * (d * ((c0 * d) / t_1)));
double t_4 = (0.25 / d) * (D / (d / (D * t_0)));
double tmp;
if (c0 <= -4.4e+267) {
tmp = t_3;
} else if (c0 <= -1.28e+227) {
tmp = t_4;
} else if (c0 <= -0.0025) {
tmp = t_3;
} else if (c0 <= -8.5e-115) {
tmp = (c0 / w) * ((0.5 * (pow((D / d), 2.0) / (c0 / (w * t_0)))) / 2.0);
} else if (c0 <= -8e-204) {
tmp = t_3;
} else if (c0 <= 1.15e-120) {
tmp = t_2 * (c0 * 0.0);
} else if (c0 <= 3.1e-95) {
tmp = t_2 * ((2.0 * (c0 * (d * d))) / t_1);
} else if (c0 <= 7.4e+221) {
tmp = t_4;
} else {
tmp = t_3;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = h * (m * m)
t_1 = (w * h) * (d * d)
t_2 = c0 / (2.0d0 * w)
t_3 = t_2 * (2.0d0 * (d_1 * ((c0 * d_1) / t_1)))
t_4 = (0.25d0 / d_1) * (d / (d_1 / (d * t_0)))
if (c0 <= (-4.4d+267)) then
tmp = t_3
else if (c0 <= (-1.28d+227)) then
tmp = t_4
else if (c0 <= (-0.0025d0)) then
tmp = t_3
else if (c0 <= (-8.5d-115)) then
tmp = (c0 / w) * ((0.5d0 * (((d / d_1) ** 2.0d0) / (c0 / (w * t_0)))) / 2.0d0)
else if (c0 <= (-8d-204)) then
tmp = t_3
else if (c0 <= 1.15d-120) then
tmp = t_2 * (c0 * 0.0d0)
else if (c0 <= 3.1d-95) then
tmp = t_2 * ((2.0d0 * (c0 * (d_1 * d_1))) / t_1)
else if (c0 <= 7.4d+221) then
tmp = t_4
else
tmp = t_3
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 = h * (M * M);
double t_1 = (w * h) * (D * D);
double t_2 = c0 / (2.0 * w);
double t_3 = t_2 * (2.0 * (d * ((c0 * d) / t_1)));
double t_4 = (0.25 / d) * (D / (d / (D * t_0)));
double tmp;
if (c0 <= -4.4e+267) {
tmp = t_3;
} else if (c0 <= -1.28e+227) {
tmp = t_4;
} else if (c0 <= -0.0025) {
tmp = t_3;
} else if (c0 <= -8.5e-115) {
tmp = (c0 / w) * ((0.5 * (Math.pow((D / d), 2.0) / (c0 / (w * t_0)))) / 2.0);
} else if (c0 <= -8e-204) {
tmp = t_3;
} else if (c0 <= 1.15e-120) {
tmp = t_2 * (c0 * 0.0);
} else if (c0 <= 3.1e-95) {
tmp = t_2 * ((2.0 * (c0 * (d * d))) / t_1);
} else if (c0 <= 7.4e+221) {
tmp = t_4;
} else {
tmp = t_3;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = h * (M * M) t_1 = (w * h) * (D * D) t_2 = c0 / (2.0 * w) t_3 = t_2 * (2.0 * (d * ((c0 * d) / t_1))) t_4 = (0.25 / d) * (D / (d / (D * t_0))) tmp = 0 if c0 <= -4.4e+267: tmp = t_3 elif c0 <= -1.28e+227: tmp = t_4 elif c0 <= -0.0025: tmp = t_3 elif c0 <= -8.5e-115: tmp = (c0 / w) * ((0.5 * (math.pow((D / d), 2.0) / (c0 / (w * t_0)))) / 2.0) elif c0 <= -8e-204: tmp = t_3 elif c0 <= 1.15e-120: tmp = t_2 * (c0 * 0.0) elif c0 <= 3.1e-95: tmp = t_2 * ((2.0 * (c0 * (d * d))) / t_1) elif c0 <= 7.4e+221: tmp = t_4 else: tmp = t_3 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(h * Float64(M * M)) t_1 = Float64(Float64(w * h) * Float64(D * D)) t_2 = Float64(c0 / Float64(2.0 * w)) t_3 = Float64(t_2 * Float64(2.0 * Float64(d * Float64(Float64(c0 * d) / t_1)))) t_4 = Float64(Float64(0.25 / d) * Float64(D / Float64(d / Float64(D * t_0)))) tmp = 0.0 if (c0 <= -4.4e+267) tmp = t_3; elseif (c0 <= -1.28e+227) tmp = t_4; elseif (c0 <= -0.0025) tmp = t_3; elseif (c0 <= -8.5e-115) tmp = Float64(Float64(c0 / w) * Float64(Float64(0.5 * Float64((Float64(D / d) ^ 2.0) / Float64(c0 / Float64(w * t_0)))) / 2.0)); elseif (c0 <= -8e-204) tmp = t_3; elseif (c0 <= 1.15e-120) tmp = Float64(t_2 * Float64(c0 * 0.0)); elseif (c0 <= 3.1e-95) tmp = Float64(t_2 * Float64(Float64(2.0 * Float64(c0 * Float64(d * d))) / t_1)); elseif (c0 <= 7.4e+221) tmp = t_4; else tmp = t_3; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = h * (M * M); t_1 = (w * h) * (D * D); t_2 = c0 / (2.0 * w); t_3 = t_2 * (2.0 * (d * ((c0 * d) / t_1))); t_4 = (0.25 / d) * (D / (d / (D * t_0))); tmp = 0.0; if (c0 <= -4.4e+267) tmp = t_3; elseif (c0 <= -1.28e+227) tmp = t_4; elseif (c0 <= -0.0025) tmp = t_3; elseif (c0 <= -8.5e-115) tmp = (c0 / w) * ((0.5 * (((D / d) ^ 2.0) / (c0 / (w * t_0)))) / 2.0); elseif (c0 <= -8e-204) tmp = t_3; elseif (c0 <= 1.15e-120) tmp = t_2 * (c0 * 0.0); elseif (c0 <= 3.1e-95) tmp = t_2 * ((2.0 * (c0 * (d * d))) / t_1); elseif (c0 <= 7.4e+221) tmp = t_4; else tmp = t_3; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * N[(2.0 * N[(d * N[(N[(c0 * d), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(0.25 / d), $MachinePrecision] * N[(D / N[(d / N[(D * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -4.4e+267], t$95$3, If[LessEqual[c0, -1.28e+227], t$95$4, If[LessEqual[c0, -0.0025], t$95$3, If[LessEqual[c0, -8.5e-115], N[(N[(c0 / w), $MachinePrecision] * N[(N[(0.5 * N[(N[Power[N[(D / d), $MachinePrecision], 2.0], $MachinePrecision] / N[(c0 / N[(w * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, -8e-204], t$95$3, If[LessEqual[c0, 1.15e-120], N[(t$95$2 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 3.1e-95], N[(t$95$2 * N[(N[(2.0 * N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 7.4e+221], t$95$4, t$95$3]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := h \cdot \left(M \cdot M\right)\\
t_1 := \left(w \cdot h\right) \cdot \left(D \cdot D\right)\\
t_2 := \frac{c0}{2 \cdot w}\\
t_3 := t_2 \cdot \left(2 \cdot \left(d \cdot \frac{c0 \cdot d}{t_1}\right)\right)\\
t_4 := \frac{0.25}{d} \cdot \frac{D}{\frac{d}{D \cdot t_0}}\\
\mathbf{if}\;c0 \leq -4.4 \cdot 10^{+267}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c0 \leq -1.28 \cdot 10^{+227}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;c0 \leq -0.0025:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c0 \leq -8.5 \cdot 10^{-115}:\\
\;\;\;\;\frac{c0}{w} \cdot \frac{0.5 \cdot \frac{{\left(\frac{D}{d}\right)}^{2}}{\frac{c0}{w \cdot t_0}}}{2}\\
\mathbf{elif}\;c0 \leq -8 \cdot 10^{-204}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c0 \leq 1.15 \cdot 10^{-120}:\\
\;\;\;\;t_2 \cdot \left(c0 \cdot 0\right)\\
\mathbf{elif}\;c0 \leq 3.1 \cdot 10^{-95}:\\
\;\;\;\;t_2 \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{t_1}\\
\mathbf{elif}\;c0 \leq 7.4 \cdot 10^{+221}:\\
\;\;\;\;t_4\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if c0 < -4.4000000000000002e267 or -1.27999999999999991e227 < c0 < -0.00250000000000000005 or -8.49999999999999953e-115 < c0 < -8.00000000000000001e-204 or 7.40000000000000002e221 < c0 Initial program 43.6%
associate-*l*43.6%
difference-of-squares54.3%
associate-*l*54.3%
associate-*l*55.2%
Simplified55.2%
Taylor expanded in c0 around inf 54.4%
*-commutative54.4%
associate-*r*54.5%
unpow254.5%
associate-*r/54.5%
unpow254.5%
associate-*r*61.1%
associate-*r/61.0%
unpow261.0%
associate-*r*61.7%
*-commutative61.7%
unpow261.7%
Simplified61.7%
if -4.4000000000000002e267 < c0 < -1.27999999999999991e227 or 3.09999999999999992e-95 < c0 < 7.40000000000000002e221Initial program 20.1%
Taylor expanded in c0 around -inf 6.4%
fma-def6.4%
times-frac7.8%
unpow27.8%
unpow27.8%
*-commutative7.8%
unpow27.8%
associate-*r*7.8%
Simplified43.5%
Taylor expanded in c0 around 0 46.9%
associate-*r/46.9%
*-commutative46.9%
*-commutative46.9%
unpow246.9%
unpow246.9%
unpow246.9%
Simplified46.9%
*-un-lft-identity46.9%
times-frac50.2%
associate-*l*62.5%
Applied egg-rr62.5%
*-lft-identity62.5%
associate-/l*65.5%
Simplified65.5%
if -0.00250000000000000005 < c0 < -8.49999999999999953e-115Initial program 28.3%
Taylor expanded in c0 around -inf 8.0%
fma-def8.0%
times-frac8.0%
unpow28.0%
unpow28.0%
*-commutative8.0%
unpow28.0%
associate-*r*8.0%
Simplified56.8%
associate-*r/56.8%
times-frac60.9%
Applied egg-rr60.9%
associate-*l/60.9%
pow260.9%
mul0-rgt60.9%
*-commutative60.9%
Applied egg-rr60.9%
times-frac60.9%
fma-udef60.9%
+-rgt-identity60.9%
associate-/l*60.9%
Simplified60.9%
if -8.00000000000000001e-204 < c0 < 1.14999999999999993e-120Initial program 19.3%
associate-*l*19.3%
difference-of-squares19.3%
associate-*l*19.3%
associate-*l*19.3%
Simplified19.3%
Taylor expanded in c0 around -inf 2.3%
associate-*r*2.3%
distribute-rgt1-in2.3%
metadata-eval2.3%
mul0-lft57.4%
metadata-eval57.4%
mul0-lft4.4%
metadata-eval4.4%
distribute-lft1-in4.4%
*-commutative4.4%
distribute-lft1-in4.4%
metadata-eval4.4%
mul0-lft57.4%
Simplified57.4%
if 1.14999999999999993e-120 < c0 < 3.09999999999999992e-95Initial program 81.3%
times-frac81.3%
fma-def81.3%
times-frac81.3%
difference-of-squares81.3%
Simplified81.3%
fma-udef81.3%
associate-/l/81.3%
pow281.3%
associate-*l*81.3%
div-inv81.3%
clear-num81.3%
associate-*r/81.3%
*-commutative81.3%
Applied egg-rr81.3%
Taylor expanded in c0 around inf 99.1%
associate-*r/99.1%
unpow299.1%
unpow299.1%
Simplified99.1%
Final simplification62.5%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* (/ 0.25 d) (/ D (/ d (* D (* h (* M M)))))))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (* t_1 (* 2.0 (* d (/ (* c0 d) (* (* w h) (* D D)))))))
(t_3 (* t_1 (* c0 0.0))))
(if (<= c0 -5.5e+265)
t_2
(if (<= c0 -5.5e+226)
t_0
(if (<= c0 -8e-5)
t_2
(if (<= c0 -8.5e-115)
t_3
(if (<= c0 -2.8e-185)
t_2
(if (<= c0 1.15e-120)
t_3
(if (or (<= c0 1e-96) (not (<= c0 6.9e+217))) t_2 t_0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (0.25 / d) * (D / (d / (D * (h * (M * M)))));
double t_1 = c0 / (2.0 * w);
double t_2 = t_1 * (2.0 * (d * ((c0 * d) / ((w * h) * (D * D)))));
double t_3 = t_1 * (c0 * 0.0);
double tmp;
if (c0 <= -5.5e+265) {
tmp = t_2;
} else if (c0 <= -5.5e+226) {
tmp = t_0;
} else if (c0 <= -8e-5) {
tmp = t_2;
} else if (c0 <= -8.5e-115) {
tmp = t_3;
} else if (c0 <= -2.8e-185) {
tmp = t_2;
} else if (c0 <= 1.15e-120) {
tmp = t_3;
} else if ((c0 <= 1e-96) || !(c0 <= 6.9e+217)) {
tmp = t_2;
} 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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (0.25d0 / d_1) * (d / (d_1 / (d * (h * (m * m)))))
t_1 = c0 / (2.0d0 * w)
t_2 = t_1 * (2.0d0 * (d_1 * ((c0 * d_1) / ((w * h) * (d * d)))))
t_3 = t_1 * (c0 * 0.0d0)
if (c0 <= (-5.5d+265)) then
tmp = t_2
else if (c0 <= (-5.5d+226)) then
tmp = t_0
else if (c0 <= (-8d-5)) then
tmp = t_2
else if (c0 <= (-8.5d-115)) then
tmp = t_3
else if (c0 <= (-2.8d-185)) then
tmp = t_2
else if (c0 <= 1.15d-120) then
tmp = t_3
else if ((c0 <= 1d-96) .or. (.not. (c0 <= 6.9d+217))) then
tmp = t_2
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 = (0.25 / d) * (D / (d / (D * (h * (M * M)))));
double t_1 = c0 / (2.0 * w);
double t_2 = t_1 * (2.0 * (d * ((c0 * d) / ((w * h) * (D * D)))));
double t_3 = t_1 * (c0 * 0.0);
double tmp;
if (c0 <= -5.5e+265) {
tmp = t_2;
} else if (c0 <= -5.5e+226) {
tmp = t_0;
} else if (c0 <= -8e-5) {
tmp = t_2;
} else if (c0 <= -8.5e-115) {
tmp = t_3;
} else if (c0 <= -2.8e-185) {
tmp = t_2;
} else if (c0 <= 1.15e-120) {
tmp = t_3;
} else if ((c0 <= 1e-96) || !(c0 <= 6.9e+217)) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (0.25 / d) * (D / (d / (D * (h * (M * M))))) t_1 = c0 / (2.0 * w) t_2 = t_1 * (2.0 * (d * ((c0 * d) / ((w * h) * (D * D))))) t_3 = t_1 * (c0 * 0.0) tmp = 0 if c0 <= -5.5e+265: tmp = t_2 elif c0 <= -5.5e+226: tmp = t_0 elif c0 <= -8e-5: tmp = t_2 elif c0 <= -8.5e-115: tmp = t_3 elif c0 <= -2.8e-185: tmp = t_2 elif c0 <= 1.15e-120: tmp = t_3 elif (c0 <= 1e-96) or not (c0 <= 6.9e+217): tmp = t_2 else: tmp = t_0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(0.25 / d) * Float64(D / Float64(d / Float64(D * Float64(h * Float64(M * M)))))) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(t_1 * Float64(2.0 * Float64(d * Float64(Float64(c0 * d) / Float64(Float64(w * h) * Float64(D * D)))))) t_3 = Float64(t_1 * Float64(c0 * 0.0)) tmp = 0.0 if (c0 <= -5.5e+265) tmp = t_2; elseif (c0 <= -5.5e+226) tmp = t_0; elseif (c0 <= -8e-5) tmp = t_2; elseif (c0 <= -8.5e-115) tmp = t_3; elseif (c0 <= -2.8e-185) tmp = t_2; elseif (c0 <= 1.15e-120) tmp = t_3; elseif ((c0 <= 1e-96) || !(c0 <= 6.9e+217)) tmp = t_2; else tmp = t_0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (0.25 / d) * (D / (d / (D * (h * (M * M))))); t_1 = c0 / (2.0 * w); t_2 = t_1 * (2.0 * (d * ((c0 * d) / ((w * h) * (D * D))))); t_3 = t_1 * (c0 * 0.0); tmp = 0.0; if (c0 <= -5.5e+265) tmp = t_2; elseif (c0 <= -5.5e+226) tmp = t_0; elseif (c0 <= -8e-5) tmp = t_2; elseif (c0 <= -8.5e-115) tmp = t_3; elseif (c0 <= -2.8e-185) tmp = t_2; elseif (c0 <= 1.15e-120) tmp = t_3; elseif ((c0 <= 1e-96) || ~((c0 <= 6.9e+217))) tmp = t_2; else tmp = t_0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(0.25 / d), $MachinePrecision] * N[(D / N[(d / N[(D * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(2.0 * N[(d * N[(N[(c0 * d), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -5.5e+265], t$95$2, If[LessEqual[c0, -5.5e+226], t$95$0, If[LessEqual[c0, -8e-5], t$95$2, If[LessEqual[c0, -8.5e-115], t$95$3, If[LessEqual[c0, -2.8e-185], t$95$2, If[LessEqual[c0, 1.15e-120], t$95$3, If[Or[LessEqual[c0, 1e-96], N[Not[LessEqual[c0, 6.9e+217]], $MachinePrecision]], t$95$2, t$95$0]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{0.25}{d} \cdot \frac{D}{\frac{d}{D \cdot \left(h \cdot \left(M \cdot M\right)\right)}}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := t_1 \cdot \left(2 \cdot \left(d \cdot \frac{c0 \cdot d}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)\right)\\
t_3 := t_1 \cdot \left(c0 \cdot 0\right)\\
\mathbf{if}\;c0 \leq -5.5 \cdot 10^{+265}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c0 \leq -5.5 \cdot 10^{+226}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c0 \leq -8 \cdot 10^{-5}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c0 \leq -8.5 \cdot 10^{-115}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c0 \leq -2.8 \cdot 10^{-185}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c0 \leq 1.15 \cdot 10^{-120}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c0 \leq 10^{-96} \lor \neg \left(c0 \leq 6.9 \cdot 10^{+217}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if c0 < -5.4999999999999997e265 or -5.5000000000000005e226 < c0 < -8.00000000000000065e-5 or -8.49999999999999953e-115 < c0 < -2.79999999999999991e-185 or 1.14999999999999993e-120 < c0 < 9.9999999999999991e-97 or 6.89999999999999969e217 < c0 Initial program 45.2%
associate-*l*44.5%
difference-of-squares54.8%
associate-*l*54.7%
associate-*l*55.5%
Simplified55.5%
Taylor expanded in c0 around inf 56.3%
*-commutative56.3%
associate-*r*55.6%
unpow255.6%
associate-*r/55.6%
unpow255.6%
associate-*r*61.9%
associate-*r/61.8%
unpow261.8%
associate-*r*63.3%
*-commutative63.3%
unpow263.3%
Simplified63.3%
if -5.4999999999999997e265 < c0 < -5.5000000000000005e226 or 9.9999999999999991e-97 < c0 < 6.89999999999999969e217Initial program 20.1%
Taylor expanded in c0 around -inf 6.4%
fma-def6.4%
times-frac7.8%
unpow27.8%
unpow27.8%
*-commutative7.8%
unpow27.8%
associate-*r*7.8%
Simplified43.5%
Taylor expanded in c0 around 0 46.9%
associate-*r/46.9%
*-commutative46.9%
*-commutative46.9%
unpow246.9%
unpow246.9%
unpow246.9%
Simplified46.9%
*-un-lft-identity46.9%
times-frac50.2%
associate-*l*62.5%
Applied egg-rr62.5%
*-lft-identity62.5%
associate-/l*65.5%
Simplified65.5%
if -8.00000000000000065e-5 < c0 < -8.49999999999999953e-115 or -2.79999999999999991e-185 < c0 < 1.14999999999999993e-120Initial program 22.3%
associate-*l*21.0%
difference-of-squares21.0%
associate-*l*21.0%
associate-*l*22.3%
Simplified22.3%
Taylor expanded in c0 around -inf 4.2%
associate-*r*4.2%
distribute-rgt1-in4.2%
metadata-eval4.2%
mul0-lft57.5%
metadata-eval57.5%
mul0-lft7.0%
metadata-eval7.0%
distribute-lft1-in7.0%
*-commutative7.0%
distribute-lft1-in7.0%
metadata-eval7.0%
mul0-lft57.5%
Simplified57.5%
Final simplification62.2%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* (* w h) (* D D)))
(t_1 (* (/ 0.25 d) (/ D (/ d (* D (* h (* M M)))))))
(t_2 (/ c0 (* 2.0 w)))
(t_3 (* t_2 (* 2.0 (* d (/ (* c0 d) t_0)))))
(t_4 (* t_2 (* c0 0.0))))
(if (<= c0 -5.8e+266)
t_3
(if (<= c0 -3.2e+230)
t_1
(if (<= c0 -0.00185)
t_3
(if (<= c0 -3.15e-117)
t_4
(if (<= c0 -4.6e-185)
t_3
(if (<= c0 1.2e-122)
t_4
(if (<= c0 2.1e-95)
(* t_2 (/ (* 2.0 (* c0 (* d d))) t_0))
(if (<= c0 9.2e+219) t_1 t_3))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (w * h) * (D * D);
double t_1 = (0.25 / d) * (D / (d / (D * (h * (M * M)))));
double t_2 = c0 / (2.0 * w);
double t_3 = t_2 * (2.0 * (d * ((c0 * d) / t_0)));
double t_4 = t_2 * (c0 * 0.0);
double tmp;
if (c0 <= -5.8e+266) {
tmp = t_3;
} else if (c0 <= -3.2e+230) {
tmp = t_1;
} else if (c0 <= -0.00185) {
tmp = t_3;
} else if (c0 <= -3.15e-117) {
tmp = t_4;
} else if (c0 <= -4.6e-185) {
tmp = t_3;
} else if (c0 <= 1.2e-122) {
tmp = t_4;
} else if (c0 <= 2.1e-95) {
tmp = t_2 * ((2.0 * (c0 * (d * d))) / t_0);
} else if (c0 <= 9.2e+219) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = (w * h) * (d * d)
t_1 = (0.25d0 / d_1) * (d / (d_1 / (d * (h * (m * m)))))
t_2 = c0 / (2.0d0 * w)
t_3 = t_2 * (2.0d0 * (d_1 * ((c0 * d_1) / t_0)))
t_4 = t_2 * (c0 * 0.0d0)
if (c0 <= (-5.8d+266)) then
tmp = t_3
else if (c0 <= (-3.2d+230)) then
tmp = t_1
else if (c0 <= (-0.00185d0)) then
tmp = t_3
else if (c0 <= (-3.15d-117)) then
tmp = t_4
else if (c0 <= (-4.6d-185)) then
tmp = t_3
else if (c0 <= 1.2d-122) then
tmp = t_4
else if (c0 <= 2.1d-95) then
tmp = t_2 * ((2.0d0 * (c0 * (d_1 * d_1))) / t_0)
else if (c0 <= 9.2d+219) then
tmp = t_1
else
tmp = t_3
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 = (w * h) * (D * D);
double t_1 = (0.25 / d) * (D / (d / (D * (h * (M * M)))));
double t_2 = c0 / (2.0 * w);
double t_3 = t_2 * (2.0 * (d * ((c0 * d) / t_0)));
double t_4 = t_2 * (c0 * 0.0);
double tmp;
if (c0 <= -5.8e+266) {
tmp = t_3;
} else if (c0 <= -3.2e+230) {
tmp = t_1;
} else if (c0 <= -0.00185) {
tmp = t_3;
} else if (c0 <= -3.15e-117) {
tmp = t_4;
} else if (c0 <= -4.6e-185) {
tmp = t_3;
} else if (c0 <= 1.2e-122) {
tmp = t_4;
} else if (c0 <= 2.1e-95) {
tmp = t_2 * ((2.0 * (c0 * (d * d))) / t_0);
} else if (c0 <= 9.2e+219) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (w * h) * (D * D) t_1 = (0.25 / d) * (D / (d / (D * (h * (M * M))))) t_2 = c0 / (2.0 * w) t_3 = t_2 * (2.0 * (d * ((c0 * d) / t_0))) t_4 = t_2 * (c0 * 0.0) tmp = 0 if c0 <= -5.8e+266: tmp = t_3 elif c0 <= -3.2e+230: tmp = t_1 elif c0 <= -0.00185: tmp = t_3 elif c0 <= -3.15e-117: tmp = t_4 elif c0 <= -4.6e-185: tmp = t_3 elif c0 <= 1.2e-122: tmp = t_4 elif c0 <= 2.1e-95: tmp = t_2 * ((2.0 * (c0 * (d * d))) / t_0) elif c0 <= 9.2e+219: tmp = t_1 else: tmp = t_3 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(w * h) * Float64(D * D)) t_1 = Float64(Float64(0.25 / d) * Float64(D / Float64(d / Float64(D * Float64(h * Float64(M * M)))))) t_2 = Float64(c0 / Float64(2.0 * w)) t_3 = Float64(t_2 * Float64(2.0 * Float64(d * Float64(Float64(c0 * d) / t_0)))) t_4 = Float64(t_2 * Float64(c0 * 0.0)) tmp = 0.0 if (c0 <= -5.8e+266) tmp = t_3; elseif (c0 <= -3.2e+230) tmp = t_1; elseif (c0 <= -0.00185) tmp = t_3; elseif (c0 <= -3.15e-117) tmp = t_4; elseif (c0 <= -4.6e-185) tmp = t_3; elseif (c0 <= 1.2e-122) tmp = t_4; elseif (c0 <= 2.1e-95) tmp = Float64(t_2 * Float64(Float64(2.0 * Float64(c0 * Float64(d * d))) / t_0)); elseif (c0 <= 9.2e+219) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (w * h) * (D * D); t_1 = (0.25 / d) * (D / (d / (D * (h * (M * M))))); t_2 = c0 / (2.0 * w); t_3 = t_2 * (2.0 * (d * ((c0 * d) / t_0))); t_4 = t_2 * (c0 * 0.0); tmp = 0.0; if (c0 <= -5.8e+266) tmp = t_3; elseif (c0 <= -3.2e+230) tmp = t_1; elseif (c0 <= -0.00185) tmp = t_3; elseif (c0 <= -3.15e-117) tmp = t_4; elseif (c0 <= -4.6e-185) tmp = t_3; elseif (c0 <= 1.2e-122) tmp = t_4; elseif (c0 <= 2.1e-95) tmp = t_2 * ((2.0 * (c0 * (d * d))) / t_0); elseif (c0 <= 9.2e+219) tmp = t_1; else tmp = t_3; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.25 / d), $MachinePrecision] * N[(D / N[(d / N[(D * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * N[(2.0 * N[(d * N[(N[(c0 * d), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -5.8e+266], t$95$3, If[LessEqual[c0, -3.2e+230], t$95$1, If[LessEqual[c0, -0.00185], t$95$3, If[LessEqual[c0, -3.15e-117], t$95$4, If[LessEqual[c0, -4.6e-185], t$95$3, If[LessEqual[c0, 1.2e-122], t$95$4, If[LessEqual[c0, 2.1e-95], N[(t$95$2 * N[(N[(2.0 * N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 9.2e+219], t$95$1, t$95$3]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(w \cdot h\right) \cdot \left(D \cdot D\right)\\
t_1 := \frac{0.25}{d} \cdot \frac{D}{\frac{d}{D \cdot \left(h \cdot \left(M \cdot M\right)\right)}}\\
t_2 := \frac{c0}{2 \cdot w}\\
t_3 := t_2 \cdot \left(2 \cdot \left(d \cdot \frac{c0 \cdot d}{t_0}\right)\right)\\
t_4 := t_2 \cdot \left(c0 \cdot 0\right)\\
\mathbf{if}\;c0 \leq -5.8 \cdot 10^{+266}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c0 \leq -3.2 \cdot 10^{+230}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c0 \leq -0.00185:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c0 \leq -3.15 \cdot 10^{-117}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;c0 \leq -4.6 \cdot 10^{-185}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c0 \leq 1.2 \cdot 10^{-122}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;c0 \leq 2.1 \cdot 10^{-95}:\\
\;\;\;\;t_2 \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{t_0}\\
\mathbf{elif}\;c0 \leq 9.2 \cdot 10^{+219}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if c0 < -5.80000000000000035e266 or -3.2e230 < c0 < -0.0018500000000000001 or -3.1499999999999999e-117 < c0 < -4.6000000000000002e-185 or 9.2000000000000004e219 < c0 Initial program 43.6%
associate-*l*43.6%
difference-of-squares54.3%
associate-*l*54.3%
associate-*l*55.2%
Simplified55.2%
Taylor expanded in c0 around inf 54.4%
*-commutative54.4%
associate-*r*54.5%
unpow254.5%
associate-*r/54.5%
unpow254.5%
associate-*r*61.1%
associate-*r/61.0%
unpow261.0%
associate-*r*61.7%
*-commutative61.7%
unpow261.7%
Simplified61.7%
if -5.80000000000000035e266 < c0 < -3.2e230 or 2.1e-95 < c0 < 9.2000000000000004e219Initial program 20.1%
Taylor expanded in c0 around -inf 6.4%
fma-def6.4%
times-frac7.8%
unpow27.8%
unpow27.8%
*-commutative7.8%
unpow27.8%
associate-*r*7.8%
Simplified43.5%
Taylor expanded in c0 around 0 46.9%
associate-*r/46.9%
*-commutative46.9%
*-commutative46.9%
unpow246.9%
unpow246.9%
unpow246.9%
Simplified46.9%
*-un-lft-identity46.9%
times-frac50.2%
associate-*l*62.5%
Applied egg-rr62.5%
*-lft-identity62.5%
associate-/l*65.5%
Simplified65.5%
if -0.0018500000000000001 < c0 < -3.1499999999999999e-117 or -4.6000000000000002e-185 < c0 < 1.19999999999999994e-122Initial program 22.3%
associate-*l*21.0%
difference-of-squares21.0%
associate-*l*21.0%
associate-*l*22.3%
Simplified22.3%
Taylor expanded in c0 around -inf 4.2%
associate-*r*4.2%
distribute-rgt1-in4.2%
metadata-eval4.2%
mul0-lft57.5%
metadata-eval57.5%
mul0-lft7.0%
metadata-eval7.0%
distribute-lft1-in7.0%
*-commutative7.0%
distribute-lft1-in7.0%
metadata-eval7.0%
mul0-lft57.5%
Simplified57.5%
if 1.19999999999999994e-122 < c0 < 2.1e-95Initial program 81.3%
times-frac81.3%
fma-def81.3%
times-frac81.3%
difference-of-squares81.3%
Simplified81.3%
fma-udef81.3%
associate-/l/81.3%
pow281.3%
associate-*l*81.3%
div-inv81.3%
clear-num81.3%
associate-*r/81.3%
*-commutative81.3%
Applied egg-rr81.3%
Taylor expanded in c0 around inf 99.1%
associate-*r/99.1%
unpow299.1%
unpow299.1%
Simplified99.1%
Final simplification62.2%
(FPCore (c0 w h D d M) :precision binary64 (if (<= (* M M) 2.9e-246) (* (/ c0 (* 2.0 w)) (* c0 0.0)) (* 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.9e-246) {
tmp = (c0 / (2.0 * w)) * (c0 * 0.0);
} 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.9d-246) then
tmp = (c0 / (2.0d0 * w)) * (c0 * 0.0d0)
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.9e-246) {
tmp = (c0 / (2.0 * w)) * (c0 * 0.0);
} 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.9e-246: tmp = (c0 / (2.0 * w)) * (c0 * 0.0) 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.9e-246) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(c0 * 0.0)); 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.9e-246) tmp = (c0 / (2.0 * w)) * (c0 * 0.0); 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.9e-246], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(c0 * 0.0), $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.9 \cdot 10^{-246}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(c0 \cdot 0\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) < 2.9e-246Initial program 39.7%
associate-*l*38.8%
difference-of-squares38.8%
associate-*l*38.8%
associate-*l*40.5%
Simplified40.5%
Taylor expanded in c0 around -inf 7.9%
associate-*r*7.9%
distribute-rgt1-in7.9%
metadata-eval7.9%
mul0-lft43.2%
metadata-eval43.2%
mul0-lft12.0%
metadata-eval12.0%
distribute-lft1-in12.0%
*-commutative12.0%
distribute-lft1-in12.0%
metadata-eval12.0%
mul0-lft43.2%
Simplified43.2%
if 2.9e-246 < (*.f64 M M) Initial program 25.6%
Taylor expanded in c0 around -inf 3.6%
fma-def3.6%
times-frac3.6%
unpow23.6%
unpow23.6%
*-commutative3.6%
unpow23.6%
associate-*r*3.6%
Simplified26.9%
Taylor expanded in c0 around 0 31.9%
associate-*r/31.9%
*-commutative31.9%
*-commutative31.9%
unpow231.9%
unpow231.9%
unpow231.9%
Simplified31.9%
Taylor expanded in D around 0 31.9%
associate-/l*33.1%
unpow233.1%
unpow233.1%
*-commutative33.1%
unpow233.1%
Simplified33.1%
Final simplification37.8%
(FPCore (c0 w h D d M) :precision binary64 (* (/ 0.25 d) (/ D (/ d (* D (* h (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
return (0.25 / d) * (D / (d / (D * (h * (M * M)))));
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = (0.25d0 / d_1) * (d / (d_1 / (d * (h * (m * m)))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (0.25 / d) * (D / (d / (D * (h * (M * M)))));
}
def code(c0, w, h, D, d, M): return (0.25 / d) * (D / (d / (D * (h * (M * M)))))
function code(c0, w, h, D, d, M) return Float64(Float64(0.25 / d) * Float64(D / Float64(d / Float64(D * Float64(h * Float64(M * M)))))) end
function tmp = code(c0, w, h, D, d, M) tmp = (0.25 / d) * (D / (d / (D * (h * (M * M))))); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(0.25 / d), $MachinePrecision] * N[(D / N[(d / N[(D * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.25}{d} \cdot \frac{D}{\frac{d}{D \cdot \left(h \cdot \left(M \cdot M\right)\right)}}
\end{array}
Initial program 32.2%
Taylor expanded in c0 around -inf 5.2%
fma-def5.2%
times-frac5.2%
unpow25.2%
unpow25.2%
*-commutative5.2%
unpow25.2%
associate-*r*5.2%
Simplified31.3%
Taylor expanded in c0 around 0 34.1%
associate-*r/34.1%
*-commutative34.1%
*-commutative34.1%
unpow234.1%
unpow234.1%
unpow234.1%
Simplified34.1%
*-un-lft-identity34.1%
times-frac40.6%
associate-*l*47.0%
Applied egg-rr47.0%
*-lft-identity47.0%
associate-/l*47.8%
Simplified47.8%
Final simplification47.8%
(FPCore (c0 w h D d M) :precision binary64 (* (/ c0 (* 2.0 w)) (* c0 0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / (2.0 * w)) * (c0 * 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 = (c0 / (2.0d0 * w)) * (c0 * 0.0d0)
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / (2.0 * w)) * (c0 * 0.0);
}
def code(c0, w, h, D, d, M): return (c0 / (2.0 * w)) * (c0 * 0.0)
function code(c0, w, h, D, d, M) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(c0 * 0.0)) end
function tmp = code(c0, w, h, D, d, M) tmp = (c0 / (2.0 * w)) * (c0 * 0.0); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{c0}{2 \cdot w} \cdot \left(c0 \cdot 0\right)
\end{array}
Initial program 32.2%
associate-*l*31.5%
difference-of-squares38.2%
associate-*l*38.1%
associate-*l*40.0%
Simplified40.0%
Taylor expanded in c0 around -inf 3.8%
associate-*r*3.8%
distribute-rgt1-in3.8%
metadata-eval3.8%
mul0-lft33.4%
metadata-eval33.4%
mul0-lft5.7%
metadata-eval5.7%
distribute-lft1-in5.7%
*-commutative5.7%
distribute-lft1-in5.7%
metadata-eval5.7%
mul0-lft33.4%
Simplified33.4%
Final simplification33.4%
herbie shell --seed 2023261
(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))))))