
(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 (pow (/ d D) 2.0))
(t_1 (* (/ d D) (sqrt (/ (/ c0 w) h))))
(t_2 (/ c0 (* 2.0 w)))
(t_3 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_4 (* t_2 (+ t_3 (sqrt (- (* t_3 t_3) (* M M))))))
(t_5 (* (/ c0 w) (/ t_0 h))))
(if (<= t_4 -5e-134)
(* (/ (/ c0 w) 2.0) (pow (hypot t_1 t_1) 2.0))
(if (<= t_4 0.0)
(/ (/ (* c0 (pow M 2.0)) (- t_5 (hypot M t_5))) (* 2.0 w))
(if (<= t_4 INFINITY)
(* t_2 (+ (/ (* (/ c0 w) t_0) h) (hypot (* t_0 (/ c0 (* w h))) M)))
(*
-0.5
(/ (/ (pow M 2.0) w) (- (/ (- t_0) (* w h)) (/ t_0 (* w h))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = pow((d / D), 2.0);
double t_1 = (d / D) * sqrt(((c0 / w) / h));
double t_2 = c0 / (2.0 * w);
double t_3 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_4 = t_2 * (t_3 + sqrt(((t_3 * t_3) - (M * M))));
double t_5 = (c0 / w) * (t_0 / h);
double tmp;
if (t_4 <= -5e-134) {
tmp = ((c0 / w) / 2.0) * pow(hypot(t_1, t_1), 2.0);
} else if (t_4 <= 0.0) {
tmp = ((c0 * pow(M, 2.0)) / (t_5 - hypot(M, t_5))) / (2.0 * w);
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_2 * ((((c0 / w) * t_0) / h) + hypot((t_0 * (c0 / (w * h))), M));
} else {
tmp = -0.5 * ((pow(M, 2.0) / w) / ((-t_0 / (w * h)) - (t_0 / (w * h))));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = Math.pow((d / D), 2.0);
double t_1 = (d / D) * Math.sqrt(((c0 / w) / h));
double t_2 = c0 / (2.0 * w);
double t_3 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_4 = t_2 * (t_3 + Math.sqrt(((t_3 * t_3) - (M * M))));
double t_5 = (c0 / w) * (t_0 / h);
double tmp;
if (t_4 <= -5e-134) {
tmp = ((c0 / w) / 2.0) * Math.pow(Math.hypot(t_1, t_1), 2.0);
} else if (t_4 <= 0.0) {
tmp = ((c0 * Math.pow(M, 2.0)) / (t_5 - Math.hypot(M, t_5))) / (2.0 * w);
} else if (t_4 <= Double.POSITIVE_INFINITY) {
tmp = t_2 * ((((c0 / w) * t_0) / h) + Math.hypot((t_0 * (c0 / (w * h))), M));
} else {
tmp = -0.5 * ((Math.pow(M, 2.0) / w) / ((-t_0 / (w * h)) - (t_0 / (w * h))));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = math.pow((d / D), 2.0) t_1 = (d / D) * math.sqrt(((c0 / w) / h)) t_2 = c0 / (2.0 * w) t_3 = (c0 * (d * d)) / ((D * D) * (w * h)) t_4 = t_2 * (t_3 + math.sqrt(((t_3 * t_3) - (M * M)))) t_5 = (c0 / w) * (t_0 / h) tmp = 0 if t_4 <= -5e-134: tmp = ((c0 / w) / 2.0) * math.pow(math.hypot(t_1, t_1), 2.0) elif t_4 <= 0.0: tmp = ((c0 * math.pow(M, 2.0)) / (t_5 - math.hypot(M, t_5))) / (2.0 * w) elif t_4 <= math.inf: tmp = t_2 * ((((c0 / w) * t_0) / h) + math.hypot((t_0 * (c0 / (w * h))), M)) else: tmp = -0.5 * ((math.pow(M, 2.0) / w) / ((-t_0 / (w * h)) - (t_0 / (w * h)))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(d / D) ^ 2.0 t_1 = Float64(Float64(d / D) * sqrt(Float64(Float64(c0 / w) / h))) t_2 = Float64(c0 / Float64(2.0 * w)) t_3 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) t_4 = Float64(t_2 * Float64(t_3 + sqrt(Float64(Float64(t_3 * t_3) - Float64(M * M))))) t_5 = Float64(Float64(c0 / w) * Float64(t_0 / h)) tmp = 0.0 if (t_4 <= -5e-134) tmp = Float64(Float64(Float64(c0 / w) / 2.0) * (hypot(t_1, t_1) ^ 2.0)); elseif (t_4 <= 0.0) tmp = Float64(Float64(Float64(c0 * (M ^ 2.0)) / Float64(t_5 - hypot(M, t_5))) / Float64(2.0 * w)); elseif (t_4 <= Inf) tmp = Float64(t_2 * Float64(Float64(Float64(Float64(c0 / w) * t_0) / h) + hypot(Float64(t_0 * Float64(c0 / Float64(w * h))), M))); else tmp = Float64(-0.5 * Float64(Float64((M ^ 2.0) / w) / Float64(Float64(Float64(-t_0) / Float64(w * h)) - Float64(t_0 / Float64(w * h))))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (d / D) ^ 2.0; t_1 = (d / D) * sqrt(((c0 / w) / h)); t_2 = c0 / (2.0 * w); t_3 = (c0 * (d * d)) / ((D * D) * (w * h)); t_4 = t_2 * (t_3 + sqrt(((t_3 * t_3) - (M * M)))); t_5 = (c0 / w) * (t_0 / h); tmp = 0.0; if (t_4 <= -5e-134) tmp = ((c0 / w) / 2.0) * (hypot(t_1, t_1) ^ 2.0); elseif (t_4 <= 0.0) tmp = ((c0 * (M ^ 2.0)) / (t_5 - hypot(M, t_5))) / (2.0 * w); elseif (t_4 <= Inf) tmp = t_2 * ((((c0 / w) * t_0) / h) + hypot((t_0 * (c0 / (w * h))), M)); else tmp = -0.5 * (((M ^ 2.0) / w) / ((-t_0 / (w * h)) - (t_0 / (w * h)))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[(d / D), $MachinePrecision] * N[Sqrt[N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 * N[(t$95$3 + N[Sqrt[N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(c0 / w), $MachinePrecision] * N[(t$95$0 / h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -5e-134], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[Power[N[Sqrt[t$95$1 ^ 2 + t$95$1 ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], N[(N[(N[(c0 * N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$5 - N[Sqrt[M ^ 2 + t$95$5 ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(t$95$2 * N[(N[(N[(N[(c0 / w), $MachinePrecision] * t$95$0), $MachinePrecision] / h), $MachinePrecision] + N[Sqrt[N[(t$95$0 * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2 + M ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(N[Power[M, 2.0], $MachinePrecision] / w), $MachinePrecision] / N[(N[((-t$95$0) / N[(w * h), $MachinePrecision]), $MachinePrecision] - N[(t$95$0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{2}\\
t_1 := \frac{d}{D} \cdot \sqrt{\frac{\frac{c0}{w}}{h}}\\
t_2 := \frac{c0}{2 \cdot w}\\
t_3 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_4 := t\_2 \cdot \left(t\_3 + \sqrt{t\_3 \cdot t\_3 - M \cdot M}\right)\\
t_5 := \frac{c0}{w} \cdot \frac{t\_0}{h}\\
\mathbf{if}\;t\_4 \leq -5 \cdot 10^{-134}:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot {\left(\mathsf{hypot}\left(t\_1, t\_1\right)\right)}^{2}\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;\frac{\frac{c0 \cdot {M}^{2}}{t\_5 - \mathsf{hypot}\left(M, t\_5\right)}}{2 \cdot w}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_2 \cdot \left(\frac{\frac{c0}{w} \cdot t\_0}{h} + \mathsf{hypot}\left(t\_0 \cdot \frac{c0}{w \cdot h}, M\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\frac{-t\_0}{w \cdot h} - \frac{t\_0}{w \cdot h}}\\
\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))))) < -5.0000000000000003e-134Initial program 81.3%
Simplified79.1%
times-frac82.2%
Applied egg-rr82.2%
associate-*r/79.2%
*-commutative79.2%
Simplified79.2%
Taylor expanded in c0 around -inf 1.2%
mul-1-neg1.2%
*-commutative1.2%
*-commutative1.2%
times-frac7.6%
*-commutative7.6%
Simplified7.6%
Applied egg-rr87.2%
unpow287.2%
associate-/r*87.3%
associate-/r*90.4%
Simplified90.4%
if -5.0000000000000003e-134 < (*.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))))) < -0.0Initial program 61.4%
+-commutative61.4%
+-commutative61.4%
times-frac48.7%
fma-neg48.7%
Simplified54.7%
Applied egg-rr40.7%
associate--r-53.5%
+-inverses53.6%
*-commutative53.6%
Simplified27.0%
Applied egg-rr54.5%
expm1-def67.3%
expm1-log1p67.3%
associate-/r*67.3%
associate-/r*67.3%
Simplified67.3%
associate-*l/67.3%
associate-/r*67.3%
associate-/r*67.3%
*-commutative67.3%
*-commutative67.3%
*-commutative67.3%
Applied egg-rr67.3%
associate-*r/67.2%
associate-*r/60.5%
*-commutative60.5%
times-frac60.5%
associate-*r/67.4%
*-commutative67.4%
times-frac74.2%
*-commutative74.2%
Simplified74.2%
if -0.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))))) < +inf.0Initial program 78.1%
+-commutative78.1%
+-commutative78.1%
times-frac77.9%
fma-neg77.9%
Simplified77.8%
associate-/r*77.9%
frac-times77.8%
*-commutative77.8%
associate-*r/77.9%
pow277.9%
Applied egg-rr77.9%
cancel-sign-sub-inv77.9%
pow277.9%
frac-times77.8%
pow277.8%
associate-/r*77.8%
*-commutative77.8%
unpow-prod-down66.9%
pow-pow66.9%
metadata-eval66.9%
associate-/r*66.9%
Applied egg-rr66.9%
add-sqr-sqrt66.9%
add-sqr-sqrt31.2%
hypot-def60.2%
*-commutative60.2%
sqrt-prod60.2%
unpow260.2%
sqrt-prod64.7%
add-sqr-sqrt64.7%
sqrt-pow171.0%
metadata-eval71.0%
add-sqr-sqrt71.0%
Applied egg-rr80.9%
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%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified1.3%
Applied egg-rr3.9%
associate--r-6.8%
+-inverses33.8%
*-commutative33.8%
Simplified27.1%
Applied egg-rr30.2%
expm1-def32.6%
expm1-log1p32.6%
associate-/r*30.3%
associate-/r*31.6%
Simplified31.6%
Taylor expanded in c0 around -inf 28.7%
associate-/r*28.4%
mul-1-neg28.4%
associate-/r*27.8%
unpow227.8%
associate-/l/28.4%
unpow228.4%
associate-*l/28.4%
associate-*r/28.5%
unpow228.5%
associate-/r*29.8%
Simplified40.0%
Final simplification55.3%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* (/ d D) (sqrt (/ (/ c0 w) h))))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (pow (/ d D) 2.0))
(t_3 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_4 (* t_1 (+ t_3 (sqrt (- (* t_3 t_3) (* M M)))))))
(if (<= t_4 -5e-134)
(* (/ (/ c0 w) 2.0) (pow (hypot t_0 t_0) 2.0))
(if (<= t_4 0.0)
(*
t_1
(/ (pow M 2.0) (+ M (/ (* c0 (pow d 2.0)) (* (* w h) (pow D 2.0))))))
(if (<= t_4 INFINITY)
(* t_1 (+ (/ (* (/ c0 w) t_2) h) (hypot (* t_2 (/ c0 (* w h))) M)))
(*
-0.5
(/ (/ (pow M 2.0) w) (- (/ (- t_2) (* w h)) (/ t_2 (* w h))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (d / D) * sqrt(((c0 / w) / h));
double t_1 = c0 / (2.0 * w);
double t_2 = pow((d / D), 2.0);
double t_3 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_4 = t_1 * (t_3 + sqrt(((t_3 * t_3) - (M * M))));
double tmp;
if (t_4 <= -5e-134) {
tmp = ((c0 / w) / 2.0) * pow(hypot(t_0, t_0), 2.0);
} else if (t_4 <= 0.0) {
tmp = t_1 * (pow(M, 2.0) / (M + ((c0 * pow(d, 2.0)) / ((w * h) * pow(D, 2.0)))));
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_1 * ((((c0 / w) * t_2) / h) + hypot((t_2 * (c0 / (w * h))), M));
} else {
tmp = -0.5 * ((pow(M, 2.0) / w) / ((-t_2 / (w * h)) - (t_2 / (w * h))));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (d / D) * Math.sqrt(((c0 / w) / h));
double t_1 = c0 / (2.0 * w);
double t_2 = Math.pow((d / D), 2.0);
double t_3 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_4 = t_1 * (t_3 + Math.sqrt(((t_3 * t_3) - (M * M))));
double tmp;
if (t_4 <= -5e-134) {
tmp = ((c0 / w) / 2.0) * Math.pow(Math.hypot(t_0, t_0), 2.0);
} else if (t_4 <= 0.0) {
tmp = t_1 * (Math.pow(M, 2.0) / (M + ((c0 * Math.pow(d, 2.0)) / ((w * h) * Math.pow(D, 2.0)))));
} else if (t_4 <= Double.POSITIVE_INFINITY) {
tmp = t_1 * ((((c0 / w) * t_2) / h) + Math.hypot((t_2 * (c0 / (w * h))), M));
} else {
tmp = -0.5 * ((Math.pow(M, 2.0) / w) / ((-t_2 / (w * h)) - (t_2 / (w * h))));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (d / D) * math.sqrt(((c0 / w) / h)) t_1 = c0 / (2.0 * w) t_2 = math.pow((d / D), 2.0) t_3 = (c0 * (d * d)) / ((D * D) * (w * h)) t_4 = t_1 * (t_3 + math.sqrt(((t_3 * t_3) - (M * M)))) tmp = 0 if t_4 <= -5e-134: tmp = ((c0 / w) / 2.0) * math.pow(math.hypot(t_0, t_0), 2.0) elif t_4 <= 0.0: tmp = t_1 * (math.pow(M, 2.0) / (M + ((c0 * math.pow(d, 2.0)) / ((w * h) * math.pow(D, 2.0))))) elif t_4 <= math.inf: tmp = t_1 * ((((c0 / w) * t_2) / h) + math.hypot((t_2 * (c0 / (w * h))), M)) else: tmp = -0.5 * ((math.pow(M, 2.0) / w) / ((-t_2 / (w * h)) - (t_2 / (w * h)))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(d / D) * sqrt(Float64(Float64(c0 / w) / h))) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(d / D) ^ 2.0 t_3 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) t_4 = Float64(t_1 * Float64(t_3 + sqrt(Float64(Float64(t_3 * t_3) - Float64(M * M))))) tmp = 0.0 if (t_4 <= -5e-134) tmp = Float64(Float64(Float64(c0 / w) / 2.0) * (hypot(t_0, t_0) ^ 2.0)); elseif (t_4 <= 0.0) tmp = Float64(t_1 * Float64((M ^ 2.0) / Float64(M + Float64(Float64(c0 * (d ^ 2.0)) / Float64(Float64(w * h) * (D ^ 2.0)))))); elseif (t_4 <= Inf) tmp = Float64(t_1 * Float64(Float64(Float64(Float64(c0 / w) * t_2) / h) + hypot(Float64(t_2 * Float64(c0 / Float64(w * h))), M))); else tmp = Float64(-0.5 * Float64(Float64((M ^ 2.0) / w) / Float64(Float64(Float64(-t_2) / Float64(w * h)) - Float64(t_2 / Float64(w * h))))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (d / D) * sqrt(((c0 / w) / h)); t_1 = c0 / (2.0 * w); t_2 = (d / D) ^ 2.0; t_3 = (c0 * (d * d)) / ((D * D) * (w * h)); t_4 = t_1 * (t_3 + sqrt(((t_3 * t_3) - (M * M)))); tmp = 0.0; if (t_4 <= -5e-134) tmp = ((c0 / w) / 2.0) * (hypot(t_0, t_0) ^ 2.0); elseif (t_4 <= 0.0) tmp = t_1 * ((M ^ 2.0) / (M + ((c0 * (d ^ 2.0)) / ((w * h) * (D ^ 2.0))))); elseif (t_4 <= Inf) tmp = t_1 * ((((c0 / w) * t_2) / h) + hypot((t_2 * (c0 / (w * h))), M)); else tmp = -0.5 * (((M ^ 2.0) / w) / ((-t_2 / (w * h)) - (t_2 / (w * h)))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(d / D), $MachinePrecision] * N[Sqrt[N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * N[(t$95$3 + N[Sqrt[N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -5e-134], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[Power[N[Sqrt[t$95$0 ^ 2 + t$95$0 ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], N[(t$95$1 * N[(N[Power[M, 2.0], $MachinePrecision] / N[(M + N[(N[(c0 * N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[Power[D, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(t$95$1 * N[(N[(N[(N[(c0 / w), $MachinePrecision] * t$95$2), $MachinePrecision] / h), $MachinePrecision] + N[Sqrt[N[(t$95$2 * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2 + M ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(N[(N[Power[M, 2.0], $MachinePrecision] / w), $MachinePrecision] / N[(N[((-t$95$2) / N[(w * h), $MachinePrecision]), $MachinePrecision] - N[(t$95$2 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{d}{D} \cdot \sqrt{\frac{\frac{c0}{w}}{h}}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := {\left(\frac{d}{D}\right)}^{2}\\
t_3 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_4 := t\_1 \cdot \left(t\_3 + \sqrt{t\_3 \cdot t\_3 - M \cdot M}\right)\\
\mathbf{if}\;t\_4 \leq -5 \cdot 10^{-134}:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot {\left(\mathsf{hypot}\left(t\_0, t\_0\right)\right)}^{2}\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;t\_1 \cdot \frac{{M}^{2}}{M + \frac{c0 \cdot {d}^{2}}{\left(w \cdot h\right) \cdot {D}^{2}}}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_1 \cdot \left(\frac{\frac{c0}{w} \cdot t\_2}{h} + \mathsf{hypot}\left(t\_2 \cdot \frac{c0}{w \cdot h}, M\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\frac{-t\_2}{w \cdot h} - \frac{t\_2}{w \cdot h}}\\
\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))))) < -5.0000000000000003e-134Initial program 81.3%
Simplified79.1%
times-frac82.2%
Applied egg-rr82.2%
associate-*r/79.2%
*-commutative79.2%
Simplified79.2%
Taylor expanded in c0 around -inf 1.2%
mul-1-neg1.2%
*-commutative1.2%
*-commutative1.2%
times-frac7.6%
*-commutative7.6%
Simplified7.6%
Applied egg-rr87.2%
unpow287.2%
associate-/r*87.3%
associate-/r*90.4%
Simplified90.4%
if -5.0000000000000003e-134 < (*.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))))) < -0.0Initial program 61.4%
+-commutative61.4%
+-commutative61.4%
times-frac48.7%
fma-neg48.7%
Simplified54.7%
Applied egg-rr40.7%
associate--r-53.5%
+-inverses53.6%
*-commutative53.6%
Simplified27.0%
Applied egg-rr54.5%
expm1-def67.3%
expm1-log1p67.3%
associate-/r*67.3%
associate-/r*67.3%
Simplified67.3%
Taylor expanded in M around -inf 70.1%
if -0.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))))) < +inf.0Initial program 78.1%
+-commutative78.1%
+-commutative78.1%
times-frac77.9%
fma-neg77.9%
Simplified77.8%
associate-/r*77.9%
frac-times77.8%
*-commutative77.8%
associate-*r/77.9%
pow277.9%
Applied egg-rr77.9%
cancel-sign-sub-inv77.9%
pow277.9%
frac-times77.8%
pow277.8%
associate-/r*77.8%
*-commutative77.8%
unpow-prod-down66.9%
pow-pow66.9%
metadata-eval66.9%
associate-/r*66.9%
Applied egg-rr66.9%
add-sqr-sqrt66.9%
add-sqr-sqrt31.2%
hypot-def60.2%
*-commutative60.2%
sqrt-prod60.2%
unpow260.2%
sqrt-prod64.7%
add-sqr-sqrt64.7%
sqrt-pow171.0%
metadata-eval71.0%
add-sqr-sqrt71.0%
Applied egg-rr80.9%
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%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified1.3%
Applied egg-rr3.9%
associate--r-6.8%
+-inverses33.8%
*-commutative33.8%
Simplified27.1%
Applied egg-rr30.2%
expm1-def32.6%
expm1-log1p32.6%
associate-/r*30.3%
associate-/r*31.6%
Simplified31.6%
Taylor expanded in c0 around -inf 28.7%
associate-/r*28.4%
mul-1-neg28.4%
associate-/r*27.8%
unpow227.8%
associate-/l/28.4%
unpow228.4%
associate-*l/28.4%
associate-*r/28.5%
unpow228.5%
associate-/r*29.8%
Simplified40.0%
Final simplification55.0%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (pow (/ d D) 2.0))
(t_1 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_2 (* (/ c0 (* 2.0 w)) (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))))
(if (<= t_2 INFINITY)
t_2
(* -0.5 (/ (/ (pow M 2.0) w) (- (/ (- t_0) (* w h)) (/ t_0 (* w h))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = pow((d / D), 2.0);
double t_1 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_2 = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = -0.5 * ((pow(M, 2.0) / w) / ((-t_0 / (w * h)) - (t_0 / (w * h))));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = Math.pow((d / D), 2.0);
double t_1 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_2 = (c0 / (2.0 * w)) * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = -0.5 * ((Math.pow(M, 2.0) / w) / ((-t_0 / (w * h)) - (t_0 / (w * h))));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = math.pow((d / D), 2.0) t_1 = (c0 * (d * d)) / ((D * D) * (w * h)) t_2 = (c0 / (2.0 * w)) * (t_1 + math.sqrt(((t_1 * t_1) - (M * M)))) tmp = 0 if t_2 <= math.inf: tmp = t_2 else: tmp = -0.5 * ((math.pow(M, 2.0) / w) / ((-t_0 / (w * h)) - (t_0 / (w * h)))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(d / D) ^ 2.0 t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) 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 <= Inf) tmp = t_2; else tmp = Float64(-0.5 * Float64(Float64((M ^ 2.0) / w) / Float64(Float64(Float64(-t_0) / Float64(w * h)) - Float64(t_0 / Float64(w * h))))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (d / D) ^ 2.0; t_1 = (c0 * (d * d)) / ((D * D) * (w * h)); t_2 = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M)))); tmp = 0.0; if (t_2 <= Inf) tmp = t_2; else tmp = -0.5 * (((M ^ 2.0) / w) / ((-t_0 / (w * h)) - (t_0 / (w * h)))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $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, Infinity], t$95$2, N[(-0.5 * N[(N[(N[Power[M, 2.0], $MachinePrecision] / w), $MachinePrecision] / N[(N[((-t$95$0) / N[(w * h), $MachinePrecision]), $MachinePrecision] - N[(t$95$0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{2}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\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 \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\frac{-t\_0}{w \cdot h} - \frac{t\_0}{w \cdot h}}\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 76.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%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified1.3%
Applied egg-rr3.9%
associate--r-6.8%
+-inverses33.8%
*-commutative33.8%
Simplified27.1%
Applied egg-rr30.2%
expm1-def32.6%
expm1-log1p32.6%
associate-/r*30.3%
associate-/r*31.6%
Simplified31.6%
Taylor expanded in c0 around -inf 28.7%
associate-/r*28.4%
mul-1-neg28.4%
associate-/r*27.8%
unpow227.8%
associate-/l/28.4%
unpow228.4%
associate-*l/28.4%
associate-*r/28.5%
unpow228.5%
associate-/r*29.8%
Simplified40.0%
Final simplification52.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (* c0 (* d d)) (* (* D D) (* w h))))
(t_1 (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
(if (<= t_1 INFINITY) t_1 0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((D * D) * (w * h));
double t_1 = (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((D * D) * (w * h)) t_1 = (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M)))) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h))) 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 = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((D * D) * (w * h)); t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = 0.0; 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[(D * D), $MachinePrecision] * N[(w * h), $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, 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\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}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 76.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%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified1.3%
Taylor expanded in c0 around -inf 2.5%
mul-1-neg2.5%
distribute-lft-in0.7%
Simplified36.9%
Taylor expanded in c0 around 0 38.5%
Final simplification52.0%
(FPCore (c0 w h D d M)
:precision binary64
(if (or (<= c0 -1.2e-115)
(not
(or (<= c0 3.3e-75) (and (not (<= c0 6.5e+98)) (<= c0 5.5e+144)))))
(* (/ (/ c0 w) 2.0) (* 2.0 (* (/ (/ c0 w) h) (* (/ d D) (/ d D)))))
0.0))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((c0 <= -1.2e-115) || !((c0 <= 3.3e-75) || (!(c0 <= 6.5e+98) && (c0 <= 5.5e+144)))) {
tmp = ((c0 / w) / 2.0) * (2.0 * (((c0 / w) / h) * ((d / D) * (d / D))));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if ((c0 <= (-1.2d-115)) .or. (.not. (c0 <= 3.3d-75) .or. (.not. (c0 <= 6.5d+98)) .and. (c0 <= 5.5d+144))) then
tmp = ((c0 / w) / 2.0d0) * (2.0d0 * (((c0 / w) / h) * ((d_1 / d) * (d_1 / d))))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((c0 <= -1.2e-115) || !((c0 <= 3.3e-75) || (!(c0 <= 6.5e+98) && (c0 <= 5.5e+144)))) {
tmp = ((c0 / w) / 2.0) * (2.0 * (((c0 / w) / h) * ((d / D) * (d / D))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (c0 <= -1.2e-115) or not ((c0 <= 3.3e-75) or (not (c0 <= 6.5e+98) and (c0 <= 5.5e+144))): tmp = ((c0 / w) / 2.0) * (2.0 * (((c0 / w) / h) * ((d / D) * (d / D)))) else: tmp = 0.0 return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((c0 <= -1.2e-115) || !((c0 <= 3.3e-75) || (!(c0 <= 6.5e+98) && (c0 <= 5.5e+144)))) tmp = Float64(Float64(Float64(c0 / w) / 2.0) * Float64(2.0 * Float64(Float64(Float64(c0 / w) / h) * Float64(Float64(d / D) * Float64(d / D))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((c0 <= -1.2e-115) || ~(((c0 <= 3.3e-75) || (~((c0 <= 6.5e+98)) && (c0 <= 5.5e+144))))) tmp = ((c0 / w) / 2.0) * (2.0 * (((c0 / w) / h) * ((d / D) * (d / D)))); else tmp = 0.0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[c0, -1.2e-115], N[Not[Or[LessEqual[c0, 3.3e-75], And[N[Not[LessEqual[c0, 6.5e+98]], $MachinePrecision], LessEqual[c0, 5.5e+144]]]], $MachinePrecision]], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(2.0 * N[(N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c0 \leq -1.2 \cdot 10^{-115} \lor \neg \left(c0 \leq 3.3 \cdot 10^{-75} \lor \neg \left(c0 \leq 6.5 \cdot 10^{+98}\right) \land c0 \leq 5.5 \cdot 10^{+144}\right):\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if c0 < -1.20000000000000011e-115 or 3.3e-75 < c0 < 6.4999999999999999e98 or 5.50000000000000022e144 < c0 Initial program 31.3%
Simplified40.5%
times-frac43.8%
Applied egg-rr43.8%
associate-*r/40.9%
*-commutative40.9%
Simplified40.9%
Taylor expanded in c0 around -inf 3.0%
mul-1-neg3.0%
*-commutative3.0%
*-commutative3.0%
times-frac4.7%
*-commutative4.7%
Simplified4.7%
associate-/r*4.5%
pow24.5%
fma-def4.9%
add-sqr-sqrt3.5%
sqrt-unprod38.7%
unpow238.7%
unpow238.7%
frac-times38.7%
pow238.7%
unpow238.7%
unpow238.7%
Applied egg-rr52.9%
count-252.9%
associate-/r*54.3%
Simplified54.3%
pow254.3%
Applied egg-rr54.3%
if -1.20000000000000011e-115 < c0 < 3.3e-75 or 6.4999999999999999e98 < c0 < 5.50000000000000022e144Initial program 16.1%
+-commutative16.1%
+-commutative16.1%
times-frac13.3%
fma-neg13.3%
Simplified16.2%
Taylor expanded in c0 around -inf 5.9%
mul-1-neg5.9%
distribute-lft-in4.5%
Simplified47.5%
Taylor expanded in c0 around 0 47.5%
Final simplification52.4%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (/ c0 w) h))
(t_1 (/ (/ c0 w) 2.0))
(t_2 (* t_1 (* 2.0 (* t_0 (* (/ d D) (/ d D)))))))
(if (<= c0 -1.5e-115)
t_2
(if (<= c0 2.25e-76)
0.0
(if (<= c0 7e+98)
t_2
(if (<= c0 3e+144)
0.0
(* t_1 (* 2.0 (* t_0 (/ (* d (/ d D)) D))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 / w) / h;
double t_1 = (c0 / w) / 2.0;
double t_2 = t_1 * (2.0 * (t_0 * ((d / D) * (d / D))));
double tmp;
if (c0 <= -1.5e-115) {
tmp = t_2;
} else if (c0 <= 2.25e-76) {
tmp = 0.0;
} else if (c0 <= 7e+98) {
tmp = t_2;
} else if (c0 <= 3e+144) {
tmp = 0.0;
} else {
tmp = t_1 * (2.0 * (t_0 * ((d * (d / 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (c0 / w) / h
t_1 = (c0 / w) / 2.0d0
t_2 = t_1 * (2.0d0 * (t_0 * ((d_1 / d) * (d_1 / d))))
if (c0 <= (-1.5d-115)) then
tmp = t_2
else if (c0 <= 2.25d-76) then
tmp = 0.0d0
else if (c0 <= 7d+98) then
tmp = t_2
else if (c0 <= 3d+144) then
tmp = 0.0d0
else
tmp = t_1 * (2.0d0 * (t_0 * ((d_1 * (d_1 / 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 / w) / h;
double t_1 = (c0 / w) / 2.0;
double t_2 = t_1 * (2.0 * (t_0 * ((d / D) * (d / D))));
double tmp;
if (c0 <= -1.5e-115) {
tmp = t_2;
} else if (c0 <= 2.25e-76) {
tmp = 0.0;
} else if (c0 <= 7e+98) {
tmp = t_2;
} else if (c0 <= 3e+144) {
tmp = 0.0;
} else {
tmp = t_1 * (2.0 * (t_0 * ((d * (d / D)) / D)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 / w) / h t_1 = (c0 / w) / 2.0 t_2 = t_1 * (2.0 * (t_0 * ((d / D) * (d / D)))) tmp = 0 if c0 <= -1.5e-115: tmp = t_2 elif c0 <= 2.25e-76: tmp = 0.0 elif c0 <= 7e+98: tmp = t_2 elif c0 <= 3e+144: tmp = 0.0 else: tmp = t_1 * (2.0 * (t_0 * ((d * (d / D)) / D))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 / w) / h) t_1 = Float64(Float64(c0 / w) / 2.0) t_2 = Float64(t_1 * Float64(2.0 * Float64(t_0 * Float64(Float64(d / D) * Float64(d / D))))) tmp = 0.0 if (c0 <= -1.5e-115) tmp = t_2; elseif (c0 <= 2.25e-76) tmp = 0.0; elseif (c0 <= 7e+98) tmp = t_2; elseif (c0 <= 3e+144) tmp = 0.0; else tmp = Float64(t_1 * Float64(2.0 * Float64(t_0 * Float64(Float64(d * Float64(d / D)) / D)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 / w) / h; t_1 = (c0 / w) / 2.0; t_2 = t_1 * (2.0 * (t_0 * ((d / D) * (d / D)))); tmp = 0.0; if (c0 <= -1.5e-115) tmp = t_2; elseif (c0 <= 2.25e-76) tmp = 0.0; elseif (c0 <= 7e+98) tmp = t_2; elseif (c0 <= 3e+144) tmp = 0.0; else tmp = t_1 * (2.0 * (t_0 * ((d * (d / D)) / D))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(2.0 * N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -1.5e-115], t$95$2, If[LessEqual[c0, 2.25e-76], 0.0, If[LessEqual[c0, 7e+98], t$95$2, If[LessEqual[c0, 3e+144], 0.0, N[(t$95$1 * N[(2.0 * N[(t$95$0 * N[(N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{c0}{w}}{h}\\
t_1 := \frac{\frac{c0}{w}}{2}\\
t_2 := t\_1 \cdot \left(2 \cdot \left(t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\
\mathbf{if}\;c0 \leq -1.5 \cdot 10^{-115}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;c0 \leq 2.25 \cdot 10^{-76}:\\
\;\;\;\;0\\
\mathbf{elif}\;c0 \leq 7 \cdot 10^{+98}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;c0 \leq 3 \cdot 10^{+144}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(2 \cdot \left(t\_0 \cdot \frac{d \cdot \frac{d}{D}}{D}\right)\right)\\
\end{array}
\end{array}
if c0 < -1.5000000000000001e-115 or 2.25e-76 < c0 < 7e98Initial program 30.3%
Simplified37.2%
times-frac40.7%
Applied egg-rr40.7%
associate-*r/38.4%
*-commutative38.4%
Simplified38.4%
Taylor expanded in c0 around -inf 3.8%
mul-1-neg3.8%
*-commutative3.8%
*-commutative3.8%
times-frac3.8%
*-commutative3.8%
Simplified3.8%
associate-/r*3.0%
pow23.0%
fma-def4.1%
add-sqr-sqrt3.0%
sqrt-unprod36.2%
unpow236.2%
unpow236.2%
frac-times36.2%
pow236.2%
unpow236.2%
unpow236.2%
Applied egg-rr50.1%
count-250.1%
associate-/r*51.1%
Simplified51.1%
pow251.1%
Applied egg-rr51.1%
if -1.5000000000000001e-115 < c0 < 2.25e-76 or 7e98 < c0 < 2.9999999999999999e144Initial program 16.1%
+-commutative16.1%
+-commutative16.1%
times-frac13.3%
fma-neg13.3%
Simplified16.2%
Taylor expanded in c0 around -inf 5.9%
mul-1-neg5.9%
distribute-lft-in4.5%
Simplified47.5%
Taylor expanded in c0 around 0 47.5%
if 2.9999999999999999e144 < c0 Initial program 35.0%
Simplified52.5%
times-frac55.0%
Applied egg-rr55.0%
associate-*r/50.0%
*-commutative50.0%
Simplified50.0%
Taylor expanded in c0 around -inf 0.4%
mul-1-neg0.4%
*-commutative0.4%
*-commutative0.4%
times-frac7.9%
*-commutative7.9%
Simplified7.9%
associate-/r*10.1%
pow210.1%
fma-def7.6%
add-sqr-sqrt5.1%
sqrt-unprod47.6%
unpow247.6%
unpow247.6%
frac-times47.6%
pow247.6%
unpow247.6%
unpow247.6%
Applied egg-rr63.2%
count-263.2%
associate-/r*66.0%
Simplified66.0%
pow266.0%
associate-*r/66.2%
Applied egg-rr66.2%
Final simplification52.5%
(FPCore (c0 w h D d M) :precision binary64 (if (<= M 3.25e+212) 0.0 (* -0.5 (/ (* c0 M) w))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (M <= 3.25e+212) {
tmp = 0.0;
} else {
tmp = -0.5 * ((c0 * M) / 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 <= 3.25d+212) then
tmp = 0.0d0
else
tmp = (-0.5d0) * ((c0 * m) / 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 <= 3.25e+212) {
tmp = 0.0;
} else {
tmp = -0.5 * ((c0 * M) / w);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if M <= 3.25e+212: tmp = 0.0 else: tmp = -0.5 * ((c0 * M) / w) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (M <= 3.25e+212) tmp = 0.0; else tmp = Float64(-0.5 * Float64(Float64(c0 * M) / w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (M <= 3.25e+212) tmp = 0.0; else tmp = -0.5 * ((c0 * M) / w); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 3.25e+212], 0.0, N[(-0.5 * N[(N[(c0 * M), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 3.25 \cdot 10^{+212}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c0 \cdot M}{w}\\
\end{array}
\end{array}
if M < 3.24999999999999999e212Initial program 27.9%
+-commutative27.9%
+-commutative27.9%
times-frac27.1%
fma-neg27.1%
Simplified28.4%
Taylor expanded in c0 around -inf 6.5%
mul-1-neg6.5%
distribute-lft-in5.3%
Simplified30.7%
Taylor expanded in c0 around 0 31.9%
if 3.24999999999999999e212 < M Initial program 0.0%
+-commutative0.0%
+-commutative0.0%
times-frac0.0%
fma-neg0.0%
Simplified0.0%
Applied egg-rr0.0%
associate--r-0.0%
+-inverses0.0%
*-commutative0.0%
Simplified0.0%
Applied egg-rr0.0%
expm1-def0.0%
expm1-log1p0.0%
associate-/r*0.0%
associate-/r*0.0%
Simplified0.0%
Taylor expanded in c0 around 0 3.9%
*-commutative3.9%
Simplified3.9%
Final simplification31.1%
(FPCore (c0 w h D d M) :precision binary64 (if (<= M 5.2e+80) 0.0 (* 0.5 (/ (* c0 M) w))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (M <= 5.2e+80) {
tmp = 0.0;
} else {
tmp = 0.5 * ((c0 * M) / 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 <= 5.2d+80) then
tmp = 0.0d0
else
tmp = 0.5d0 * ((c0 * m) / 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 <= 5.2e+80) {
tmp = 0.0;
} else {
tmp = 0.5 * ((c0 * M) / w);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if M <= 5.2e+80: tmp = 0.0 else: tmp = 0.5 * ((c0 * M) / w) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (M <= 5.2e+80) tmp = 0.0; else tmp = Float64(0.5 * Float64(Float64(c0 * M) / w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (M <= 5.2e+80) tmp = 0.0; else tmp = 0.5 * ((c0 * M) / w); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 5.2e+80], 0.0, N[(0.5 * N[(N[(c0 * M), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 5.2 \cdot 10^{+80}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{c0 \cdot M}{w}\\
\end{array}
\end{array}
if M < 5.19999999999999963e80Initial program 27.4%
+-commutative27.4%
+-commutative27.4%
times-frac26.5%
fma-neg26.5%
Simplified27.9%
Taylor expanded in c0 around -inf 7.2%
mul-1-neg7.2%
distribute-lft-in5.8%
Simplified32.9%
Taylor expanded in c0 around 0 34.1%
if 5.19999999999999963e80 < M Initial program 25.8%
+-commutative25.8%
+-commutative25.8%
times-frac25.8%
fma-neg25.8%
Simplified25.8%
Applied egg-rr0.0%
associate--r-0.0%
+-inverses3.6%
*-commutative3.6%
Simplified3.6%
Applied egg-rr3.4%
expm1-def3.4%
expm1-log1p6.6%
associate-/r*6.6%
associate-/r*6.6%
Simplified6.6%
Taylor expanded in M around -inf 27.3%
*-commutative27.3%
Simplified27.3%
Final simplification33.3%
(FPCore (c0 w h D d M) :precision binary64 0.0)
double code(double c0, double w, double h, double D, double d, double M) {
return 0.0;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = 0.0d0
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return 0.0;
}
def code(c0, w, h, D, d, M): return 0.0
function code(c0, w, h, D, d, M) return 0.0 end
function tmp = code(c0, w, h, D, d, M) tmp = 0.0; end
code[c0_, w_, h_, D_, d_, M_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 27.2%
+-commutative27.2%
+-commutative27.2%
times-frac26.4%
fma-neg26.4%
Simplified27.6%
Taylor expanded in c0 around -inf 6.3%
mul-1-neg6.3%
distribute-lft-in5.1%
Simplified29.9%
Taylor expanded in c0 around 0 31.1%
Final simplification31.1%
herbie shell --seed 2024027
(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))))))