
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (c0 w h D d M) :precision binary64 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))) (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) end
function tmp = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)
\end{array}
\end{array}
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* (/ c0 (* w h)) (pow (/ d D) 2.0)))
(t_1 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_2 (* (/ c0 (* 2.0 w)) (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))))
(if (<= t_2 0.0)
(* c0 (/ (+ t_0 (sqrt (- (pow t_0 2.0) (pow M 2.0)))) (* 2.0 w)))
(if (<= t_2 INFINITY)
(pow (* d (/ c0 (* (sqrt h) (* w D)))) 2.0)
(* c0 (* -0.5 (/ (* c0 0.0) w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / (w * h)) * pow((d / D), 2.0);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_2 = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= 0.0) {
tmp = c0 * ((t_0 + sqrt((pow(t_0, 2.0) - pow(M, 2.0)))) / (2.0 * w));
} else if (t_2 <= ((double) INFINITY)) {
tmp = pow((d * (c0 / (sqrt(h) * (w * D)))), 2.0);
} else {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / (w * h)) * Math.pow((d / D), 2.0);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_2 = (c0 / (2.0 * w)) * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= 0.0) {
tmp = c0 * ((t_0 + Math.sqrt((Math.pow(t_0, 2.0) - Math.pow(M, 2.0)))) / (2.0 * w));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = Math.pow((d * (c0 / (Math.sqrt(h) * (w * D)))), 2.0);
} else {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 / (w * h)) * math.pow((d / D), 2.0) t_1 = (c0 * (d * d)) / ((w * h) * (D * D)) t_2 = (c0 / (2.0 * w)) * (t_1 + math.sqrt(((t_1 * t_1) - (M * M)))) tmp = 0 if t_2 <= 0.0: tmp = c0 * ((t_0 + math.sqrt((math.pow(t_0, 2.0) - math.pow(M, 2.0)))) / (2.0 * w)) elif t_2 <= math.inf: tmp = math.pow((d * (c0 / (math.sqrt(h) * (w * D)))), 2.0) else: tmp = c0 * (-0.5 * ((c0 * 0.0) / w)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 / Float64(w * h)) * (Float64(d / D) ^ 2.0)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_2 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) tmp = 0.0 if (t_2 <= 0.0) tmp = Float64(c0 * Float64(Float64(t_0 + sqrt(Float64((t_0 ^ 2.0) - (M ^ 2.0)))) / Float64(2.0 * w))); elseif (t_2 <= Inf) tmp = Float64(d * Float64(c0 / Float64(sqrt(h) * Float64(w * D)))) ^ 2.0; else tmp = Float64(c0 * Float64(-0.5 * Float64(Float64(c0 * 0.0) / w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 / (w * h)) * ((d / D) ^ 2.0); t_1 = (c0 * (d * d)) / ((w * h) * (D * D)); t_2 = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M)))); tmp = 0.0; if (t_2 <= 0.0) tmp = c0 * ((t_0 + sqrt(((t_0 ^ 2.0) - (M ^ 2.0)))) / (2.0 * w)); elseif (t_2 <= Inf) tmp = (d * (c0 / (sqrt(h) * (w * D)))) ^ 2.0; else tmp = c0 * (-0.5 * ((c0 * 0.0) / w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = 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]}, If[LessEqual[t$95$2, 0.0], N[(c0 * N[(N[(t$95$0 + N[Sqrt[N[(N[Power[t$95$0, 2.0], $MachinePrecision] - N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[Power[N[(d * N[(c0 / N[(N[Sqrt[h], $MachinePrecision] * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(c0 * N[(-0.5 * N[(N[(c0 * 0.0), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_2 := \frac{c0}{2 \cdot w} \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_1 - M \cdot M}\right)\\
\mathbf{if}\;t\_2 \leq 0:\\
\;\;\;\;c0 \cdot \frac{t\_0 + \sqrt{{t\_0}^{2} - {M}^{2}}}{2 \cdot w}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;{\left(d \cdot \frac{c0}{\sqrt{h} \cdot \left(w \cdot D\right)}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(-0.5 \cdot \frac{c0 \cdot 0}{w}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < -0.0Initial program 67.2%
Simplified64.9%
fma-undefine69.7%
associate-*r/68.1%
*-commutative68.1%
associate-*r*67.3%
associate-*r*62.8%
associate-/l*60.4%
frac-times62.5%
times-frac64.7%
pow264.7%
Applied egg-rr70.6%
if -0.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 72.7%
Simplified72.6%
Applied egg-rr81.3%
Taylor expanded in c0 around inf 48.2%
associate-/l*50.4%
associate-*r*53.8%
Simplified53.8%
Taylor expanded in c0 around 0 48.2%
unpow248.2%
unpow248.2%
swap-sqr58.7%
associate-*r*61.1%
*-commutative61.1%
unpow261.1%
rem-square-sqrt61.0%
swap-sqr65.0%
unpow265.0%
swap-sqr85.4%
times-frac91.8%
associate-*r/89.7%
associate-*r/89.8%
unpow289.8%
Simplified92.7%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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%
Simplified19.6%
Taylor expanded in c0 around -inf 1.3%
associate-/l*1.3%
distribute-lft1-in1.3%
metadata-eval1.3%
associate-/r*0.7%
Simplified0.7%
associate-*r/0.7%
mul0-lft41.7%
Applied egg-rr41.7%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* d (/ d (* D (* w (* h D))))))
(t_1 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_2 (* (/ c0 (* 2.0 w)) (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))))
(if (<= t_2 -1e-109)
(*
c0
(/
(fma
c0
(/ d (/ (* w (* h (pow D 2.0))) d))
(sqrt (* (fma c0 t_0 M) (- (* c0 t_0) M))))
(* 2.0 w)))
(if (<= t_2 INFINITY)
(pow (* d (/ c0 (* (sqrt h) (* w D)))) 2.0)
(* c0 (* -0.5 (/ (* c0 0.0) w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = d * (d / (D * (w * (h * D))));
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_2 = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= -1e-109) {
tmp = c0 * (fma(c0, (d / ((w * (h * pow(D, 2.0))) / d)), sqrt((fma(c0, t_0, M) * ((c0 * t_0) - M)))) / (2.0 * w));
} else if (t_2 <= ((double) INFINITY)) {
tmp = pow((d * (c0 / (sqrt(h) * (w * D)))), 2.0);
} else {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(d * Float64(d / Float64(D * Float64(w * Float64(h * D))))) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_2 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) tmp = 0.0 if (t_2 <= -1e-109) tmp = Float64(c0 * Float64(fma(c0, Float64(d / Float64(Float64(w * Float64(h * (D ^ 2.0))) / d)), sqrt(Float64(fma(c0, t_0, M) * Float64(Float64(c0 * t_0) - M)))) / Float64(2.0 * w))); elseif (t_2 <= Inf) tmp = Float64(d * Float64(c0 / Float64(sqrt(h) * Float64(w * D)))) ^ 2.0; else tmp = Float64(c0 * Float64(-0.5 * Float64(Float64(c0 * 0.0) / w))); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(d * N[(d / N[(D * N[(w * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = 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]}, If[LessEqual[t$95$2, -1e-109], N[(c0 * N[(N[(c0 * N[(d / N[(N[(w * N[(h * N[Power[D, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[(c0 * t$95$0 + M), $MachinePrecision] * N[(N[(c0 * t$95$0), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[Power[N[(d * N[(c0 / N[(N[Sqrt[h], $MachinePrecision] * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(c0 * N[(-0.5 * N[(N[(c0 * 0.0), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_2 := \frac{c0}{2 \cdot w} \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_1 - M \cdot M}\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-109}:\\
\;\;\;\;c0 \cdot \frac{\mathsf{fma}\left(c0, \frac{d}{\frac{w \cdot \left(h \cdot {D}^{2}\right)}{d}}, \sqrt{\mathsf{fma}\left(c0, t\_0, M\right) \cdot \left(c0 \cdot t\_0 - M\right)}\right)}{2 \cdot w}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;{\left(d \cdot \frac{c0}{\sqrt{h} \cdot \left(w \cdot D\right)}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(-0.5 \cdot \frac{c0 \cdot 0}{w}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < -9.9999999999999999e-110Initial program 71.7%
Simplified74.4%
clear-num74.4%
inv-pow74.4%
*-commutative74.4%
associate-*r*71.6%
associate-*r*71.7%
associate-*l*74.5%
pow274.5%
Applied egg-rr74.5%
unpow-174.5%
associate-/l*74.5%
Simplified74.5%
un-div-inv74.5%
associate-*r/74.6%
Applied egg-rr74.6%
if -9.9999999999999999e-110 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 68.8%
Simplified68.6%
Applied egg-rr73.7%
Taylor expanded in c0 around inf 43.5%
associate-/l*45.4%
associate-*r*46.3%
Simplified46.3%
Taylor expanded in c0 around 0 43.5%
unpow243.5%
unpow243.5%
swap-sqr54.5%
associate-*r*54.6%
*-commutative54.6%
unpow254.6%
rem-square-sqrt54.3%
swap-sqr58.0%
unpow258.0%
swap-sqr79.3%
times-frac84.9%
associate-*r/83.1%
associate-*r/83.1%
unpow283.1%
Simplified85.6%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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%
Simplified19.6%
Taylor expanded in c0 around -inf 1.3%
associate-/l*1.3%
distribute-lft1-in1.3%
metadata-eval1.3%
associate-/r*0.7%
Simplified0.7%
associate-*r/0.7%
mul0-lft41.7%
Applied egg-rr41.7%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* d (/ d (* D (* w (* h D))))))
(t_1 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_2 (* (/ c0 (* 2.0 w)) (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))))
(if (<= t_2 -1e-109)
(*
c0
(/
(fma
c0
(* d (/ (/ d w) (* h (pow D 2.0))))
(sqrt (* (fma c0 t_0 M) (- (* c0 t_0) M))))
(* 2.0 w)))
(if (<= t_2 INFINITY)
(pow (* d (/ c0 (* (sqrt h) (* w D)))) 2.0)
(* c0 (* -0.5 (/ (* c0 0.0) w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = d * (d / (D * (w * (h * D))));
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_2 = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= -1e-109) {
tmp = c0 * (fma(c0, (d * ((d / w) / (h * pow(D, 2.0)))), sqrt((fma(c0, t_0, M) * ((c0 * t_0) - M)))) / (2.0 * w));
} else if (t_2 <= ((double) INFINITY)) {
tmp = pow((d * (c0 / (sqrt(h) * (w * D)))), 2.0);
} else {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(d * Float64(d / Float64(D * Float64(w * Float64(h * D))))) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_2 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) tmp = 0.0 if (t_2 <= -1e-109) tmp = Float64(c0 * Float64(fma(c0, Float64(d * Float64(Float64(d / w) / Float64(h * (D ^ 2.0)))), sqrt(Float64(fma(c0, t_0, M) * Float64(Float64(c0 * t_0) - M)))) / Float64(2.0 * w))); elseif (t_2 <= Inf) tmp = Float64(d * Float64(c0 / Float64(sqrt(h) * Float64(w * D)))) ^ 2.0; else tmp = Float64(c0 * Float64(-0.5 * Float64(Float64(c0 * 0.0) / w))); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(d * N[(d / N[(D * N[(w * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = 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]}, If[LessEqual[t$95$2, -1e-109], N[(c0 * N[(N[(c0 * N[(d * N[(N[(d / w), $MachinePrecision] / N[(h * N[Power[D, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[(c0 * t$95$0 + M), $MachinePrecision] * N[(N[(c0 * t$95$0), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[Power[N[(d * N[(c0 / N[(N[Sqrt[h], $MachinePrecision] * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(c0 * N[(-0.5 * N[(N[(c0 * 0.0), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_2 := \frac{c0}{2 \cdot w} \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_1 - M \cdot M}\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-109}:\\
\;\;\;\;c0 \cdot \frac{\mathsf{fma}\left(c0, d \cdot \frac{\frac{d}{w}}{h \cdot {D}^{2}}, \sqrt{\mathsf{fma}\left(c0, t\_0, M\right) \cdot \left(c0 \cdot t\_0 - M\right)}\right)}{2 \cdot w}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;{\left(d \cdot \frac{c0}{\sqrt{h} \cdot \left(w \cdot D\right)}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(-0.5 \cdot \frac{c0 \cdot 0}{w}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < -9.9999999999999999e-110Initial program 71.7%
Simplified74.4%
*-un-lft-identity74.4%
*-commutative74.4%
associate-*r*71.6%
associate-*r*71.6%
associate-*l*74.5%
pow274.5%
Applied egg-rr74.5%
*-lft-identity74.5%
associate-/r*74.5%
Simplified74.5%
if -9.9999999999999999e-110 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 68.8%
Simplified68.6%
Applied egg-rr73.7%
Taylor expanded in c0 around inf 43.5%
associate-/l*45.4%
associate-*r*46.3%
Simplified46.3%
Taylor expanded in c0 around 0 43.5%
unpow243.5%
unpow243.5%
swap-sqr54.5%
associate-*r*54.6%
*-commutative54.6%
unpow254.6%
rem-square-sqrt54.3%
swap-sqr58.0%
unpow258.0%
swap-sqr79.3%
times-frac84.9%
associate-*r/83.1%
associate-*r/83.1%
unpow283.1%
Simplified85.6%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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%
Simplified19.6%
Taylor expanded in c0 around -inf 1.3%
associate-/l*1.3%
distribute-lft1-in1.3%
metadata-eval1.3%
associate-/r*0.7%
Simplified0.7%
associate-*r/0.7%
mul0-lft41.7%
Applied egg-rr41.7%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* d (/ d (* D (* w (* h D))))))
(t_1 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_2 (* (/ c0 (* 2.0 w)) (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))))
(if (<= t_2 -1e-109)
(*
c0
(/ (fma c0 t_0 (sqrt (* (fma c0 t_0 M) (- (* c0 t_0) M)))) (* 2.0 w)))
(if (<= t_2 INFINITY)
(pow (* d (/ c0 (* (sqrt h) (* w D)))) 2.0)
(* c0 (* -0.5 (/ (* c0 0.0) w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = d * (d / (D * (w * (h * D))));
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_2 = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= -1e-109) {
tmp = c0 * (fma(c0, t_0, sqrt((fma(c0, t_0, M) * ((c0 * t_0) - M)))) / (2.0 * w));
} else if (t_2 <= ((double) INFINITY)) {
tmp = pow((d * (c0 / (sqrt(h) * (w * D)))), 2.0);
} else {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = Float64(d * Float64(d / Float64(D * Float64(w * Float64(h * D))))) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_2 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) tmp = 0.0 if (t_2 <= -1e-109) tmp = Float64(c0 * Float64(fma(c0, t_0, sqrt(Float64(fma(c0, t_0, M) * Float64(Float64(c0 * t_0) - M)))) / Float64(2.0 * w))); elseif (t_2 <= Inf) tmp = Float64(d * Float64(c0 / Float64(sqrt(h) * Float64(w * D)))) ^ 2.0; else tmp = Float64(c0 * Float64(-0.5 * Float64(Float64(c0 * 0.0) / w))); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(d * N[(d / N[(D * N[(w * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = 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]}, If[LessEqual[t$95$2, -1e-109], N[(c0 * N[(N[(c0 * t$95$0 + N[Sqrt[N[(N[(c0 * t$95$0 + M), $MachinePrecision] * N[(N[(c0 * t$95$0), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[Power[N[(d * N[(c0 / N[(N[Sqrt[h], $MachinePrecision] * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(c0 * N[(-0.5 * N[(N[(c0 * 0.0), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_2 := \frac{c0}{2 \cdot w} \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_1 - M \cdot M}\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-109}:\\
\;\;\;\;c0 \cdot \frac{\mathsf{fma}\left(c0, t\_0, \sqrt{\mathsf{fma}\left(c0, t\_0, M\right) \cdot \left(c0 \cdot t\_0 - M\right)}\right)}{2 \cdot w}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;{\left(d \cdot \frac{c0}{\sqrt{h} \cdot \left(w \cdot D\right)}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(-0.5 \cdot \frac{c0 \cdot 0}{w}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < -9.9999999999999999e-110Initial program 71.7%
Simplified74.4%
if -9.9999999999999999e-110 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 68.8%
Simplified68.6%
Applied egg-rr73.7%
Taylor expanded in c0 around inf 43.5%
associate-/l*45.4%
associate-*r*46.3%
Simplified46.3%
Taylor expanded in c0 around 0 43.5%
unpow243.5%
unpow243.5%
swap-sqr54.5%
associate-*r*54.6%
*-commutative54.6%
unpow254.6%
rem-square-sqrt54.3%
swap-sqr58.0%
unpow258.0%
swap-sqr79.3%
times-frac84.9%
associate-*r/83.1%
associate-*r/83.1%
unpow283.1%
Simplified85.6%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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%
Simplified19.6%
Taylor expanded in c0 around -inf 1.3%
associate-/l*1.3%
distribute-lft1-in1.3%
metadata-eval1.3%
associate-/r*0.7%
Simplified0.7%
associate-*r/0.7%
mul0-lft41.7%
Applied egg-rr41.7%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_1 (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
(if (<= t_1 0.0)
t_1
(if (<= t_1 INFINITY)
(pow (* d (/ c0 (* (sqrt h) (* w D)))) 2.0)
(* c0 (* -0.5 (/ (* c0 0.0) w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= 0.0) {
tmp = t_1;
} else if (t_1 <= ((double) INFINITY)) {
tmp = pow((d * (c0 / (sqrt(h) * (w * D)))), 2.0);
} else {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_1 = (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= 0.0) {
tmp = t_1;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = Math.pow((d * (c0 / (Math.sqrt(h) * (w * D)))), 2.0);
} else {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) t_1 = (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M)))) tmp = 0 if t_1 <= 0.0: tmp = t_1 elif t_1 <= math.inf: tmp = math.pow((d * (c0 / (math.sqrt(h) * (w * D)))), 2.0) else: tmp = c0 * (-0.5 * ((c0 * 0.0) / w)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_1 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) tmp = 0.0 if (t_1 <= 0.0) tmp = t_1; elseif (t_1 <= Inf) tmp = Float64(d * Float64(c0 / Float64(sqrt(h) * Float64(w * D)))) ^ 2.0; else tmp = Float64(c0 * Float64(-0.5 * Float64(Float64(c0 * 0.0) / w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); tmp = 0.0; if (t_1 <= 0.0) tmp = t_1; elseif (t_1 <= Inf) tmp = (d * (c0 / (sqrt(h) * (w * D)))) ^ 2.0; else tmp = c0 * (-0.5 * ((c0 * 0.0) / w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], t$95$1, If[LessEqual[t$95$1, Infinity], N[Power[N[(d * N[(c0 / N[(N[Sqrt[h], $MachinePrecision] * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(c0 * N[(-0.5 * N[(N[(c0 * 0.0), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;{\left(d \cdot \frac{c0}{\sqrt{h} \cdot \left(w \cdot D\right)}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(-0.5 \cdot \frac{c0 \cdot 0}{w}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < -0.0Initial program 67.2%
if -0.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 72.7%
Simplified72.6%
Applied egg-rr81.3%
Taylor expanded in c0 around inf 48.2%
associate-/l*50.4%
associate-*r*53.8%
Simplified53.8%
Taylor expanded in c0 around 0 48.2%
unpow248.2%
unpow248.2%
swap-sqr58.7%
associate-*r*61.1%
*-commutative61.1%
unpow261.1%
rem-square-sqrt61.0%
swap-sqr65.0%
unpow265.0%
swap-sqr85.4%
times-frac91.8%
associate-*r/89.7%
associate-*r/89.8%
unpow289.8%
Simplified92.7%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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%
Simplified19.6%
Taylor expanded in c0 around -inf 1.3%
associate-/l*1.3%
distribute-lft1-in1.3%
metadata-eval1.3%
associate-/r*0.7%
Simplified0.7%
associate-*r/0.7%
mul0-lft41.7%
Applied egg-rr41.7%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_1 (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
(if (<= t_1 0.0)
t_1
(if (<= t_1 INFINITY)
(pow (* c0 (/ d (* w (* D (sqrt h))))) 2.0)
(* c0 (* -0.5 (/ (* c0 0.0) w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= 0.0) {
tmp = t_1;
} else if (t_1 <= ((double) INFINITY)) {
tmp = pow((c0 * (d / (w * (D * sqrt(h))))), 2.0);
} else {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_1 = (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= 0.0) {
tmp = t_1;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = Math.pow((c0 * (d / (w * (D * Math.sqrt(h))))), 2.0);
} else {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) t_1 = (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M)))) tmp = 0 if t_1 <= 0.0: tmp = t_1 elif t_1 <= math.inf: tmp = math.pow((c0 * (d / (w * (D * math.sqrt(h))))), 2.0) else: tmp = c0 * (-0.5 * ((c0 * 0.0) / w)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_1 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) tmp = 0.0 if (t_1 <= 0.0) tmp = t_1; elseif (t_1 <= Inf) tmp = Float64(c0 * Float64(d / Float64(w * Float64(D * sqrt(h))))) ^ 2.0; else tmp = Float64(c0 * Float64(-0.5 * Float64(Float64(c0 * 0.0) / w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); tmp = 0.0; if (t_1 <= 0.0) tmp = t_1; elseif (t_1 <= Inf) tmp = (c0 * (d / (w * (D * sqrt(h))))) ^ 2.0; else tmp = c0 * (-0.5 * ((c0 * 0.0) / w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], t$95$1, If[LessEqual[t$95$1, Infinity], N[Power[N[(c0 * N[(d / N[(w * N[(D * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(c0 * N[(-0.5 * N[(N[(c0 * 0.0), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;{\left(c0 \cdot \frac{d}{w \cdot \left(D \cdot \sqrt{h}\right)}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(-0.5 \cdot \frac{c0 \cdot 0}{w}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < -0.0Initial program 67.2%
if -0.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 72.7%
Simplified72.6%
Applied egg-rr81.3%
Taylor expanded in c0 around inf 48.2%
associate-/l*50.4%
associate-*r*53.8%
Simplified53.8%
add-sqr-sqrt53.7%
pow253.7%
Applied egg-rr89.8%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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%
Simplified19.6%
Taylor expanded in c0 around -inf 1.3%
associate-/l*1.3%
distribute-lft1-in1.3%
metadata-eval1.3%
associate-/r*0.7%
Simplified0.7%
associate-*r/0.7%
mul0-lft41.7%
Applied egg-rr41.7%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_1 (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
(if (<= t_1 INFINITY) t_1 (* c0 (* -0.5 (/ (* c0 0.0) w))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_1 = (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) t_1 = (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M)))) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = c0 * (-0.5 * ((c0 * 0.0) / w)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_1 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(c0 * Float64(-0.5 * Float64(Float64(c0 * 0.0) / w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = c0 * (-0.5 * ((c0 * 0.0) / w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(c0 * N[(-0.5 * N[(N[(c0 * 0.0), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(-0.5 \cdot \frac{c0 \cdot 0}{w}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 70.0%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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%
Simplified19.6%
Taylor expanded in c0 around -inf 1.3%
associate-/l*1.3%
distribute-lft1-in1.3%
metadata-eval1.3%
associate-/r*0.7%
Simplified0.7%
associate-*r/0.7%
mul0-lft41.7%
Applied egg-rr41.7%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (pow (/ d D) 2.0)))
(if (<= d 2.5e+25)
(* c0 (/ (* (/ c0 (* w h)) t_0) (* 2.0 w)))
(if (or (<= d 4e+117) (not (<= d 8.5e+270)))
(* c0 (* -0.5 (/ (* c0 0.0) w)))
(* c0 (/ (* 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 tmp;
if (d <= 2.5e+25) {
tmp = c0 * (((c0 / (w * h)) * t_0) / (2.0 * w));
} else if ((d <= 4e+117) || !(d <= 8.5e+270)) {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
} else {
tmp = c0 * ((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) :: tmp
t_0 = (d_1 / d) ** 2.0d0
if (d_1 <= 2.5d+25) then
tmp = c0 * (((c0 / (w * h)) * t_0) / (2.0d0 * w))
else if ((d_1 <= 4d+117) .or. (.not. (d_1 <= 8.5d+270))) then
tmp = c0 * ((-0.5d0) * ((c0 * 0.0d0) / w))
else
tmp = c0 * ((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 tmp;
if (d <= 2.5e+25) {
tmp = c0 * (((c0 / (w * h)) * t_0) / (2.0 * w));
} else if ((d <= 4e+117) || !(d <= 8.5e+270)) {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
} else {
tmp = c0 * ((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) tmp = 0 if d <= 2.5e+25: tmp = c0 * (((c0 / (w * h)) * t_0) / (2.0 * w)) elif (d <= 4e+117) or not (d <= 8.5e+270): tmp = c0 * (-0.5 * ((c0 * 0.0) / w)) else: tmp = c0 * ((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 tmp = 0.0 if (d <= 2.5e+25) tmp = Float64(c0 * Float64(Float64(Float64(c0 / Float64(w * h)) * t_0) / Float64(2.0 * w))); elseif ((d <= 4e+117) || !(d <= 8.5e+270)) tmp = Float64(c0 * Float64(-0.5 * Float64(Float64(c0 * 0.0) / w))); else tmp = Float64(c0 * Float64(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; tmp = 0.0; if (d <= 2.5e+25) tmp = c0 * (((c0 / (w * h)) * t_0) / (2.0 * w)); elseif ((d <= 4e+117) || ~((d <= 8.5e+270))) tmp = c0 * (-0.5 * ((c0 * 0.0) / w)); else tmp = c0 * ((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]}, If[LessEqual[d, 2.5e+25], N[(c0 * N[(N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 4e+117], N[Not[LessEqual[d, 8.5e+270]], $MachinePrecision]], N[(c0 * N[(-0.5 * N[(N[(c0 * 0.0), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[(c0 * N[(t$95$0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{2}\\
\mathbf{if}\;d \leq 2.5 \cdot 10^{+25}:\\
\;\;\;\;c0 \cdot \frac{\frac{c0}{w \cdot h} \cdot t\_0}{2 \cdot w}\\
\mathbf{elif}\;d \leq 4 \cdot 10^{+117} \lor \neg \left(d \leq 8.5 \cdot 10^{+270}\right):\\
\;\;\;\;c0 \cdot \left(-0.5 \cdot \frac{c0 \cdot 0}{w}\right)\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{c0 \cdot \frac{t\_0}{w \cdot h}}{2 \cdot w}\\
\end{array}
\end{array}
if d < 2.50000000000000012e25Initial program 23.6%
Simplified35.8%
Taylor expanded in w around -inf 3.1%
distribute-lft-out3.1%
distribute-lft1-in3.1%
metadata-eval3.1%
associate-*r*3.1%
Simplified3.1%
add-sqr-sqrt3.1%
pow1/23.1%
pow1/23.1%
pow-prod-down6.4%
Applied egg-rr36.6%
unpow1/236.6%
div036.6%
Simplified36.6%
Taylor expanded in c0 around inf 28.9%
*-commutative28.9%
times-frac28.3%
unpow228.3%
unpow228.3%
times-frac38.8%
unpow238.8%
Simplified38.8%
if 2.50000000000000012e25 < d < 4.0000000000000002e117 or 8.50000000000000063e270 < d Initial program 9.8%
Simplified22.1%
Taylor expanded in c0 around -inf 6.3%
associate-/l*6.3%
distribute-lft1-in6.3%
metadata-eval6.3%
associate-/r*3.3%
Simplified3.3%
associate-*r/3.3%
mul0-lft56.7%
Applied egg-rr56.7%
if 4.0000000000000002e117 < d < 8.50000000000000063e270Initial program 28.5%
Simplified46.1%
Taylor expanded in w around -inf 0.0%
distribute-lft-out0.0%
distribute-lft1-in0.0%
metadata-eval0.0%
associate-*r*2.2%
Simplified2.2%
add-sqr-sqrt2.2%
pow1/22.2%
pow1/22.2%
pow-prod-down2.2%
Applied egg-rr51.3%
unpow1/251.3%
div051.3%
Simplified51.3%
Taylor expanded in c0 around inf 40.0%
associate-/r*40.1%
associate-/l*40.1%
unpow240.1%
unpow240.1%
times-frac47.1%
unpow247.1%
associate-*r/49.3%
Simplified49.3%
Final simplification43.0%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= d 1.12e+24) (and (not (<= d 2e+118)) (<= d 2.5e+270))) (* c0 (/ (* c0 (/ (pow (/ d D) 2.0) (* w h))) (* 2.0 w))) (* c0 (* -0.5 (/ (* c0 0.0) w)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((d <= 1.12e+24) || (!(d <= 2e+118) && (d <= 2.5e+270))) {
tmp = c0 * ((c0 * (pow((d / D), 2.0) / (w * h))) / (2.0 * w));
} else {
tmp = c0 * (-0.5 * ((c0 * 0.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_1 <= 1.12d+24) .or. (.not. (d_1 <= 2d+118)) .and. (d_1 <= 2.5d+270)) then
tmp = c0 * ((c0 * (((d_1 / d) ** 2.0d0) / (w * h))) / (2.0d0 * w))
else
tmp = c0 * ((-0.5d0) * ((c0 * 0.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 <= 1.12e+24) || (!(d <= 2e+118) && (d <= 2.5e+270))) {
tmp = c0 * ((c0 * (Math.pow((d / D), 2.0) / (w * h))) / (2.0 * w));
} else {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (d <= 1.12e+24) or (not (d <= 2e+118) and (d <= 2.5e+270)): tmp = c0 * ((c0 * (math.pow((d / D), 2.0) / (w * h))) / (2.0 * w)) else: tmp = c0 * (-0.5 * ((c0 * 0.0) / w)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((d <= 1.12e+24) || (!(d <= 2e+118) && (d <= 2.5e+270))) tmp = Float64(c0 * Float64(Float64(c0 * Float64((Float64(d / D) ^ 2.0) / Float64(w * h))) / Float64(2.0 * w))); else tmp = Float64(c0 * Float64(-0.5 * Float64(Float64(c0 * 0.0) / w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((d <= 1.12e+24) || (~((d <= 2e+118)) && (d <= 2.5e+270))) tmp = c0 * ((c0 * (((d / D) ^ 2.0) / (w * h))) / (2.0 * w)); else tmp = c0 * (-0.5 * ((c0 * 0.0) / w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[d, 1.12e+24], And[N[Not[LessEqual[d, 2e+118]], $MachinePrecision], LessEqual[d, 2.5e+270]]], N[(c0 * N[(N[(c0 * N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(-0.5 * N[(N[(c0 * 0.0), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.12 \cdot 10^{+24} \lor \neg \left(d \leq 2 \cdot 10^{+118}\right) \land d \leq 2.5 \cdot 10^{+270}:\\
\;\;\;\;c0 \cdot \frac{c0 \cdot \frac{{\left(\frac{d}{D}\right)}^{2}}{w \cdot h}}{2 \cdot w}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(-0.5 \cdot \frac{c0 \cdot 0}{w}\right)\\
\end{array}
\end{array}
if d < 1.12e24 or 1.99999999999999993e118 < d < 2.49999999999999988e270Initial program 24.6%
Simplified37.9%
Taylor expanded in w around -inf 2.5%
distribute-lft-out2.5%
distribute-lft1-in2.5%
metadata-eval2.5%
associate-*r*2.9%
Simplified2.9%
add-sqr-sqrt2.9%
pow1/22.9%
pow1/22.9%
pow-prod-down5.5%
Applied egg-rr39.7%
unpow1/239.7%
div039.7%
Simplified39.7%
Taylor expanded in c0 around inf 31.2%
associate-/r*30.7%
associate-/l*31.2%
unpow231.2%
unpow231.2%
times-frac40.4%
unpow240.4%
associate-*r/41.3%
Simplified41.3%
if 1.12e24 < d < 1.99999999999999993e118 or 2.49999999999999988e270 < d Initial program 9.8%
Simplified22.1%
Taylor expanded in c0 around -inf 6.3%
associate-/l*6.3%
distribute-lft1-in6.3%
metadata-eval6.3%
associate-/r*3.3%
Simplified3.3%
associate-*r/3.3%
mul0-lft56.7%
Applied egg-rr56.7%
Final simplification43.3%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= d 8.6e+24) (not (<= d 4.9e+117))) (* c0 (/ (fma c0 (* d (/ d (* D (* w (* h D))))) M) (* 2.0 w))) (* c0 (* -0.5 (/ (* c0 0.0) w)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((d <= 8.6e+24) || !(d <= 4.9e+117)) {
tmp = c0 * (fma(c0, (d * (d / (D * (w * (h * D))))), M) / (2.0 * w));
} else {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
}
return tmp;
}
function code(c0, w, h, D, d, M) tmp = 0.0 if ((d <= 8.6e+24) || !(d <= 4.9e+117)) tmp = Float64(c0 * Float64(fma(c0, Float64(d * Float64(d / Float64(D * Float64(w * Float64(h * D))))), M) / Float64(2.0 * w))); else tmp = Float64(c0 * Float64(-0.5 * Float64(Float64(c0 * 0.0) / w))); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[d, 8.6e+24], N[Not[LessEqual[d, 4.9e+117]], $MachinePrecision]], N[(c0 * N[(N[(c0 * N[(d * N[(d / N[(D * N[(w * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + M), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(-0.5 * N[(N[(c0 * 0.0), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 8.6 \cdot 10^{+24} \lor \neg \left(d \leq 4.9 \cdot 10^{+117}\right):\\
\;\;\;\;c0 \cdot \frac{\mathsf{fma}\left(c0, d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}, M\right)}{2 \cdot w}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(-0.5 \cdot \frac{c0 \cdot 0}{w}\right)\\
\end{array}
\end{array}
if d < 8.59999999999999975e24 or 4.9000000000000001e117 < d Initial program 23.5%
Simplified37.1%
Taylor expanded in w around -inf 2.3%
distribute-lft-out2.3%
distribute-lft1-in2.3%
metadata-eval2.3%
associate-*r*2.8%
Simplified2.8%
add-sqr-sqrt2.8%
pow1/22.8%
pow1/22.8%
pow-prod-down5.3%
Applied egg-rr39.0%
unpow1/239.0%
div039.0%
Simplified39.0%
Taylor expanded in M around 0 41.3%
if 8.59999999999999975e24 < d < 4.9000000000000001e117Initial program 14.0%
Simplified23.0%
Taylor expanded in c0 around -inf 9.1%
associate-/l*9.1%
distribute-lft1-in9.1%
metadata-eval9.1%
associate-/r*4.7%
Simplified4.7%
associate-*r/4.7%
mul0-lft53.9%
Applied egg-rr53.9%
Final simplification42.4%
(FPCore (c0 w h D d M) :precision binary64 (if (<= M 4.8e+142) (* c0 (* -0.5 (/ (* c0 0.0) w))) (* c0 (* M (/ 0.5 w)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (M <= 4.8e+142) {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
} else {
tmp = c0 * (M * (0.5 / 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 (m <= 4.8d+142) then
tmp = c0 * ((-0.5d0) * ((c0 * 0.0d0) / w))
else
tmp = c0 * (m * (0.5d0 / 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 (M <= 4.8e+142) {
tmp = c0 * (-0.5 * ((c0 * 0.0) / w));
} else {
tmp = c0 * (M * (0.5 / w));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if M <= 4.8e+142: tmp = c0 * (-0.5 * ((c0 * 0.0) / w)) else: tmp = c0 * (M * (0.5 / w)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (M <= 4.8e+142) tmp = Float64(c0 * Float64(-0.5 * Float64(Float64(c0 * 0.0) / w))); else tmp = Float64(c0 * Float64(M * Float64(0.5 / w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (M <= 4.8e+142) tmp = c0 * (-0.5 * ((c0 * 0.0) / w)); else tmp = c0 * (M * (0.5 / w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 4.8e+142], N[(c0 * N[(-0.5 * N[(N[(c0 * 0.0), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(M * N[(0.5 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 4.8 \cdot 10^{+142}:\\
\;\;\;\;c0 \cdot \left(-0.5 \cdot \frac{c0 \cdot 0}{w}\right)\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(M \cdot \frac{0.5}{w}\right)\\
\end{array}
\end{array}
if M < 4.7999999999999998e142Initial program 25.7%
Simplified35.7%
Taylor expanded in c0 around -inf 2.6%
associate-/l*2.6%
distribute-lft1-in2.6%
metadata-eval2.6%
associate-/r*2.1%
Simplified2.1%
associate-*r/2.1%
mul0-lft31.5%
Applied egg-rr31.5%
if 4.7999999999999998e142 < M Initial program 0.0%
Simplified37.2%
Taylor expanded in w around -inf 0.0%
distribute-lft-out0.0%
distribute-lft1-in0.0%
metadata-eval0.0%
associate-*r*0.0%
Simplified0.0%
add-sqr-sqrt0.0%
pow1/20.0%
pow1/20.0%
pow-prod-down0.0%
Applied egg-rr37.2%
unpow1/237.2%
div037.2%
Simplified37.2%
Taylor expanded in c0 around 0 28.4%
associate-*r/28.4%
*-commutative28.4%
associate-*r/28.4%
Simplified28.4%
(FPCore (c0 w h D d M) :precision binary64 (* c0 (* M (/ 0.5 w))))
double code(double c0, double w, double h, double D, double d, double M) {
return c0 * (M * (0.5 / 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 * (m * (0.5d0 / w))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return c0 * (M * (0.5 / w));
}
def code(c0, w, h, D, d, M): return c0 * (M * (0.5 / w))
function code(c0, w, h, D, d, M) return Float64(c0 * Float64(M * Float64(0.5 / w))) end
function tmp = code(c0, w, h, D, d, M) tmp = c0 * (M * (0.5 / w)); end
code[c0_, w_, h_, D_, d_, M_] := N[(c0 * N[(M * N[(0.5 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c0 \cdot \left(M \cdot \frac{0.5}{w}\right)
\end{array}
Initial program 22.7%
Simplified35.9%
Taylor expanded in w around -inf 2.6%
distribute-lft-out2.6%
distribute-lft1-in2.6%
metadata-eval2.6%
associate-*r*3.0%
Simplified3.0%
add-sqr-sqrt3.0%
pow1/23.0%
pow1/23.0%
pow-prod-down5.3%
Applied egg-rr38.0%
unpow1/238.0%
div038.0%
Simplified38.0%
Taylor expanded in c0 around 0 15.6%
associate-*r/15.6%
*-commutative15.6%
associate-*r/15.6%
Simplified15.6%
(FPCore (c0 w h D d M) :precision binary64 (* M (/ (* c0 0.5) w)))
double code(double c0, double w, double h, double D, double d, double M) {
return M * ((c0 * 0.5) / 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 = m * ((c0 * 0.5d0) / w)
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return M * ((c0 * 0.5) / w);
}
def code(c0, w, h, D, d, M): return M * ((c0 * 0.5) / w)
function code(c0, w, h, D, d, M) return Float64(M * Float64(Float64(c0 * 0.5) / w)) end
function tmp = code(c0, w, h, D, d, M) tmp = M * ((c0 * 0.5) / w); end
code[c0_, w_, h_, D_, d_, M_] := N[(M * N[(N[(c0 * 0.5), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
M \cdot \frac{c0 \cdot 0.5}{w}
\end{array}
Initial program 22.7%
Simplified35.9%
Taylor expanded in w around -inf 2.6%
distribute-lft-out2.6%
distribute-lft1-in2.6%
metadata-eval2.6%
associate-*r*3.0%
Simplified3.0%
add-sqr-sqrt3.0%
pow1/23.0%
pow1/23.0%
pow-prod-down5.3%
Applied egg-rr38.0%
unpow1/238.0%
div038.0%
Simplified38.0%
Taylor expanded in c0 around 0 13.9%
*-commutative13.9%
associate-/l*13.8%
associate-*r*13.8%
associate-*l/13.8%
Simplified13.8%
herbie shell --seed 2024113
(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))))))