
(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 10 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 (pow (/ d D) 2.0)) (t_1 (* c0 (/ 0.0 (* 2.0 w)))))
(if (<= w -6.2e+174)
t_1
(if (<= w -4.2e+14)
(* c0 (* (/ (/ c0 h) w) (/ t_0 w)))
(if (<= w -0.000195)
t_1
(if (<= w 1.6e-112)
(* c0 (/ (* (/ (* c0 2.0) (* w h)) t_0) (* 2.0 w)))
(if (or (<= w 3.9e-60) (not (<= w 6.8e+103)))
t_1
(*
c0
(/
(* 2.0 (* (/ (pow d 2.0) D) (/ c0 (* h (* w D)))))
(* 2.0 w))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = pow((d / D), 2.0);
double t_1 = c0 * (0.0 / (2.0 * w));
double tmp;
if (w <= -6.2e+174) {
tmp = t_1;
} else if (w <= -4.2e+14) {
tmp = c0 * (((c0 / h) / w) * (t_0 / w));
} else if (w <= -0.000195) {
tmp = t_1;
} else if (w <= 1.6e-112) {
tmp = c0 * ((((c0 * 2.0) / (w * h)) * t_0) / (2.0 * w));
} else if ((w <= 3.9e-60) || !(w <= 6.8e+103)) {
tmp = t_1;
} else {
tmp = c0 * ((2.0 * ((pow(d, 2.0) / D) * (c0 / (h * (w * D))))) / (2.0 * w));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (d_1 / d) ** 2.0d0
t_1 = c0 * (0.0d0 / (2.0d0 * w))
if (w <= (-6.2d+174)) then
tmp = t_1
else if (w <= (-4.2d+14)) then
tmp = c0 * (((c0 / h) / w) * (t_0 / w))
else if (w <= (-0.000195d0)) then
tmp = t_1
else if (w <= 1.6d-112) then
tmp = c0 * ((((c0 * 2.0d0) / (w * h)) * t_0) / (2.0d0 * w))
else if ((w <= 3.9d-60) .or. (.not. (w <= 6.8d+103))) then
tmp = t_1
else
tmp = c0 * ((2.0d0 * (((d_1 ** 2.0d0) / d) * (c0 / (h * (w * d))))) / (2.0d0 * w))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = Math.pow((d / D), 2.0);
double t_1 = c0 * (0.0 / (2.0 * w));
double tmp;
if (w <= -6.2e+174) {
tmp = t_1;
} else if (w <= -4.2e+14) {
tmp = c0 * (((c0 / h) / w) * (t_0 / w));
} else if (w <= -0.000195) {
tmp = t_1;
} else if (w <= 1.6e-112) {
tmp = c0 * ((((c0 * 2.0) / (w * h)) * t_0) / (2.0 * w));
} else if ((w <= 3.9e-60) || !(w <= 6.8e+103)) {
tmp = t_1;
} else {
tmp = c0 * ((2.0 * ((Math.pow(d, 2.0) / D) * (c0 / (h * (w * D))))) / (2.0 * w));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = math.pow((d / D), 2.0) t_1 = c0 * (0.0 / (2.0 * w)) tmp = 0 if w <= -6.2e+174: tmp = t_1 elif w <= -4.2e+14: tmp = c0 * (((c0 / h) / w) * (t_0 / w)) elif w <= -0.000195: tmp = t_1 elif w <= 1.6e-112: tmp = c0 * ((((c0 * 2.0) / (w * h)) * t_0) / (2.0 * w)) elif (w <= 3.9e-60) or not (w <= 6.8e+103): tmp = t_1 else: tmp = c0 * ((2.0 * ((math.pow(d, 2.0) / D) * (c0 / (h * (w * D))))) / (2.0 * w)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(d / D) ^ 2.0 t_1 = Float64(c0 * Float64(0.0 / Float64(2.0 * w))) tmp = 0.0 if (w <= -6.2e+174) tmp = t_1; elseif (w <= -4.2e+14) tmp = Float64(c0 * Float64(Float64(Float64(c0 / h) / w) * Float64(t_0 / w))); elseif (w <= -0.000195) tmp = t_1; elseif (w <= 1.6e-112) tmp = Float64(c0 * Float64(Float64(Float64(Float64(c0 * 2.0) / Float64(w * h)) * t_0) / Float64(2.0 * w))); elseif ((w <= 3.9e-60) || !(w <= 6.8e+103)) tmp = t_1; else tmp = Float64(c0 * Float64(Float64(2.0 * Float64(Float64((d ^ 2.0) / D) * Float64(c0 / Float64(h * Float64(w * D))))) / Float64(2.0 * w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (d / D) ^ 2.0; t_1 = c0 * (0.0 / (2.0 * w)); tmp = 0.0; if (w <= -6.2e+174) tmp = t_1; elseif (w <= -4.2e+14) tmp = c0 * (((c0 / h) / w) * (t_0 / w)); elseif (w <= -0.000195) tmp = t_1; elseif (w <= 1.6e-112) tmp = c0 * ((((c0 * 2.0) / (w * h)) * t_0) / (2.0 * w)); elseif ((w <= 3.9e-60) || ~((w <= 6.8e+103))) tmp = t_1; else tmp = c0 * ((2.0 * (((d ^ 2.0) / D) * (c0 / (h * (w * D))))) / (2.0 * w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -6.2e+174], t$95$1, If[LessEqual[w, -4.2e+14], N[(c0 * N[(N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision] * N[(t$95$0 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, -0.000195], t$95$1, If[LessEqual[w, 1.6e-112], N[(c0 * N[(N[(N[(N[(c0 * 2.0), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[w, 3.9e-60], N[Not[LessEqual[w, 6.8e+103]], $MachinePrecision]], t$95$1, N[(c0 * N[(N[(2.0 * N[(N[(N[Power[d, 2.0], $MachinePrecision] / D), $MachinePrecision] * N[(c0 / N[(h * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{2}\\
t_1 := c0 \cdot \frac{0}{2 \cdot w}\\
\mathbf{if}\;w \leq -6.2 \cdot 10^{+174}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;w \leq -4.2 \cdot 10^{+14}:\\
\;\;\;\;c0 \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \frac{t\_0}{w}\right)\\
\mathbf{elif}\;w \leq -0.000195:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;w \leq 1.6 \cdot 10^{-112}:\\
\;\;\;\;c0 \cdot \frac{\frac{c0 \cdot 2}{w \cdot h} \cdot t\_0}{2 \cdot w}\\
\mathbf{elif}\;w \leq 3.9 \cdot 10^{-60} \lor \neg \left(w \leq 6.8 \cdot 10^{+103}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{2 \cdot \left(\frac{{d}^{2}}{D} \cdot \frac{c0}{h \cdot \left(w \cdot D\right)}\right)}{2 \cdot w}\\
\end{array}
\end{array}
if w < -6.2e174 or -4.2e14 < w < -1.94999999999999996e-4 or 1.59999999999999997e-112 < w < 3.9000000000000002e-60 or 6.7999999999999997e103 < w Initial program 18.5%
Simplified32.6%
Taylor expanded in c0 around -inf 5.8%
distribute-lft-in3.2%
mul-1-neg3.2%
distribute-rgt-neg-in3.2%
associate-/l*3.2%
mul-1-neg3.2%
associate-/l*3.2%
distribute-lft1-in3.2%
metadata-eval3.2%
mul0-lft55.7%
metadata-eval55.7%
Simplified55.7%
if -6.2e174 < w < -4.2e14Initial program 27.6%
Simplified50.8%
Taylor expanded in c0 around -inf 4.6%
mul-1-neg4.6%
Simplified4.6%
associate-/l*4.6%
unpow24.6%
unpow24.6%
associate-*r*4.9%
*-commutative4.9%
*-commutative4.9%
associate-*r*4.6%
associate-*r/9.6%
add-cbrt-cube9.2%
pow1/310.0%
Applied egg-rr5.0%
Applied egg-rr60.1%
distribute-lft-out60.1%
associate-/r*60.3%
count-260.3%
Simplified60.3%
div-inv60.3%
associate-*r*60.3%
associate-/r*60.1%
*-commutative60.1%
Applied egg-rr60.1%
associate-*r/60.1%
*-rgt-identity60.1%
associate-*l*60.1%
associate-*r/60.0%
associate-/r*60.4%
*-commutative60.4%
times-frac60.4%
metadata-eval60.4%
Simplified60.4%
if -1.94999999999999996e-4 < w < 1.59999999999999997e-112Initial program 33.0%
Simplified58.0%
Taylor expanded in c0 around -inf 2.8%
mul-1-neg2.8%
Simplified2.8%
associate-/l*1.2%
unpow21.2%
unpow21.2%
associate-*r*1.8%
*-commutative1.8%
*-commutative1.8%
associate-*r*3.5%
associate-*r/2.0%
add-cbrt-cube1.3%
pow1/35.1%
Applied egg-rr3.8%
Applied egg-rr61.7%
distribute-lft-out61.7%
associate-/r*58.2%
count-258.2%
Simplified58.2%
pow158.2%
associate-*r*58.2%
associate-/r*61.7%
Applied egg-rr61.7%
unpow161.7%
associate-*l/61.7%
Simplified61.7%
if 3.9000000000000002e-60 < w < 6.7999999999999997e103Initial program 18.0%
Simplified52.8%
Taylor expanded in w around 0 49.2%
Taylor expanded in c0 around inf 46.1%
associate-*r/49.6%
Simplified49.6%
frac-2neg49.6%
add-log-exp31.9%
log-pow11.1%
log-pow15.1%
neg-log28.8%
unpow228.8%
pow-unpow33.2%
pow-exp32.3%
exp-prod25.5%
associate-*r*25.5%
exp-prod31.9%
*-commutative31.9%
neg-log14.6%
add-log-exp56.5%
frac-2neg56.5%
Applied egg-rr56.6%
div-inv56.5%
associate-*r/56.4%
pow256.4%
associate-*r*56.3%
*-commutative56.3%
frac-times52.9%
pow252.9%
associate-*r*52.9%
associate-*r*49.5%
*-commutative49.5%
*-commutative49.5%
Applied egg-rr49.5%
associate-*r/49.5%
*-rgt-identity49.5%
fma-undefine49.5%
count-249.5%
associate-*r/49.5%
*-commutative49.5%
times-frac52.7%
associate-*l*56.1%
*-commutative56.1%
Simplified56.1%
Final simplification59.0%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* (/ d D) (sqrt (/ c0 (* w h)))))
(t_1 (/ (* c0 (* d d)) (* (* D D) (* w h)))))
(if (<=
(* (/ c0 (* 2.0 w)) (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))
INFINITY)
(* c0 (/ (pow (hypot t_0 t_0) 2.0) (* 2.0 w)))
(* c0 (/ 0.0 (* 2.0 w))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (d / D) * sqrt((c0 / (w * h)));
double t_1 = (c0 * (d * d)) / ((D * D) * (w * h));
double tmp;
if (((c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= ((double) INFINITY)) {
tmp = c0 * (pow(hypot(t_0, t_0), 2.0) / (2.0 * w));
} else {
tmp = c0 * (0.0 / (2.0 * w));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (d / D) * Math.sqrt((c0 / (w * h)));
double t_1 = (c0 * (d * d)) / ((D * D) * (w * h));
double tmp;
if (((c0 / (2.0 * w)) * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = c0 * (Math.pow(Math.hypot(t_0, t_0), 2.0) / (2.0 * w));
} else {
tmp = c0 * (0.0 / (2.0 * w));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (d / D) * math.sqrt((c0 / (w * h))) t_1 = (c0 * (d * d)) / ((D * D) * (w * h)) tmp = 0 if ((c0 / (2.0 * w)) * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))) <= math.inf: tmp = c0 * (math.pow(math.hypot(t_0, t_0), 2.0) / (2.0 * w)) else: tmp = c0 * (0.0 / (2.0 * w)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(d / D) * sqrt(Float64(c0 / Float64(w * h)))) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) tmp = 0.0 if (Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= Inf) tmp = Float64(c0 * Float64((hypot(t_0, t_0) ^ 2.0) / Float64(2.0 * w))); else tmp = Float64(c0 * Float64(0.0 / Float64(2.0 * w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (d / D) * sqrt((c0 / (w * h))); t_1 = (c0 * (d * d)) / ((D * D) * (w * h)); tmp = 0.0; if (((c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= Inf) tmp = c0 * ((hypot(t_0, t_0) ^ 2.0) / (2.0 * w)); else tmp = c0 * (0.0 / (2.0 * w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(d / D), $MachinePrecision] * N[Sqrt[N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * 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[(c0 * N[(N[Power[N[Sqrt[t$95$0 ^ 2 + t$95$0 ^ 2], $MachinePrecision], 2.0], $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{d}{D} \cdot \sqrt{\frac{c0}{w \cdot h}}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
\mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_1 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;c0 \cdot \frac{{\left(\mathsf{hypot}\left(t\_0, t\_0\right)\right)}^{2}}{2 \cdot w}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{0}{2 \cdot w}\\
\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 78.9%
Simplified83.0%
Applied egg-rr79.3%
Taylor expanded in M around 0 86.7%
pow-base-186.7%
*-lft-identity86.7%
Simplified86.7%
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%
Simplified31.6%
Taylor expanded in c0 around -inf 1.3%
distribute-lft-in0.1%
mul-1-neg0.1%
distribute-rgt-neg-in0.1%
associate-/l*0.1%
mul-1-neg0.1%
associate-/l*0.1%
distribute-lft1-in0.1%
metadata-eval0.1%
mul0-lft44.0%
metadata-eval44.0%
Simplified44.0%
Final simplification58.2%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* w (* h D))) (t_1 (/ (* c0 (* d d)) (* (* D D) (* w h)))))
(if (<=
(* (/ c0 (* 2.0 w)) (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))
INFINITY)
(*
c0
(/
(fma c0 (* d (/ d (* D t_0))) (* c0 (* (/ d D) (/ d t_0))))
(* 2.0 w)))
(* c0 (/ 0.0 (* 2.0 w))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = w * (h * D);
double t_1 = (c0 * (d * d)) / ((D * D) * (w * h));
double tmp;
if (((c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= ((double) INFINITY)) {
tmp = c0 * (fma(c0, (d * (d / (D * t_0))), (c0 * ((d / D) * (d / t_0)))) / (2.0 * w));
} else {
tmp = c0 * (0.0 / (2.0 * w));
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(w * Float64(h * D)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) tmp = 0.0 if (Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= Inf) tmp = Float64(c0 * Float64(fma(c0, Float64(d * Float64(d / Float64(D * t_0))), Float64(c0 * Float64(Float64(d / D) * Float64(d / t_0)))) / Float64(2.0 * w))); else tmp = Float64(c0 * Float64(0.0 / Float64(2.0 * w))); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(w * N[(h * D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * 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[(c0 * N[(N[(c0 * N[(d * N[(d / N[(D * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c0 * N[(N[(d / D), $MachinePrecision] * N[(d / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := w \cdot \left(h \cdot D\right)\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
\mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_1 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;c0 \cdot \frac{\mathsf{fma}\left(c0, d \cdot \frac{d}{D \cdot t\_0}, c0 \cdot \left(\frac{d}{D} \cdot \frac{d}{t\_0}\right)\right)}{2 \cdot w}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{0}{2 \cdot w}\\
\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 78.9%
Simplified83.0%
Taylor expanded in w around 0 83.0%
Taylor expanded in c0 around inf 81.3%
associate-*r/81.3%
Simplified81.3%
frac-2neg81.3%
add-log-exp41.6%
log-pow35.8%
log-pow43.1%
neg-log34.9%
unpow234.9%
pow-unpow37.8%
pow-exp32.4%
exp-prod32.5%
associate-*r*32.5%
exp-prod30.1%
*-commutative30.1%
neg-log44.3%
add-log-exp83.4%
frac-2neg83.4%
Applied egg-rr86.3%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
Simplified31.6%
Taylor expanded in c0 around -inf 1.3%
distribute-lft-in0.1%
mul-1-neg0.1%
distribute-rgt-neg-in0.1%
associate-/l*0.1%
mul-1-neg0.1%
associate-/l*0.1%
distribute-lft1-in0.1%
metadata-eval0.1%
mul0-lft44.0%
metadata-eval44.0%
Simplified44.0%
Final simplification58.1%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* c0 (/ 0.0 (* 2.0 w)))))
(if (<= D 8e-288)
t_0
(if (<= D 1.5e-167)
(* c0 (/ (* (/ (* c0 2.0) (* w h)) (pow (/ d D) 2.0)) (* 2.0 w)))
(if (or (<= D 1.95e-66) (not (<= D 4.6e-37)))
(*
c0
(/
(fma
c0
(* d (/ d (* D (* w (* h D)))))
(* c0 (* (/ d (* w D)) (/ d (* h D)))))
(* 2.0 w)))
t_0)))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 * (0.0 / (2.0 * w));
double tmp;
if (D <= 8e-288) {
tmp = t_0;
} else if (D <= 1.5e-167) {
tmp = c0 * ((((c0 * 2.0) / (w * h)) * pow((d / D), 2.0)) / (2.0 * w));
} else if ((D <= 1.95e-66) || !(D <= 4.6e-37)) {
tmp = c0 * (fma(c0, (d * (d / (D * (w * (h * D))))), (c0 * ((d / (w * D)) * (d / (h * D))))) / (2.0 * w));
} else {
tmp = t_0;
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(c0 * Float64(0.0 / Float64(2.0 * w))) tmp = 0.0 if (D <= 8e-288) tmp = t_0; elseif (D <= 1.5e-167) tmp = Float64(c0 * Float64(Float64(Float64(Float64(c0 * 2.0) / Float64(w * h)) * (Float64(d / D) ^ 2.0)) / Float64(2.0 * w))); elseif ((D <= 1.95e-66) || !(D <= 4.6e-37)) tmp = Float64(c0 * Float64(fma(c0, Float64(d * Float64(d / Float64(D * Float64(w * Float64(h * D))))), Float64(c0 * Float64(Float64(d / Float64(w * D)) * Float64(d / Float64(h * D))))) / Float64(2.0 * w))); else tmp = t_0; end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, 8e-288], t$95$0, If[LessEqual[D, 1.5e-167], N[(c0 * N[(N[(N[(N[(c0 * 2.0), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[D, 1.95e-66], N[Not[LessEqual[D, 4.6e-37]], $MachinePrecision]], N[(c0 * N[(N[(c0 * N[(d * N[(d / N[(D * N[(w * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c0 * N[(N[(d / N[(w * D), $MachinePrecision]), $MachinePrecision] * N[(d / N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c0 \cdot \frac{0}{2 \cdot w}\\
\mathbf{if}\;D \leq 8 \cdot 10^{-288}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;D \leq 1.5 \cdot 10^{-167}:\\
\;\;\;\;c0 \cdot \frac{\frac{c0 \cdot 2}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}}{2 \cdot w}\\
\mathbf{elif}\;D \leq 1.95 \cdot 10^{-66} \lor \neg \left(D \leq 4.6 \cdot 10^{-37}\right):\\
\;\;\;\;c0 \cdot \frac{\mathsf{fma}\left(c0, d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}, c0 \cdot \left(\frac{d}{w \cdot D} \cdot \frac{d}{h \cdot D}\right)\right)}{2 \cdot w}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if D < 8.00000000000000046e-288 or 1.94999999999999991e-66 < D < 4.5999999999999999e-37Initial program 25.4%
Simplified44.5%
Taylor expanded in c0 around -inf 3.8%
distribute-lft-in2.3%
mul-1-neg2.3%
distribute-rgt-neg-in2.3%
associate-/l*3.0%
mul-1-neg3.0%
associate-/l*2.3%
distribute-lft1-in2.3%
metadata-eval2.3%
mul0-lft35.6%
metadata-eval35.6%
Simplified35.6%
if 8.00000000000000046e-288 < D < 1.4999999999999999e-167Initial program 21.2%
Simplified46.3%
Taylor expanded in c0 around -inf 0.0%
mul-1-neg0.0%
Simplified0.0%
associate-/l*0.1%
unpow20.1%
unpow20.1%
associate-*r*4.7%
*-commutative4.7%
*-commutative4.7%
associate-*r*4.2%
associate-*r/4.4%
add-cbrt-cube4.2%
pow1/311.1%
Applied egg-rr4.6%
Applied egg-rr55.0%
distribute-lft-out55.0%
associate-/r*47.0%
count-247.0%
Simplified47.0%
pow147.0%
associate-*r*47.0%
associate-/r*55.0%
Applied egg-rr55.0%
unpow155.0%
associate-*l/55.0%
Simplified55.0%
if 1.4999999999999999e-167 < D < 1.94999999999999991e-66 or 4.5999999999999999e-37 < D Initial program 31.4%
Simplified58.6%
Taylor expanded in w around 0 57.0%
Taylor expanded in c0 around inf 44.9%
associate-*r/46.3%
Simplified46.3%
frac-2neg46.3%
add-log-exp26.6%
log-pow20.8%
log-pow25.4%
neg-log18.4%
unpow218.4%
pow-unpow19.8%
pow-exp20.6%
exp-prod18.0%
associate-*r*18.0%
exp-prod18.2%
*-commutative18.2%
neg-log26.9%
add-log-exp52.2%
frac-2neg52.2%
Applied egg-rr60.3%
Final simplification45.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (/ c0 h) w))
(t_1 (pow (/ d D) 2.0))
(t_2 (* c0 (/ 0.0 (* 2.0 w)))))
(if (<= w -5.2e+175)
t_2
(if (<= w -6.6e+17)
(* c0 (* t_0 (/ t_1 w)))
(if (<= w -0.0026)
t_2
(if (<= w 3e-111)
(* c0 (/ (* (/ (* c0 2.0) (* w h)) t_1) (* 2.0 w)))
(if (or (<= w 1.4e-88) (not (<= w 2.35e+107)))
t_2
(* c0 (/ (* (* 2.0 t_1) t_0) (* 2.0 w))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / h) / w;
double t_1 = pow((d / D), 2.0);
double t_2 = c0 * (0.0 / (2.0 * w));
double tmp;
if (w <= -5.2e+175) {
tmp = t_2;
} else if (w <= -6.6e+17) {
tmp = c0 * (t_0 * (t_1 / w));
} else if (w <= -0.0026) {
tmp = t_2;
} else if (w <= 3e-111) {
tmp = c0 * ((((c0 * 2.0) / (w * h)) * t_1) / (2.0 * w));
} else if ((w <= 1.4e-88) || !(w <= 2.35e+107)) {
tmp = t_2;
} else {
tmp = c0 * (((2.0 * t_1) * t_0) / (2.0 * w));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (c0 / h) / w
t_1 = (d_1 / d) ** 2.0d0
t_2 = c0 * (0.0d0 / (2.0d0 * w))
if (w <= (-5.2d+175)) then
tmp = t_2
else if (w <= (-6.6d+17)) then
tmp = c0 * (t_0 * (t_1 / w))
else if (w <= (-0.0026d0)) then
tmp = t_2
else if (w <= 3d-111) then
tmp = c0 * ((((c0 * 2.0d0) / (w * h)) * t_1) / (2.0d0 * w))
else if ((w <= 1.4d-88) .or. (.not. (w <= 2.35d+107))) then
tmp = t_2
else
tmp = c0 * (((2.0d0 * t_1) * t_0) / (2.0d0 * w))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / h) / w;
double t_1 = Math.pow((d / D), 2.0);
double t_2 = c0 * (0.0 / (2.0 * w));
double tmp;
if (w <= -5.2e+175) {
tmp = t_2;
} else if (w <= -6.6e+17) {
tmp = c0 * (t_0 * (t_1 / w));
} else if (w <= -0.0026) {
tmp = t_2;
} else if (w <= 3e-111) {
tmp = c0 * ((((c0 * 2.0) / (w * h)) * t_1) / (2.0 * w));
} else if ((w <= 1.4e-88) || !(w <= 2.35e+107)) {
tmp = t_2;
} else {
tmp = c0 * (((2.0 * t_1) * t_0) / (2.0 * w));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 / h) / w t_1 = math.pow((d / D), 2.0) t_2 = c0 * (0.0 / (2.0 * w)) tmp = 0 if w <= -5.2e+175: tmp = t_2 elif w <= -6.6e+17: tmp = c0 * (t_0 * (t_1 / w)) elif w <= -0.0026: tmp = t_2 elif w <= 3e-111: tmp = c0 * ((((c0 * 2.0) / (w * h)) * t_1) / (2.0 * w)) elif (w <= 1.4e-88) or not (w <= 2.35e+107): tmp = t_2 else: tmp = c0 * (((2.0 * t_1) * t_0) / (2.0 * w)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 / h) / w) t_1 = Float64(d / D) ^ 2.0 t_2 = Float64(c0 * Float64(0.0 / Float64(2.0 * w))) tmp = 0.0 if (w <= -5.2e+175) tmp = t_2; elseif (w <= -6.6e+17) tmp = Float64(c0 * Float64(t_0 * Float64(t_1 / w))); elseif (w <= -0.0026) tmp = t_2; elseif (w <= 3e-111) tmp = Float64(c0 * Float64(Float64(Float64(Float64(c0 * 2.0) / Float64(w * h)) * t_1) / Float64(2.0 * w))); elseif ((w <= 1.4e-88) || !(w <= 2.35e+107)) tmp = t_2; else tmp = Float64(c0 * Float64(Float64(Float64(2.0 * t_1) * t_0) / Float64(2.0 * w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 / h) / w; t_1 = (d / D) ^ 2.0; t_2 = c0 * (0.0 / (2.0 * w)); tmp = 0.0; if (w <= -5.2e+175) tmp = t_2; elseif (w <= -6.6e+17) tmp = c0 * (t_0 * (t_1 / w)); elseif (w <= -0.0026) tmp = t_2; elseif (w <= 3e-111) tmp = c0 * ((((c0 * 2.0) / (w * h)) * t_1) / (2.0 * w)); elseif ((w <= 1.4e-88) || ~((w <= 2.35e+107))) tmp = t_2; else tmp = c0 * (((2.0 * t_1) * t_0) / (2.0 * w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -5.2e+175], t$95$2, If[LessEqual[w, -6.6e+17], N[(c0 * N[(t$95$0 * N[(t$95$1 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, -0.0026], t$95$2, If[LessEqual[w, 3e-111], N[(c0 * N[(N[(N[(N[(c0 * 2.0), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[w, 1.4e-88], N[Not[LessEqual[w, 2.35e+107]], $MachinePrecision]], t$95$2, N[(c0 * N[(N[(N[(2.0 * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{c0}{h}}{w}\\
t_1 := {\left(\frac{d}{D}\right)}^{2}\\
t_2 := c0 \cdot \frac{0}{2 \cdot w}\\
\mathbf{if}\;w \leq -5.2 \cdot 10^{+175}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;w \leq -6.6 \cdot 10^{+17}:\\
\;\;\;\;c0 \cdot \left(t\_0 \cdot \frac{t\_1}{w}\right)\\
\mathbf{elif}\;w \leq -0.0026:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;w \leq 3 \cdot 10^{-111}:\\
\;\;\;\;c0 \cdot \frac{\frac{c0 \cdot 2}{w \cdot h} \cdot t\_1}{2 \cdot w}\\
\mathbf{elif}\;w \leq 1.4 \cdot 10^{-88} \lor \neg \left(w \leq 2.35 \cdot 10^{+107}\right):\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\left(2 \cdot t\_1\right) \cdot t\_0}{2 \cdot w}\\
\end{array}
\end{array}
if w < -5.2000000000000001e175 or -6.6e17 < w < -0.0025999999999999999 or 3.00000000000000008e-111 < w < 1.39999999999999988e-88 or 2.35e107 < w Initial program 16.4%
Simplified30.7%
Taylor expanded in c0 around -inf 6.4%
distribute-lft-in3.6%
mul-1-neg3.6%
distribute-rgt-neg-in3.6%
associate-/l*3.6%
mul-1-neg3.6%
associate-/l*3.6%
distribute-lft1-in3.6%
metadata-eval3.6%
mul0-lft56.3%
metadata-eval56.3%
Simplified56.3%
if -5.2000000000000001e175 < w < -6.6e17Initial program 27.6%
Simplified50.8%
Taylor expanded in c0 around -inf 4.6%
mul-1-neg4.6%
Simplified4.6%
associate-/l*4.6%
unpow24.6%
unpow24.6%
associate-*r*4.9%
*-commutative4.9%
*-commutative4.9%
associate-*r*4.6%
associate-*r/9.6%
add-cbrt-cube9.2%
pow1/310.0%
Applied egg-rr5.0%
Applied egg-rr60.1%
distribute-lft-out60.1%
associate-/r*60.3%
count-260.3%
Simplified60.3%
div-inv60.3%
associate-*r*60.3%
associate-/r*60.1%
*-commutative60.1%
Applied egg-rr60.1%
associate-*r/60.1%
*-rgt-identity60.1%
associate-*l*60.1%
associate-*r/60.0%
associate-/r*60.4%
*-commutative60.4%
times-frac60.4%
metadata-eval60.4%
Simplified60.4%
if -0.0025999999999999999 < w < 3.00000000000000008e-111Initial program 33.0%
Simplified58.0%
Taylor expanded in c0 around -inf 2.8%
mul-1-neg2.8%
Simplified2.8%
associate-/l*1.2%
unpow21.2%
unpow21.2%
associate-*r*1.8%
*-commutative1.8%
*-commutative1.8%
associate-*r*3.5%
associate-*r/2.0%
add-cbrt-cube1.3%
pow1/35.1%
Applied egg-rr3.8%
Applied egg-rr61.7%
distribute-lft-out61.7%
associate-/r*58.2%
count-258.2%
Simplified58.2%
pow158.2%
associate-*r*58.2%
associate-/r*61.7%
Applied egg-rr61.7%
unpow161.7%
associate-*l/61.7%
Simplified61.7%
if 1.39999999999999988e-88 < w < 2.35e107Initial program 22.2%
Simplified52.2%
Taylor expanded in c0 around -inf 0.5%
mul-1-neg0.5%
Simplified0.5%
associate-/l*3.2%
unpow23.2%
unpow23.2%
associate-*r*6.2%
*-commutative6.2%
*-commutative6.2%
associate-*r*3.3%
associate-*r/3.7%
add-cbrt-cube0.4%
pow1/30.7%
Applied egg-rr0.5%
Applied egg-rr47.3%
distribute-lft-out47.3%
associate-/r*52.7%
count-252.7%
Simplified52.7%
Final simplification58.7%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (pow (/ d D) 2.0))
(t_1 (* c0 (* (/ (/ c0 h) w) (/ t_0 w))))
(t_2 (* c0 (/ 0.0 (* 2.0 w)))))
(if (<= w -4.6e+178)
t_2
(if (<= w -1.15e+14)
t_1
(if (<= w -0.0028)
t_2
(if (<= w 4.2e-114)
(* c0 (/ (* (/ (* c0 2.0) (* w h)) t_0) (* 2.0 w)))
(if (or (<= w 5.5e-87) (not (<= w 1.3e+106))) t_2 t_1)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = pow((d / D), 2.0);
double t_1 = c0 * (((c0 / h) / w) * (t_0 / w));
double t_2 = c0 * (0.0 / (2.0 * w));
double tmp;
if (w <= -4.6e+178) {
tmp = t_2;
} else if (w <= -1.15e+14) {
tmp = t_1;
} else if (w <= -0.0028) {
tmp = t_2;
} else if (w <= 4.2e-114) {
tmp = c0 * ((((c0 * 2.0) / (w * h)) * t_0) / (2.0 * w));
} else if ((w <= 5.5e-87) || !(w <= 1.3e+106)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (d_1 / d) ** 2.0d0
t_1 = c0 * (((c0 / h) / w) * (t_0 / w))
t_2 = c0 * (0.0d0 / (2.0d0 * w))
if (w <= (-4.6d+178)) then
tmp = t_2
else if (w <= (-1.15d+14)) then
tmp = t_1
else if (w <= (-0.0028d0)) then
tmp = t_2
else if (w <= 4.2d-114) then
tmp = c0 * ((((c0 * 2.0d0) / (w * h)) * t_0) / (2.0d0 * w))
else if ((w <= 5.5d-87) .or. (.not. (w <= 1.3d+106))) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = Math.pow((d / D), 2.0);
double t_1 = c0 * (((c0 / h) / w) * (t_0 / w));
double t_2 = c0 * (0.0 / (2.0 * w));
double tmp;
if (w <= -4.6e+178) {
tmp = t_2;
} else if (w <= -1.15e+14) {
tmp = t_1;
} else if (w <= -0.0028) {
tmp = t_2;
} else if (w <= 4.2e-114) {
tmp = c0 * ((((c0 * 2.0) / (w * h)) * t_0) / (2.0 * w));
} else if ((w <= 5.5e-87) || !(w <= 1.3e+106)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = math.pow((d / D), 2.0) t_1 = c0 * (((c0 / h) / w) * (t_0 / w)) t_2 = c0 * (0.0 / (2.0 * w)) tmp = 0 if w <= -4.6e+178: tmp = t_2 elif w <= -1.15e+14: tmp = t_1 elif w <= -0.0028: tmp = t_2 elif w <= 4.2e-114: tmp = c0 * ((((c0 * 2.0) / (w * h)) * t_0) / (2.0 * w)) elif (w <= 5.5e-87) or not (w <= 1.3e+106): tmp = t_2 else: tmp = t_1 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(d / D) ^ 2.0 t_1 = Float64(c0 * Float64(Float64(Float64(c0 / h) / w) * Float64(t_0 / w))) t_2 = Float64(c0 * Float64(0.0 / Float64(2.0 * w))) tmp = 0.0 if (w <= -4.6e+178) tmp = t_2; elseif (w <= -1.15e+14) tmp = t_1; elseif (w <= -0.0028) tmp = t_2; elseif (w <= 4.2e-114) tmp = Float64(c0 * Float64(Float64(Float64(Float64(c0 * 2.0) / Float64(w * h)) * t_0) / Float64(2.0 * w))); elseif ((w <= 5.5e-87) || !(w <= 1.3e+106)) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (d / D) ^ 2.0; t_1 = c0 * (((c0 / h) / w) * (t_0 / w)); t_2 = c0 * (0.0 / (2.0 * w)); tmp = 0.0; if (w <= -4.6e+178) tmp = t_2; elseif (w <= -1.15e+14) tmp = t_1; elseif (w <= -0.0028) tmp = t_2; elseif (w <= 4.2e-114) tmp = c0 * ((((c0 * 2.0) / (w * h)) * t_0) / (2.0 * w)); elseif ((w <= 5.5e-87) || ~((w <= 1.3e+106))) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(c0 * N[(N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision] * N[(t$95$0 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -4.6e+178], t$95$2, If[LessEqual[w, -1.15e+14], t$95$1, If[LessEqual[w, -0.0028], t$95$2, If[LessEqual[w, 4.2e-114], N[(c0 * N[(N[(N[(N[(c0 * 2.0), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[w, 5.5e-87], N[Not[LessEqual[w, 1.3e+106]], $MachinePrecision]], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{2}\\
t_1 := c0 \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \frac{t\_0}{w}\right)\\
t_2 := c0 \cdot \frac{0}{2 \cdot w}\\
\mathbf{if}\;w \leq -4.6 \cdot 10^{+178}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;w \leq -1.15 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;w \leq -0.0028:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;w \leq 4.2 \cdot 10^{-114}:\\
\;\;\;\;c0 \cdot \frac{\frac{c0 \cdot 2}{w \cdot h} \cdot t\_0}{2 \cdot w}\\
\mathbf{elif}\;w \leq 5.5 \cdot 10^{-87} \lor \neg \left(w \leq 1.3 \cdot 10^{+106}\right):\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if w < -4.6000000000000002e178 or -1.15e14 < w < -0.00279999999999999997 or 4.19999999999999985e-114 < w < 5.5000000000000004e-87 or 1.3000000000000001e106 < w Initial program 16.4%
Simplified30.7%
Taylor expanded in c0 around -inf 6.4%
distribute-lft-in3.6%
mul-1-neg3.6%
distribute-rgt-neg-in3.6%
associate-/l*3.6%
mul-1-neg3.6%
associate-/l*3.6%
distribute-lft1-in3.6%
metadata-eval3.6%
mul0-lft56.3%
metadata-eval56.3%
Simplified56.3%
if -4.6000000000000002e178 < w < -1.15e14 or 5.5000000000000004e-87 < w < 1.3000000000000001e106Initial program 24.2%
Simplified51.7%
Taylor expanded in c0 around -inf 2.0%
mul-1-neg2.0%
Simplified2.0%
associate-/l*3.7%
unpow23.7%
unpow23.7%
associate-*r*5.7%
*-commutative5.7%
*-commutative5.7%
associate-*r*3.8%
associate-*r/5.9%
add-cbrt-cube3.7%
pow1/34.2%
Applied egg-rr2.2%
Applied egg-rr52.0%
distribute-lft-out52.0%
associate-/r*55.5%
count-255.5%
Simplified55.5%
div-inv55.5%
associate-*r*55.5%
associate-/r*52.0%
*-commutative52.0%
Applied egg-rr52.0%
associate-*r/52.0%
*-rgt-identity52.0%
associate-*l*52.0%
associate-*r/51.9%
associate-/r*55.5%
*-commutative55.5%
times-frac55.5%
metadata-eval55.5%
Simplified55.5%
if -0.00279999999999999997 < w < 4.19999999999999985e-114Initial program 33.0%
Simplified58.0%
Taylor expanded in c0 around -inf 2.8%
mul-1-neg2.8%
Simplified2.8%
associate-/l*1.2%
unpow21.2%
unpow21.2%
associate-*r*1.8%
*-commutative1.8%
*-commutative1.8%
associate-*r*3.5%
associate-*r/2.0%
add-cbrt-cube1.3%
pow1/35.1%
Applied egg-rr3.8%
Applied egg-rr61.7%
distribute-lft-out61.7%
associate-/r*58.2%
count-258.2%
Simplified58.2%
pow158.2%
associate-*r*58.2%
associate-/r*61.7%
Applied egg-rr61.7%
unpow161.7%
associate-*l/61.7%
Simplified61.7%
Final simplification58.7%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (pow (/ d D) 2.0)) (t_1 (* c0 (/ 0.0 (* 2.0 w)))))
(if (<= w -9e+176)
t_1
(if (<= w -3.2e+14)
(* c0 (* (/ (/ c0 h) w) (/ t_0 w)))
(if (or (<= w -0.000125) (not (<= w 8.2e+106)))
t_1
(* c0 (/ (* 2.0 (* c0 (/ t_0 (* w h)))) (* 2.0 w))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = pow((d / D), 2.0);
double t_1 = c0 * (0.0 / (2.0 * w));
double tmp;
if (w <= -9e+176) {
tmp = t_1;
} else if (w <= -3.2e+14) {
tmp = c0 * (((c0 / h) / w) * (t_0 / w));
} else if ((w <= -0.000125) || !(w <= 8.2e+106)) {
tmp = t_1;
} else {
tmp = c0 * ((2.0 * (c0 * (t_0 / (w * h)))) / (2.0 * w));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (d_1 / d) ** 2.0d0
t_1 = c0 * (0.0d0 / (2.0d0 * w))
if (w <= (-9d+176)) then
tmp = t_1
else if (w <= (-3.2d+14)) then
tmp = c0 * (((c0 / h) / w) * (t_0 / w))
else if ((w <= (-0.000125d0)) .or. (.not. (w <= 8.2d+106))) then
tmp = t_1
else
tmp = c0 * ((2.0d0 * (c0 * (t_0 / (w * h)))) / (2.0d0 * w))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = Math.pow((d / D), 2.0);
double t_1 = c0 * (0.0 / (2.0 * w));
double tmp;
if (w <= -9e+176) {
tmp = t_1;
} else if (w <= -3.2e+14) {
tmp = c0 * (((c0 / h) / w) * (t_0 / w));
} else if ((w <= -0.000125) || !(w <= 8.2e+106)) {
tmp = t_1;
} else {
tmp = c0 * ((2.0 * (c0 * (t_0 / (w * h)))) / (2.0 * w));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = math.pow((d / D), 2.0) t_1 = c0 * (0.0 / (2.0 * w)) tmp = 0 if w <= -9e+176: tmp = t_1 elif w <= -3.2e+14: tmp = c0 * (((c0 / h) / w) * (t_0 / w)) elif (w <= -0.000125) or not (w <= 8.2e+106): tmp = t_1 else: tmp = c0 * ((2.0 * (c0 * (t_0 / (w * h)))) / (2.0 * w)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(d / D) ^ 2.0 t_1 = Float64(c0 * Float64(0.0 / Float64(2.0 * w))) tmp = 0.0 if (w <= -9e+176) tmp = t_1; elseif (w <= -3.2e+14) tmp = Float64(c0 * Float64(Float64(Float64(c0 / h) / w) * Float64(t_0 / w))); elseif ((w <= -0.000125) || !(w <= 8.2e+106)) tmp = t_1; else tmp = Float64(c0 * Float64(Float64(2.0 * Float64(c0 * Float64(t_0 / Float64(w * h)))) / Float64(2.0 * w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (d / D) ^ 2.0; t_1 = c0 * (0.0 / (2.0 * w)); tmp = 0.0; if (w <= -9e+176) tmp = t_1; elseif (w <= -3.2e+14) tmp = c0 * (((c0 / h) / w) * (t_0 / w)); elseif ((w <= -0.000125) || ~((w <= 8.2e+106))) tmp = t_1; else tmp = c0 * ((2.0 * (c0 * (t_0 / (w * h)))) / (2.0 * w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -9e+176], t$95$1, If[LessEqual[w, -3.2e+14], N[(c0 * N[(N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision] * N[(t$95$0 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[w, -0.000125], N[Not[LessEqual[w, 8.2e+106]], $MachinePrecision]], t$95$1, N[(c0 * N[(N[(2.0 * N[(c0 * N[(t$95$0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{2}\\
t_1 := c0 \cdot \frac{0}{2 \cdot w}\\
\mathbf{if}\;w \leq -9 \cdot 10^{+176}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;w \leq -3.2 \cdot 10^{+14}:\\
\;\;\;\;c0 \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \frac{t\_0}{w}\right)\\
\mathbf{elif}\;w \leq -0.000125 \lor \neg \left(w \leq 8.2 \cdot 10^{+106}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{2 \cdot \left(c0 \cdot \frac{t\_0}{w \cdot h}\right)}{2 \cdot w}\\
\end{array}
\end{array}
if w < -9.00000000000000007e176 or -3.2e14 < w < -1.25e-4 or 8.2000000000000005e106 < w Initial program 15.6%
Simplified33.4%
Taylor expanded in c0 around -inf 5.7%
distribute-lft-in2.5%
mul-1-neg2.5%
distribute-rgt-neg-in2.5%
associate-/l*2.5%
mul-1-neg2.5%
associate-/l*2.5%
distribute-lft1-in2.5%
metadata-eval2.5%
mul0-lft54.7%
metadata-eval54.7%
Simplified54.7%
if -9.00000000000000007e176 < w < -3.2e14Initial program 27.6%
Simplified50.8%
Taylor expanded in c0 around -inf 4.6%
mul-1-neg4.6%
Simplified4.6%
associate-/l*4.6%
unpow24.6%
unpow24.6%
associate-*r*4.9%
*-commutative4.9%
*-commutative4.9%
associate-*r*4.6%
associate-*r/9.6%
add-cbrt-cube9.2%
pow1/310.0%
Applied egg-rr5.0%
Applied egg-rr60.1%
distribute-lft-out60.1%
associate-/r*60.3%
count-260.3%
Simplified60.3%
div-inv60.3%
associate-*r*60.3%
associate-/r*60.1%
*-commutative60.1%
Applied egg-rr60.1%
associate-*r/60.1%
*-rgt-identity60.1%
associate-*l*60.1%
associate-*r/60.0%
associate-/r*60.4%
*-commutative60.4%
times-frac60.4%
metadata-eval60.4%
Simplified60.4%
if -1.25e-4 < w < 8.2000000000000005e106Initial program 30.1%
Simplified54.3%
Taylor expanded in c0 around -inf 2.1%
mul-1-neg2.1%
Simplified2.1%
associate-/l*1.6%
unpow21.6%
unpow21.6%
associate-*r*2.7%
*-commutative2.7%
*-commutative2.7%
associate-*r*3.3%
associate-*r/2.3%
add-cbrt-cube1.1%
pow1/34.0%
Applied egg-rr3.0%
Applied egg-rr56.5%
distribute-lft-out56.5%
associate-/r*55.1%
count-255.1%
Simplified55.1%
Taylor expanded in c0 around 0 43.6%
associate-/l*44.2%
associate-/r*44.8%
unpow244.8%
unpow244.8%
times-frac57.0%
unpow257.0%
Simplified57.0%
Final simplification56.7%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= D 2.9e-273) (and (not (<= D 1e-65)) (<= D 2.65e-45))) (* c0 (/ 0.0 (* 2.0 w))) (* c0 (/ (* (/ 1.0 (* h (/ w c0))) (* 2.0 (pow (/ d D) 2.0))) (* 2.0 w)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((D <= 2.9e-273) || (!(D <= 1e-65) && (D <= 2.65e-45))) {
tmp = c0 * (0.0 / (2.0 * w));
} else {
tmp = c0 * (((1.0 / (h * (w / c0))) * (2.0 * pow((d / D), 2.0))) / (2.0 * w));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if ((d <= 2.9d-273) .or. (.not. (d <= 1d-65)) .and. (d <= 2.65d-45)) then
tmp = c0 * (0.0d0 / (2.0d0 * w))
else
tmp = c0 * (((1.0d0 / (h * (w / c0))) * (2.0d0 * ((d_1 / d) ** 2.0d0))) / (2.0d0 * w))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((D <= 2.9e-273) || (!(D <= 1e-65) && (D <= 2.65e-45))) {
tmp = c0 * (0.0 / (2.0 * w));
} else {
tmp = c0 * (((1.0 / (h * (w / c0))) * (2.0 * Math.pow((d / D), 2.0))) / (2.0 * w));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (D <= 2.9e-273) or (not (D <= 1e-65) and (D <= 2.65e-45)): tmp = c0 * (0.0 / (2.0 * w)) else: tmp = c0 * (((1.0 / (h * (w / c0))) * (2.0 * math.pow((d / D), 2.0))) / (2.0 * w)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((D <= 2.9e-273) || (!(D <= 1e-65) && (D <= 2.65e-45))) tmp = Float64(c0 * Float64(0.0 / Float64(2.0 * w))); else tmp = Float64(c0 * Float64(Float64(Float64(1.0 / Float64(h * Float64(w / c0))) * Float64(2.0 * (Float64(d / D) ^ 2.0))) / Float64(2.0 * w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((D <= 2.9e-273) || (~((D <= 1e-65)) && (D <= 2.65e-45))) tmp = c0 * (0.0 / (2.0 * w)); else tmp = c0 * (((1.0 / (h * (w / c0))) * (2.0 * ((d / D) ^ 2.0))) / (2.0 * w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[D, 2.9e-273], And[N[Not[LessEqual[D, 1e-65]], $MachinePrecision], LessEqual[D, 2.65e-45]]], N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[(N[(1.0 / N[(h * N[(w / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 2.9 \cdot 10^{-273} \lor \neg \left(D \leq 10^{-65}\right) \land D \leq 2.65 \cdot 10^{-45}:\\
\;\;\;\;c0 \cdot \frac{0}{2 \cdot w}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\frac{1}{h \cdot \frac{w}{c0}} \cdot \left(2 \cdot {\left(\frac{d}{D}\right)}^{2}\right)}{2 \cdot w}\\
\end{array}
\end{array}
if D < 2.89999999999999986e-273 or 9.99999999999999923e-66 < D < 2.6499999999999999e-45Initial program 25.6%
Simplified45.2%
Taylor expanded in c0 around -inf 3.6%
distribute-lft-in2.2%
mul-1-neg2.2%
distribute-rgt-neg-in2.2%
associate-/l*2.9%
mul-1-neg2.9%
associate-/l*2.2%
distribute-lft1-in2.2%
metadata-eval2.2%
mul0-lft35.3%
metadata-eval35.3%
Simplified35.3%
if 2.89999999999999986e-273 < D < 9.99999999999999923e-66 or 2.6499999999999999e-45 < D Initial program 27.1%
Simplified53.3%
Taylor expanded in c0 around -inf 2.8%
mul-1-neg2.8%
Simplified2.8%
associate-/l*2.8%
unpow22.8%
unpow22.8%
associate-*r*4.5%
*-commutative4.5%
*-commutative4.5%
associate-*r*3.5%
associate-*r/6.5%
add-cbrt-cube6.4%
pow1/38.7%
Applied egg-rr3.0%
Applied egg-rr53.0%
distribute-lft-out53.0%
associate-/r*51.9%
count-251.9%
Simplified51.9%
clear-num51.9%
inv-pow51.9%
Applied egg-rr51.9%
unpow-151.9%
associate-/r/56.2%
Simplified56.2%
Final simplification44.3%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= D 3.1e-273) (and (not (<= D 1.35e-65)) (<= D 3.3e-45))) (* c0 (/ 0.0 (* 2.0 w))) (* c0 (* (/ (/ c0 h) w) (/ (pow (/ d D) 2.0) w)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((D <= 3.1e-273) || (!(D <= 1.35e-65) && (D <= 3.3e-45))) {
tmp = c0 * (0.0 / (2.0 * w));
} else {
tmp = c0 * (((c0 / h) / w) * (pow((d / D), 2.0) / w));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if ((d <= 3.1d-273) .or. (.not. (d <= 1.35d-65)) .and. (d <= 3.3d-45)) then
tmp = c0 * (0.0d0 / (2.0d0 * w))
else
tmp = c0 * (((c0 / h) / w) * (((d_1 / d) ** 2.0d0) / w))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((D <= 3.1e-273) || (!(D <= 1.35e-65) && (D <= 3.3e-45))) {
tmp = c0 * (0.0 / (2.0 * w));
} else {
tmp = c0 * (((c0 / h) / w) * (Math.pow((d / D), 2.0) / w));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (D <= 3.1e-273) or (not (D <= 1.35e-65) and (D <= 3.3e-45)): tmp = c0 * (0.0 / (2.0 * w)) else: tmp = c0 * (((c0 / h) / w) * (math.pow((d / D), 2.0) / w)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((D <= 3.1e-273) || (!(D <= 1.35e-65) && (D <= 3.3e-45))) tmp = Float64(c0 * Float64(0.0 / Float64(2.0 * w))); else tmp = Float64(c0 * Float64(Float64(Float64(c0 / h) / w) * Float64((Float64(d / D) ^ 2.0) / w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((D <= 3.1e-273) || (~((D <= 1.35e-65)) && (D <= 3.3e-45))) tmp = c0 * (0.0 / (2.0 * w)); else tmp = c0 * (((c0 / h) / w) * (((d / D) ^ 2.0) / w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[D, 3.1e-273], And[N[Not[LessEqual[D, 1.35e-65]], $MachinePrecision], LessEqual[D, 3.3e-45]]], N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision] * N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 3.1 \cdot 10^{-273} \lor \neg \left(D \leq 1.35 \cdot 10^{-65}\right) \land D \leq 3.3 \cdot 10^{-45}:\\
\;\;\;\;c0 \cdot \frac{0}{2 \cdot w}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \frac{{\left(\frac{d}{D}\right)}^{2}}{w}\right)\\
\end{array}
\end{array}
if D < 3.09999999999999988e-273 or 1.3499999999999999e-65 < D < 3.3000000000000001e-45Initial program 25.6%
Simplified45.2%
Taylor expanded in c0 around -inf 3.6%
distribute-lft-in2.2%
mul-1-neg2.2%
distribute-rgt-neg-in2.2%
associate-/l*2.9%
mul-1-neg2.9%
associate-/l*2.2%
distribute-lft1-in2.2%
metadata-eval2.2%
mul0-lft35.3%
metadata-eval35.3%
Simplified35.3%
if 3.09999999999999988e-273 < D < 1.3499999999999999e-65 or 3.3000000000000001e-45 < D Initial program 27.1%
Simplified53.3%
Taylor expanded in c0 around -inf 2.8%
mul-1-neg2.8%
Simplified2.8%
associate-/l*2.8%
unpow22.8%
unpow22.8%
associate-*r*4.5%
*-commutative4.5%
*-commutative4.5%
associate-*r*3.5%
associate-*r/6.5%
add-cbrt-cube6.4%
pow1/38.7%
Applied egg-rr3.0%
Applied egg-rr53.0%
distribute-lft-out53.0%
associate-/r*51.9%
count-251.9%
Simplified51.9%
div-inv51.9%
associate-*r*51.9%
associate-/r*52.9%
*-commutative52.9%
Applied egg-rr52.9%
associate-*r/53.0%
*-rgt-identity53.0%
associate-*l*53.0%
associate-*r/51.9%
associate-/r*51.0%
*-commutative51.0%
times-frac51.0%
metadata-eval51.0%
Simplified51.0%
Final simplification42.1%
(FPCore (c0 w h D d M) :precision binary64 (* c0 (/ 0.0 (* 2.0 w))))
double code(double c0, double w, double h, double D, double d, double M) {
return c0 * (0.0 / (2.0 * w));
}
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 * (0.0d0 / (2.0d0 * w))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return c0 * (0.0 / (2.0 * w));
}
def code(c0, w, h, D, d, M): return c0 * (0.0 / (2.0 * w))
function code(c0, w, h, D, d, M) return Float64(c0 * Float64(0.0 / Float64(2.0 * w))) end
function tmp = code(c0, w, h, D, d, M) tmp = c0 * (0.0 / (2.0 * w)); end
code[c0_, w_, h_, D_, d_, M_] := N[(c0 * N[(0.0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c0 \cdot \frac{0}{2 \cdot w}
\end{array}
Initial program 26.2%
Simplified48.7%
Taylor expanded in c0 around -inf 2.4%
distribute-lft-in1.6%
mul-1-neg1.6%
distribute-rgt-neg-in1.6%
associate-/l*1.9%
mul-1-neg1.9%
associate-/l*1.6%
distribute-lft1-in1.6%
metadata-eval1.6%
mul0-lft31.4%
metadata-eval31.4%
Simplified31.4%
Final simplification31.4%
herbie shell --seed 2024054
(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))))))