
(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 (* (* w h) (* D D)))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (/ (* c0 (* d d)) t_0)))
(if (<= (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))) INFINITY)
(*
t_1
(fma
2.0
(* d (* d (/ c0 t_0)))
(* 0.5 (/ (* D D) (/ (* d d) (* w (* h 0.0)))))))
(/ (* c0 (* 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 * D);
double t_1 = c0 / (2.0 * w);
double t_2 = (c0 * (d * d)) / t_0;
double tmp;
if ((t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))))) <= ((double) INFINITY)) {
tmp = t_1 * fma(2.0, (d * (d * (c0 / t_0))), (0.5 * ((D * D) / ((d * d) / (w * (h * 0.0))))));
} else {
tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(w * h) * Float64(D * D)) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(Float64(c0 * Float64(d * d)) / t_0) tmp = 0.0 if (Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))))) <= Inf) tmp = Float64(t_1 * fma(2.0, Float64(d * Float64(d * Float64(c0 / t_0))), Float64(0.5 * Float64(Float64(D * D) / Float64(Float64(d * d) / Float64(w * Float64(h * 0.0))))))); else tmp = Float64(Float64(c0 * Float64(c0 * 0.0)) / Float64(2.0 * w)); end return 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[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[N[(t$95$1 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$1 * N[(2.0 * N[(d * N[(d * N[(c0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(D * D), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] / N[(w * N[(h * 0.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(w \cdot h\right) \cdot \left(D \cdot D\right)\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{t_0}\\
\mathbf{if}\;t_1 \cdot \left(t_2 + \sqrt{t_2 \cdot t_2 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;t_1 \cdot \mathsf{fma}\left(2, d \cdot \left(d \cdot \frac{c0}{t_0}\right), 0.5 \cdot \frac{D \cdot D}{\frac{d \cdot d}{w \cdot \left(h \cdot 0\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{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 79.3%
times-frac74.7%
fma-def74.7%
associate-/r*74.7%
difference-of-squares74.7%
Simplified77.1%
Taylor expanded in c0 around inf 23.7%
Simplified82.4%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
associate-*l*0.0%
difference-of-squares3.9%
associate-*l*3.9%
associate-*l*6.4%
Simplified6.4%
Applied egg-rr13.9%
Taylor expanded in c0 around -inf 1.3%
associate-*r*1.3%
distribute-rgt1-in1.3%
metadata-eval1.3%
mul0-lft45.7%
metadata-eval45.7%
mul0-lft1.3%
metadata-eval1.3%
distribute-lft1-in1.3%
*-commutative1.3%
distribute-lft1-in1.3%
metadata-eval1.3%
mul0-lft45.7%
Simplified45.7%
Final simplification58.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0
(/ (* c0 (* 2.0 (* (/ c0 (* w h)) (pow (/ d D) 2.0)))) (* 2.0 w))))
(if (<= c0 -2.2e-99)
t_0
(if (<= c0 1.55e-186)
(* (/ c0 (* 2.0 w)) (* c0 0.0))
(if (or (<= c0 3.1e+52) (not (<= c0 9.5e+190)))
t_0
(/ (* c0 (* c0 0.0)) (* 2.0 w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (2.0 * ((c0 / (w * h)) * pow((d / D), 2.0)))) / (2.0 * w);
double tmp;
if (c0 <= -2.2e-99) {
tmp = t_0;
} else if (c0 <= 1.55e-186) {
tmp = (c0 / (2.0 * w)) * (c0 * 0.0);
} else if ((c0 <= 3.1e+52) || !(c0 <= 9.5e+190)) {
tmp = t_0;
} else {
tmp = (c0 * (c0 * 0.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) :: tmp
t_0 = (c0 * (2.0d0 * ((c0 / (w * h)) * ((d_1 / d) ** 2.0d0)))) / (2.0d0 * w)
if (c0 <= (-2.2d-99)) then
tmp = t_0
else if (c0 <= 1.55d-186) then
tmp = (c0 / (2.0d0 * w)) * (c0 * 0.0d0)
else if ((c0 <= 3.1d+52) .or. (.not. (c0 <= 9.5d+190))) then
tmp = t_0
else
tmp = (c0 * (c0 * 0.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 t_0 = (c0 * (2.0 * ((c0 / (w * h)) * Math.pow((d / D), 2.0)))) / (2.0 * w);
double tmp;
if (c0 <= -2.2e-99) {
tmp = t_0;
} else if (c0 <= 1.55e-186) {
tmp = (c0 / (2.0 * w)) * (c0 * 0.0);
} else if ((c0 <= 3.1e+52) || !(c0 <= 9.5e+190)) {
tmp = t_0;
} else {
tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (2.0 * ((c0 / (w * h)) * math.pow((d / D), 2.0)))) / (2.0 * w) tmp = 0 if c0 <= -2.2e-99: tmp = t_0 elif c0 <= 1.55e-186: tmp = (c0 / (2.0 * w)) * (c0 * 0.0) elif (c0 <= 3.1e+52) or not (c0 <= 9.5e+190): tmp = t_0 else: tmp = (c0 * (c0 * 0.0)) / (2.0 * w) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(2.0 * Float64(Float64(c0 / Float64(w * h)) * (Float64(d / D) ^ 2.0)))) / Float64(2.0 * w)) tmp = 0.0 if (c0 <= -2.2e-99) tmp = t_0; elseif (c0 <= 1.55e-186) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(c0 * 0.0)); elseif ((c0 <= 3.1e+52) || !(c0 <= 9.5e+190)) tmp = t_0; else tmp = Float64(Float64(c0 * Float64(c0 * 0.0)) / Float64(2.0 * w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (2.0 * ((c0 / (w * h)) * ((d / D) ^ 2.0)))) / (2.0 * w); tmp = 0.0; if (c0 <= -2.2e-99) tmp = t_0; elseif (c0 <= 1.55e-186) tmp = (c0 / (2.0 * w)) * (c0 * 0.0); elseif ((c0 <= 3.1e+52) || ~((c0 <= 9.5e+190))) tmp = t_0; else tmp = (c0 * (c0 * 0.0)) / (2.0 * w); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(2.0 * N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -2.2e-99], t$95$0, If[LessEqual[c0, 1.55e-186], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[c0, 3.1e+52], N[Not[LessEqual[c0, 9.5e+190]], $MachinePrecision]], t$95$0, N[(N[(c0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(2 \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)}{2 \cdot w}\\
\mathbf{if}\;c0 \leq -2.2 \cdot 10^{-99}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c0 \leq 1.55 \cdot 10^{-186}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(c0 \cdot 0\right)\\
\mathbf{elif}\;c0 \leq 3.1 \cdot 10^{+52} \lor \neg \left(c0 \leq 9.5 \cdot 10^{+190}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\
\end{array}
\end{array}
if c0 < -2.20000000000000004e-99 or 1.55000000000000005e-186 < c0 < 3.1e52 or 9.4999999999999995e190 < c0 Initial program 35.8%
associate-*l*34.9%
difference-of-squares38.8%
associate-*l*38.8%
associate-*l*39.8%
Simplified39.8%
Applied egg-rr47.0%
Taylor expanded in c0 around inf 42.8%
times-frac43.5%
unpow243.5%
unpow243.5%
*-commutative43.5%
times-frac57.1%
unpow257.1%
Simplified57.1%
if -2.20000000000000004e-99 < c0 < 1.55000000000000005e-186Initial program 13.1%
times-frac9.8%
fma-def9.8%
associate-/r*9.8%
difference-of-squares10.1%
Simplified13.4%
Taylor expanded in c0 around -inf 4.9%
associate-*r*4.9%
distribute-rgt1-in4.9%
metadata-eval4.9%
mul0-lft56.3%
metadata-eval56.3%
mul0-lft6.5%
metadata-eval6.5%
distribute-lft1-in6.5%
*-commutative6.5%
distribute-lft1-in6.5%
metadata-eval6.5%
mul0-lft56.3%
Simplified56.3%
if 3.1e52 < c0 < 9.4999999999999995e190Initial program 22.8%
associate-*l*22.8%
difference-of-squares22.8%
associate-*l*22.8%
associate-*l*28.1%
Simplified28.1%
Applied egg-rr25.3%
Taylor expanded in c0 around -inf 3.1%
associate-*r*3.1%
distribute-rgt1-in3.1%
metadata-eval3.1%
mul0-lft44.5%
metadata-eval44.5%
mul0-lft3.1%
metadata-eval3.1%
distribute-lft1-in3.1%
*-commutative3.1%
distribute-lft1-in3.1%
metadata-eval3.1%
mul0-lft44.5%
Simplified44.5%
Final simplification55.2%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w))))
(if (<= c0 -2.55e-96)
(* (/ (pow (/ d D) 2.0) (* w w)) (/ c0 (/ h c0)))
(if (<= c0 3.35e-130)
(* t_0 (* c0 0.0))
(if (<= c0 2.7e+54)
(* (/ (* d d) (* (* D D) (* w w))) (/ (* c0 c0) h))
(if (<= c0 3.6e+169)
(/ (* c0 (* c0 0.0)) (* 2.0 w))
(* t_0 (/ (* 2.0 (* c0 (* d d))) (* (* w h) (* D D))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double tmp;
if (c0 <= -2.55e-96) {
tmp = (pow((d / D), 2.0) / (w * w)) * (c0 / (h / c0));
} else if (c0 <= 3.35e-130) {
tmp = t_0 * (c0 * 0.0);
} else if (c0 <= 2.7e+54) {
tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h);
} else if (c0 <= 3.6e+169) {
tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
} else {
tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D)));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = c0 / (2.0d0 * w)
if (c0 <= (-2.55d-96)) then
tmp = (((d_1 / d) ** 2.0d0) / (w * w)) * (c0 / (h / c0))
else if (c0 <= 3.35d-130) then
tmp = t_0 * (c0 * 0.0d0)
else if (c0 <= 2.7d+54) then
tmp = ((d_1 * d_1) / ((d * d) * (w * w))) * ((c0 * c0) / h)
else if (c0 <= 3.6d+169) then
tmp = (c0 * (c0 * 0.0d0)) / (2.0d0 * w)
else
tmp = t_0 * ((2.0d0 * (c0 * (d_1 * d_1))) / ((w * h) * (d * d)))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double tmp;
if (c0 <= -2.55e-96) {
tmp = (Math.pow((d / D), 2.0) / (w * w)) * (c0 / (h / c0));
} else if (c0 <= 3.35e-130) {
tmp = t_0 * (c0 * 0.0);
} else if (c0 <= 2.7e+54) {
tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h);
} else if (c0 <= 3.6e+169) {
tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
} else {
tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) tmp = 0 if c0 <= -2.55e-96: tmp = (math.pow((d / D), 2.0) / (w * w)) * (c0 / (h / c0)) elif c0 <= 3.35e-130: tmp = t_0 * (c0 * 0.0) elif c0 <= 2.7e+54: tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h) elif c0 <= 3.6e+169: tmp = (c0 * (c0 * 0.0)) / (2.0 * w) else: tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) tmp = 0.0 if (c0 <= -2.55e-96) tmp = Float64(Float64((Float64(d / D) ^ 2.0) / Float64(w * w)) * Float64(c0 / Float64(h / c0))); elseif (c0 <= 3.35e-130) tmp = Float64(t_0 * Float64(c0 * 0.0)); elseif (c0 <= 2.7e+54) tmp = Float64(Float64(Float64(d * d) / Float64(Float64(D * D) * Float64(w * w))) * Float64(Float64(c0 * c0) / h)); elseif (c0 <= 3.6e+169) tmp = Float64(Float64(c0 * Float64(c0 * 0.0)) / Float64(2.0 * w)); else tmp = Float64(t_0 * Float64(Float64(2.0 * Float64(c0 * Float64(d * d))) / Float64(Float64(w * h) * Float64(D * D)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); tmp = 0.0; if (c0 <= -2.55e-96) tmp = (((d / D) ^ 2.0) / (w * w)) * (c0 / (h / c0)); elseif (c0 <= 3.35e-130) tmp = t_0 * (c0 * 0.0); elseif (c0 <= 2.7e+54) tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h); elseif (c0 <= 3.6e+169) tmp = (c0 * (c0 * 0.0)) / (2.0 * w); else tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -2.55e-96], N[(N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision] * N[(c0 / N[(h / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 3.35e-130], N[(t$95$0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 2.7e+54], N[(N[(N[(d * d), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * c0), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 3.6e+169], N[(N[(c0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(2.0 * N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;c0 \leq -2.55 \cdot 10^{-96}:\\
\;\;\;\;\frac{{\left(\frac{d}{D}\right)}^{2}}{w \cdot w} \cdot \frac{c0}{\frac{h}{c0}}\\
\mathbf{elif}\;c0 \leq 3.35 \cdot 10^{-130}:\\
\;\;\;\;t_0 \cdot \left(c0 \cdot 0\right)\\
\mathbf{elif}\;c0 \leq 2.7 \cdot 10^{+54}:\\
\;\;\;\;\frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot w\right)} \cdot \frac{c0 \cdot c0}{h}\\
\mathbf{elif}\;c0 \leq 3.6 \cdot 10^{+169}:\\
\;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\end{array}
\end{array}
if c0 < -2.54999999999999986e-96Initial program 33.5%
associate-*l*32.4%
difference-of-squares36.2%
associate-*l*36.2%
associate-*l*36.8%
Simplified36.8%
Taylor expanded in c0 around inf 36.4%
unpow236.4%
unpow236.4%
associate-*r*36.3%
unpow236.3%
unpow236.3%
Simplified36.3%
*-un-lft-identity36.3%
times-frac36.4%
Applied egg-rr36.4%
*-lft-identity36.4%
unpow236.4%
unpow236.4%
unpow236.4%
associate-/r*36.5%
unpow236.5%
unpow236.5%
times-frac52.9%
unpow252.9%
unpow252.9%
associate-/l*52.8%
Simplified52.8%
if -2.54999999999999986e-96 < c0 < 3.34999999999999993e-130Initial program 15.0%
times-frac10.6%
fma-def10.6%
associate-/r*10.6%
difference-of-squares10.9%
Simplified14.0%
Taylor expanded in c0 around -inf 6.1%
associate-*r*6.1%
distribute-rgt1-in6.1%
metadata-eval6.1%
mul0-lft53.9%
metadata-eval53.9%
mul0-lft7.6%
metadata-eval7.6%
distribute-lft1-in7.6%
*-commutative7.6%
distribute-lft1-in7.6%
metadata-eval7.6%
mul0-lft53.9%
Simplified53.9%
if 3.34999999999999993e-130 < c0 < 2.70000000000000011e54Initial program 34.5%
associate-*l*32.7%
difference-of-squares35.8%
associate-*l*35.8%
associate-*l*38.5%
Simplified38.5%
Taylor expanded in c0 around inf 33.5%
unpow233.5%
unpow233.5%
associate-*r*36.3%
unpow236.3%
unpow236.3%
Simplified36.3%
times-frac41.5%
Applied egg-rr41.5%
if 2.70000000000000011e54 < c0 < 3.6000000000000001e169Initial program 20.7%
associate-*l*20.7%
difference-of-squares20.7%
associate-*l*20.7%
associate-*l*26.9%
Simplified26.9%
Applied egg-rr26.9%
Taylor expanded in c0 around -inf 0.3%
associate-*r*0.3%
distribute-rgt1-in0.3%
metadata-eval0.3%
mul0-lft46.5%
metadata-eval46.5%
mul0-lft0.3%
metadata-eval0.3%
distribute-lft1-in0.3%
*-commutative0.3%
distribute-lft1-in0.3%
metadata-eval0.3%
mul0-lft46.5%
Simplified46.5%
if 3.6000000000000001e169 < c0 Initial program 40.6%
times-frac40.6%
fma-def40.6%
associate-/r*40.6%
difference-of-squares45.4%
Simplified52.6%
Taylor expanded in c0 around inf 48.4%
associate-*r/48.4%
unpow248.4%
unpow248.4%
Simplified48.4%
Final simplification50.0%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w))))
(if (<= c0 -1.05e-102)
(* (pow (/ d D) 2.0) (/ (* c0 c0) (* h (* w w))))
(if (<= c0 3.2e-133)
(* t_0 (* c0 0.0))
(if (<= c0 6.6e+54)
(* (/ (* d d) (* (* D D) (* w w))) (/ (* c0 c0) h))
(if (<= c0 2.2e+169)
(/ (* c0 (* c0 0.0)) (* 2.0 w))
(* t_0 (/ (* 2.0 (* c0 (* d d))) (* (* w h) (* D D))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double tmp;
if (c0 <= -1.05e-102) {
tmp = pow((d / D), 2.0) * ((c0 * c0) / (h * (w * w)));
} else if (c0 <= 3.2e-133) {
tmp = t_0 * (c0 * 0.0);
} else if (c0 <= 6.6e+54) {
tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h);
} else if (c0 <= 2.2e+169) {
tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
} else {
tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D)));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = c0 / (2.0d0 * w)
if (c0 <= (-1.05d-102)) then
tmp = ((d_1 / d) ** 2.0d0) * ((c0 * c0) / (h * (w * w)))
else if (c0 <= 3.2d-133) then
tmp = t_0 * (c0 * 0.0d0)
else if (c0 <= 6.6d+54) then
tmp = ((d_1 * d_1) / ((d * d) * (w * w))) * ((c0 * c0) / h)
else if (c0 <= 2.2d+169) then
tmp = (c0 * (c0 * 0.0d0)) / (2.0d0 * w)
else
tmp = t_0 * ((2.0d0 * (c0 * (d_1 * d_1))) / ((w * h) * (d * d)))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double tmp;
if (c0 <= -1.05e-102) {
tmp = Math.pow((d / D), 2.0) * ((c0 * c0) / (h * (w * w)));
} else if (c0 <= 3.2e-133) {
tmp = t_0 * (c0 * 0.0);
} else if (c0 <= 6.6e+54) {
tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h);
} else if (c0 <= 2.2e+169) {
tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
} else {
tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) tmp = 0 if c0 <= -1.05e-102: tmp = math.pow((d / D), 2.0) * ((c0 * c0) / (h * (w * w))) elif c0 <= 3.2e-133: tmp = t_0 * (c0 * 0.0) elif c0 <= 6.6e+54: tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h) elif c0 <= 2.2e+169: tmp = (c0 * (c0 * 0.0)) / (2.0 * w) else: tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) tmp = 0.0 if (c0 <= -1.05e-102) tmp = Float64((Float64(d / D) ^ 2.0) * Float64(Float64(c0 * c0) / Float64(h * Float64(w * w)))); elseif (c0 <= 3.2e-133) tmp = Float64(t_0 * Float64(c0 * 0.0)); elseif (c0 <= 6.6e+54) tmp = Float64(Float64(Float64(d * d) / Float64(Float64(D * D) * Float64(w * w))) * Float64(Float64(c0 * c0) / h)); elseif (c0 <= 2.2e+169) tmp = Float64(Float64(c0 * Float64(c0 * 0.0)) / Float64(2.0 * w)); else tmp = Float64(t_0 * Float64(Float64(2.0 * Float64(c0 * Float64(d * d))) / Float64(Float64(w * h) * Float64(D * D)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); tmp = 0.0; if (c0 <= -1.05e-102) tmp = ((d / D) ^ 2.0) * ((c0 * c0) / (h * (w * w))); elseif (c0 <= 3.2e-133) tmp = t_0 * (c0 * 0.0); elseif (c0 <= 6.6e+54) tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h); elseif (c0 <= 2.2e+169) tmp = (c0 * (c0 * 0.0)) / (2.0 * w); else tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -1.05e-102], N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(c0 * c0), $MachinePrecision] / N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 3.2e-133], N[(t$95$0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 6.6e+54], N[(N[(N[(d * d), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * c0), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 2.2e+169], N[(N[(c0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(2.0 * N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;c0 \leq -1.05 \cdot 10^{-102}:\\
\;\;\;\;{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\
\mathbf{elif}\;c0 \leq 3.2 \cdot 10^{-133}:\\
\;\;\;\;t_0 \cdot \left(c0 \cdot 0\right)\\
\mathbf{elif}\;c0 \leq 6.6 \cdot 10^{+54}:\\
\;\;\;\;\frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot w\right)} \cdot \frac{c0 \cdot c0}{h}\\
\mathbf{elif}\;c0 \leq 2.2 \cdot 10^{+169}:\\
\;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\end{array}
\end{array}
if c0 < -1.05e-102Initial program 33.5%
associate-*l*32.4%
difference-of-squares36.2%
associate-*l*36.2%
associate-*l*36.8%
Simplified36.8%
Taylor expanded in c0 around inf 36.4%
unpow236.4%
unpow236.4%
associate-*r*36.3%
unpow236.3%
unpow236.3%
Simplified36.3%
Taylor expanded in d around 0 36.4%
times-frac37.6%
unpow237.6%
unpow237.6%
times-frac52.9%
unpow252.9%
unpow252.9%
*-commutative52.9%
unpow252.9%
Simplified52.9%
if -1.05e-102 < c0 < 3.20000000000000013e-133Initial program 15.0%
times-frac10.6%
fma-def10.6%
associate-/r*10.6%
difference-of-squares10.9%
Simplified14.0%
Taylor expanded in c0 around -inf 6.1%
associate-*r*6.1%
distribute-rgt1-in6.1%
metadata-eval6.1%
mul0-lft53.9%
metadata-eval53.9%
mul0-lft7.6%
metadata-eval7.6%
distribute-lft1-in7.6%
*-commutative7.6%
distribute-lft1-in7.6%
metadata-eval7.6%
mul0-lft53.9%
Simplified53.9%
if 3.20000000000000013e-133 < c0 < 6.6e54Initial program 34.5%
associate-*l*32.7%
difference-of-squares35.8%
associate-*l*35.8%
associate-*l*38.5%
Simplified38.5%
Taylor expanded in c0 around inf 33.5%
unpow233.5%
unpow233.5%
associate-*r*36.3%
unpow236.3%
unpow236.3%
Simplified36.3%
times-frac41.5%
Applied egg-rr41.5%
if 6.6e54 < c0 < 2.2e169Initial program 20.7%
associate-*l*20.7%
difference-of-squares20.7%
associate-*l*20.7%
associate-*l*26.9%
Simplified26.9%
Applied egg-rr26.9%
Taylor expanded in c0 around -inf 0.3%
associate-*r*0.3%
distribute-rgt1-in0.3%
metadata-eval0.3%
mul0-lft46.5%
metadata-eval46.5%
mul0-lft0.3%
metadata-eval0.3%
distribute-lft1-in0.3%
*-commutative0.3%
distribute-lft1-in0.3%
metadata-eval0.3%
mul0-lft46.5%
Simplified46.5%
if 2.2e169 < c0 Initial program 40.6%
times-frac40.6%
fma-def40.6%
associate-/r*40.6%
difference-of-squares45.4%
Simplified52.6%
Taylor expanded in c0 around inf 48.4%
associate-*r/48.4%
unpow248.4%
unpow248.4%
Simplified48.4%
Final simplification50.0%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* (/ (* d d) (* (* D D) (* w w))) (/ (* c0 c0) h))))
(if (<= c0 -6.8e+22)
t_0
(if (<= c0 4.2e-130)
(/ (* -0.5 (* 0.0 (* c0 c0))) w)
(if (or (<= c0 7.2e+54) (not (<= c0 2.8e+191)))
t_0
(/ (* c0 (* 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) / ((D * D) * (w * w))) * ((c0 * c0) / h);
double tmp;
if (c0 <= -6.8e+22) {
tmp = t_0;
} else if (c0 <= 4.2e-130) {
tmp = (-0.5 * (0.0 * (c0 * c0))) / w;
} else if ((c0 <= 7.2e+54) || !(c0 <= 2.8e+191)) {
tmp = t_0;
} else {
tmp = (c0 * (c0 * 0.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) :: tmp
t_0 = ((d_1 * d_1) / ((d * d) * (w * w))) * ((c0 * c0) / h)
if (c0 <= (-6.8d+22)) then
tmp = t_0
else if (c0 <= 4.2d-130) then
tmp = ((-0.5d0) * (0.0d0 * (c0 * c0))) / w
else if ((c0 <= 7.2d+54) .or. (.not. (c0 <= 2.8d+191))) then
tmp = t_0
else
tmp = (c0 * (c0 * 0.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 t_0 = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h);
double tmp;
if (c0 <= -6.8e+22) {
tmp = t_0;
} else if (c0 <= 4.2e-130) {
tmp = (-0.5 * (0.0 * (c0 * c0))) / w;
} else if ((c0 <= 7.2e+54) || !(c0 <= 2.8e+191)) {
tmp = t_0;
} else {
tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h) tmp = 0 if c0 <= -6.8e+22: tmp = t_0 elif c0 <= 4.2e-130: tmp = (-0.5 * (0.0 * (c0 * c0))) / w elif (c0 <= 7.2e+54) or not (c0 <= 2.8e+191): tmp = t_0 else: tmp = (c0 * (c0 * 0.0)) / (2.0 * w) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(Float64(d * d) / Float64(Float64(D * D) * Float64(w * w))) * Float64(Float64(c0 * c0) / h)) tmp = 0.0 if (c0 <= -6.8e+22) tmp = t_0; elseif (c0 <= 4.2e-130) tmp = Float64(Float64(-0.5 * Float64(0.0 * Float64(c0 * c0))) / w); elseif ((c0 <= 7.2e+54) || !(c0 <= 2.8e+191)) tmp = t_0; else tmp = Float64(Float64(c0 * Float64(c0 * 0.0)) / Float64(2.0 * w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h); tmp = 0.0; if (c0 <= -6.8e+22) tmp = t_0; elseif (c0 <= 4.2e-130) tmp = (-0.5 * (0.0 * (c0 * c0))) / w; elseif ((c0 <= 7.2e+54) || ~((c0 <= 2.8e+191))) tmp = t_0; else tmp = (c0 * (c0 * 0.0)) / (2.0 * w); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(N[(d * d), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * c0), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -6.8e+22], t$95$0, If[LessEqual[c0, 4.2e-130], N[(N[(-0.5 * N[(0.0 * N[(c0 * c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision], If[Or[LessEqual[c0, 7.2e+54], N[Not[LessEqual[c0, 2.8e+191]], $MachinePrecision]], t$95$0, N[(N[(c0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot w\right)} \cdot \frac{c0 \cdot c0}{h}\\
\mathbf{if}\;c0 \leq -6.8 \cdot 10^{+22}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c0 \leq 4.2 \cdot 10^{-130}:\\
\;\;\;\;\frac{-0.5 \cdot \left(0 \cdot \left(c0 \cdot c0\right)\right)}{w}\\
\mathbf{elif}\;c0 \leq 7.2 \cdot 10^{+54} \lor \neg \left(c0 \leq 2.8 \cdot 10^{+191}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\
\end{array}
\end{array}
if c0 < -6.8e22 or 4.20000000000000004e-130 < c0 < 7.2000000000000003e54 or 2.7999999999999999e191 < c0 Initial program 37.6%
associate-*l*36.4%
difference-of-squares41.1%
associate-*l*41.1%
associate-*l*41.9%
Simplified41.9%
Taylor expanded in c0 around inf 39.1%
unpow239.1%
unpow239.1%
associate-*r*39.9%
unpow239.9%
unpow239.9%
Simplified39.9%
times-frac42.1%
Applied egg-rr42.1%
if -6.8e22 < c0 < 4.20000000000000004e-130Initial program 18.3%
associate-*l*17.2%
difference-of-squares17.5%
associate-*l*17.6%
associate-*l*20.3%
Simplified20.3%
Taylor expanded in c0 around -inf 6.3%
associate-*r/6.3%
*-commutative6.3%
unpow26.3%
distribute-rgt1-in6.3%
metadata-eval6.3%
mul0-lft45.9%
Simplified45.9%
if 7.2000000000000003e54 < c0 < 2.7999999999999999e191Initial program 21.2%
associate-*l*21.2%
difference-of-squares21.2%
associate-*l*21.2%
associate-*l*26.8%
Simplified26.8%
Applied egg-rr26.6%
Taylor expanded in c0 around -inf 3.2%
associate-*r*3.2%
distribute-rgt1-in3.2%
metadata-eval3.2%
mul0-lft47.0%
metadata-eval47.0%
mul0-lft3.2%
metadata-eval3.2%
distribute-lft1-in3.2%
*-commutative3.2%
distribute-lft1-in3.2%
metadata-eval3.2%
mul0-lft47.0%
Simplified47.0%
Final simplification44.1%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= d 9.2e-147) (not (<= d 1.2e+243))) (/ (* c0 (* c0 0.0)) (* 2.0 w)) (* (/ c0 (* 2.0 w)) (/ (* 2.0 (* c0 (* d d))) (* (* w h) (* D D))))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((d <= 9.2e-147) || !(d <= 1.2e+243)) {
tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
} else {
tmp = (c0 / (2.0 * w)) * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D)));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if ((d_1 <= 9.2d-147) .or. (.not. (d_1 <= 1.2d+243))) then
tmp = (c0 * (c0 * 0.0d0)) / (2.0d0 * w)
else
tmp = (c0 / (2.0d0 * w)) * ((2.0d0 * (c0 * (d_1 * d_1))) / ((w * h) * (d * d)))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((d <= 9.2e-147) || !(d <= 1.2e+243)) {
tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
} else {
tmp = (c0 / (2.0 * w)) * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D)));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (d <= 9.2e-147) or not (d <= 1.2e+243): tmp = (c0 * (c0 * 0.0)) / (2.0 * w) else: tmp = (c0 / (2.0 * w)) * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D))) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((d <= 9.2e-147) || !(d <= 1.2e+243)) tmp = Float64(Float64(c0 * Float64(c0 * 0.0)) / Float64(2.0 * w)); else tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(2.0 * Float64(c0 * Float64(d * d))) / Float64(Float64(w * h) * Float64(D * D)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((d <= 9.2e-147) || ~((d <= 1.2e+243))) tmp = (c0 * (c0 * 0.0)) / (2.0 * w); else tmp = (c0 / (2.0 * w)) * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[d, 9.2e-147], N[Not[LessEqual[d, 1.2e+243]], $MachinePrecision]], N[(N[(c0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 9.2 \cdot 10^{-147} \lor \neg \left(d \leq 1.2 \cdot 10^{+243}\right):\\
\;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\end{array}
\end{array}
if d < 9.19999999999999962e-147 or 1.2e243 < d Initial program 23.9%
associate-*l*22.4%
difference-of-squares24.3%
associate-*l*24.3%
associate-*l*26.7%
Simplified26.7%
Applied egg-rr33.4%
Taylor expanded in c0 around -inf 2.3%
associate-*r*2.3%
distribute-rgt1-in2.3%
metadata-eval2.3%
mul0-lft35.8%
metadata-eval35.8%
mul0-lft2.9%
metadata-eval2.9%
distribute-lft1-in2.9%
*-commutative2.9%
distribute-lft1-in2.9%
metadata-eval2.9%
mul0-lft35.8%
Simplified35.8%
if 9.19999999999999962e-147 < d < 1.2e243Initial program 38.5%
times-frac36.0%
fma-def36.0%
associate-/r*36.0%
difference-of-squares39.9%
Simplified46.2%
Taylor expanded in c0 around inf 43.0%
associate-*r/43.0%
unpow243.0%
unpow243.0%
Simplified43.0%
Final simplification38.1%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= d 8.2e-153) (not (<= d 1.05e+244))) (/ (* c0 (* c0 0.0)) (* 2.0 w)) (/ (* (* d d) (* c0 c0)) (* h (* D (* D (* w w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((d <= 8.2e-153) || !(d <= 1.05e+244)) {
tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
} else {
tmp = ((d * d) * (c0 * c0)) / (h * (D * (D * (w * w))));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if ((d_1 <= 8.2d-153) .or. (.not. (d_1 <= 1.05d+244))) then
tmp = (c0 * (c0 * 0.0d0)) / (2.0d0 * w)
else
tmp = ((d_1 * d_1) * (c0 * c0)) / (h * (d * (d * (w * w))))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((d <= 8.2e-153) || !(d <= 1.05e+244)) {
tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
} else {
tmp = ((d * d) * (c0 * c0)) / (h * (D * (D * (w * w))));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (d <= 8.2e-153) or not (d <= 1.05e+244): tmp = (c0 * (c0 * 0.0)) / (2.0 * w) else: tmp = ((d * d) * (c0 * c0)) / (h * (D * (D * (w * w)))) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((d <= 8.2e-153) || !(d <= 1.05e+244)) tmp = Float64(Float64(c0 * Float64(c0 * 0.0)) / Float64(2.0 * w)); else tmp = Float64(Float64(Float64(d * d) * Float64(c0 * c0)) / Float64(h * Float64(D * Float64(D * Float64(w * w))))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((d <= 8.2e-153) || ~((d <= 1.05e+244))) tmp = (c0 * (c0 * 0.0)) / (2.0 * w); else tmp = ((d * d) * (c0 * c0)) / (h * (D * (D * (w * w)))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[d, 8.2e-153], N[Not[LessEqual[d, 1.05e+244]], $MachinePrecision]], N[(N[(c0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d * d), $MachinePrecision] * N[(c0 * c0), $MachinePrecision]), $MachinePrecision] / N[(h * N[(D * N[(D * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 8.2 \cdot 10^{-153} \lor \neg \left(d \leq 1.05 \cdot 10^{+244}\right):\\
\;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{h \cdot \left(D \cdot \left(D \cdot \left(w \cdot w\right)\right)\right)}\\
\end{array}
\end{array}
if d < 8.2e-153 or 1.05e244 < d Initial program 24.0%
associate-*l*22.5%
difference-of-squares24.4%
associate-*l*24.4%
associate-*l*26.9%
Simplified26.9%
Applied egg-rr33.0%
Taylor expanded in c0 around -inf 2.3%
associate-*r*2.3%
distribute-rgt1-in2.3%
metadata-eval2.3%
mul0-lft36.0%
metadata-eval36.0%
mul0-lft2.9%
metadata-eval2.9%
distribute-lft1-in2.9%
*-commutative2.9%
distribute-lft1-in2.9%
metadata-eval2.9%
mul0-lft36.0%
Simplified36.0%
if 8.2e-153 < d < 1.05e244Initial program 38.0%
associate-*l*38.0%
difference-of-squares41.9%
associate-*l*41.9%
associate-*l*43.3%
Simplified43.3%
Taylor expanded in c0 around inf 33.9%
unpow233.9%
unpow233.9%
associate-*r*35.1%
unpow235.1%
unpow235.1%
Simplified35.1%
Taylor expanded in D around 0 35.1%
unpow235.1%
associate-*l*43.7%
unpow243.7%
Simplified43.7%
Final simplification38.5%
(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 28.5%
times-frac26.9%
fma-def26.9%
associate-/r*26.9%
difference-of-squares29.8%
Simplified36.2%
Taylor expanded in c0 around -inf 2.9%
associate-*r*2.9%
distribute-rgt1-in2.9%
metadata-eval2.9%
mul0-lft29.7%
metadata-eval29.7%
mul0-lft3.2%
metadata-eval3.2%
distribute-lft1-in3.2%
*-commutative3.2%
distribute-lft1-in3.2%
metadata-eval3.2%
mul0-lft29.7%
Simplified29.7%
Final simplification29.7%
(FPCore (c0 w h D d M) :precision binary64 (/ (* c0 (* c0 0.0)) (* 2.0 w)))
double code(double c0, double w, double h, double D, double d, double M) {
return (c0 * (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 * (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 * (c0 * 0.0)) / (2.0 * w);
}
def code(c0, w, h, D, d, M): return (c0 * (c0 * 0.0)) / (2.0 * w)
function code(c0, w, h, D, d, M) return Float64(Float64(c0 * Float64(c0 * 0.0)) / Float64(2.0 * w)) end
function tmp = code(c0, w, h, D, d, M) tmp = (c0 * (c0 * 0.0)) / (2.0 * w); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}
\end{array}
Initial program 28.5%
associate-*l*27.5%
difference-of-squares30.0%
associate-*l*30.0%
associate-*l*32.1%
Simplified32.1%
Applied egg-rr36.6%
Taylor expanded in c0 around -inf 3.3%
associate-*r*3.3%
distribute-rgt1-in3.3%
metadata-eval3.3%
mul0-lft32.5%
metadata-eval32.5%
mul0-lft3.7%
metadata-eval3.7%
distribute-lft1-in3.7%
*-commutative3.7%
distribute-lft1-in3.7%
metadata-eval3.7%
mul0-lft32.5%
Simplified32.5%
Final simplification32.5%
herbie shell --seed 2023238
(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))))))