
(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 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (c0 w h D d M) :precision binary64 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))) (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) end
function tmp = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)
\end{array}
\end{array}
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_1 (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
(if (<= t_1 INFINITY)
t_1
(fma -0.5 (/ 0.0 w) (* 0.25 (* (/ D (/ d D)) (/ (* h (* M M)) d)))))))
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 = fma(-0.5, (0.0 / w), (0.25 * ((D / (d / D)) * ((h * (M * M)) / d))));
}
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 = fma(-0.5, Float64(0.0 / w), Float64(0.25 * Float64(Float64(D / Float64(d / D)) * Float64(Float64(h * Float64(M * M)) / d)))); end return 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[(-0.5 * N[(0.0 / w), $MachinePrecision] + N[(0.25 * N[(N[(D / N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{0}{w}, 0.25 \cdot \left(\frac{D}{\frac{d}{D}} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\right)\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 82.2%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
associate-*l/0.6%
*-commutative0.6%
fma-def0.6%
associate-*l*0.6%
*-commutative0.6%
associate-*r*0.6%
associate-*l*0.7%
*-commutative0.7%
Simplified5.3%
Taylor expanded in c0 around -inf 1.8%
fma-def1.8%
*-commutative1.8%
unpow21.8%
distribute-rgt1-in1.8%
metadata-eval1.8%
mul0-lft30.9%
associate-/l*31.5%
unpow231.5%
unpow231.5%
*-commutative31.5%
unpow231.5%
Simplified31.5%
associate-/r/30.8%
Applied egg-rr30.8%
Taylor expanded in D around 0 30.9%
*-commutative30.9%
unpow230.9%
unpow230.9%
times-frac34.6%
unpow234.6%
associate-/l*39.2%
Simplified39.2%
Taylor expanded in c0 around 0 57.3%
Final simplification65.3%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0
(fma -0.5 (/ 0.0 w) (* 0.25 (* (/ D (/ d D)) (/ (* h (* M M)) d))))))
(if (<= c0 -2.1e+214)
(/ c0 (/ w (* (pow (/ d D) 2.0) (/ (/ c0 h) w))))
(if (<= c0 -1.35e+154)
t_0
(if (<= c0 2.2e+44)
(fma
-0.5
(/ (* 0.0 (* c0 c0)) w)
(* 0.25 (/ (* D (/ h (/ d (* M M)))) (/ d D))))
(if (<= c0 7.2e+154)
(/ (* c0 (* (* 2.0 (/ c0 h)) (/ (* (/ d D) (/ d D)) w))) (* 2.0 w))
(if (<= c0 1.75e+226)
t_0
(/
(* 2.0 (/ (* d (* d (* c0 c0))) (* D (* (* w h) D))))
(* 2.0 w)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = fma(-0.5, (0.0 / w), (0.25 * ((D / (d / D)) * ((h * (M * M)) / d))));
double tmp;
if (c0 <= -2.1e+214) {
tmp = c0 / (w / (pow((d / D), 2.0) * ((c0 / h) / w)));
} else if (c0 <= -1.35e+154) {
tmp = t_0;
} else if (c0 <= 2.2e+44) {
tmp = fma(-0.5, ((0.0 * (c0 * c0)) / w), (0.25 * ((D * (h / (d / (M * M)))) / (d / D))));
} else if (c0 <= 7.2e+154) {
tmp = (c0 * ((2.0 * (c0 / h)) * (((d / D) * (d / D)) / w))) / (2.0 * w);
} else if (c0 <= 1.75e+226) {
tmp = t_0;
} else {
tmp = (2.0 * ((d * (d * (c0 * c0))) / (D * ((w * h) * D)))) / (2.0 * w);
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = fma(-0.5, Float64(0.0 / w), Float64(0.25 * Float64(Float64(D / Float64(d / D)) * Float64(Float64(h * Float64(M * M)) / d)))) tmp = 0.0 if (c0 <= -2.1e+214) tmp = Float64(c0 / Float64(w / Float64((Float64(d / D) ^ 2.0) * Float64(Float64(c0 / h) / w)))); elseif (c0 <= -1.35e+154) tmp = t_0; elseif (c0 <= 2.2e+44) tmp = fma(-0.5, Float64(Float64(0.0 * Float64(c0 * c0)) / w), Float64(0.25 * Float64(Float64(D * Float64(h / Float64(d / Float64(M * M)))) / Float64(d / D)))); elseif (c0 <= 7.2e+154) tmp = Float64(Float64(c0 * Float64(Float64(2.0 * Float64(c0 / h)) * Float64(Float64(Float64(d / D) * Float64(d / D)) / w))) / Float64(2.0 * w)); elseif (c0 <= 1.75e+226) tmp = t_0; else tmp = Float64(Float64(2.0 * Float64(Float64(d * Float64(d * Float64(c0 * c0))) / Float64(D * Float64(Float64(w * h) * D)))) / Float64(2.0 * w)); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(-0.5 * N[(0.0 / w), $MachinePrecision] + N[(0.25 * N[(N[(D / N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -2.1e+214], N[(c0 / N[(w / N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, -1.35e+154], t$95$0, If[LessEqual[c0, 2.2e+44], N[(-0.5 * N[(N[(0.0 * N[(c0 * c0), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision] + N[(0.25 * N[(N[(D * N[(h / N[(d / N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 7.2e+154], N[(N[(c0 * N[(N[(2.0 * N[(c0 / h), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 1.75e+226], t$95$0, N[(N[(2.0 * N[(N[(d * N[(d * N[(c0 * c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(D * N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-0.5, \frac{0}{w}, 0.25 \cdot \left(\frac{D}{\frac{d}{D}} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\right)\right)\\
\mathbf{if}\;c0 \leq -2.1 \cdot 10^{+214}:\\
\;\;\;\;\frac{c0}{\frac{w}{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{\frac{c0}{h}}{w}}}\\
\mathbf{elif}\;c0 \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c0 \leq 2.2 \cdot 10^{+44}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{0 \cdot \left(c0 \cdot c0\right)}{w}, 0.25 \cdot \frac{D \cdot \frac{h}{\frac{d}{M \cdot M}}}{\frac{d}{D}}\right)\\
\mathbf{elif}\;c0 \leq 7.2 \cdot 10^{+154}:\\
\;\;\;\;\frac{c0 \cdot \left(\left(2 \cdot \frac{c0}{h}\right) \cdot \frac{\frac{d}{D} \cdot \frac{d}{D}}{w}\right)}{2 \cdot w}\\
\mathbf{elif}\;c0 \leq 1.75 \cdot 10^{+226}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{d \cdot \left(d \cdot \left(c0 \cdot c0\right)\right)}{D \cdot \left(\left(w \cdot h\right) \cdot D\right)}}{2 \cdot w}\\
\end{array}
\end{array}
if c0 < -2.1000000000000001e214Initial program 26.7%
associate-*l*23.5%
difference-of-squares30.2%
associate-*l*30.2%
associate-*l*46.7%
Simplified46.7%
flip-+3.3%
Applied egg-rr3.3%
unpow23.3%
associate--r-3.3%
+-inverses13.5%
unpow213.5%
associate-/l/10.2%
associate-/l/6.8%
Simplified6.8%
Taylor expanded in M around 0 34.2%
associate-/r*34.3%
*-commutative34.3%
associate-*r/34.3%
unpow234.3%
unpow234.3%
times-frac37.7%
unpow237.7%
*-commutative37.7%
times-frac47.9%
Simplified47.9%
associate-*l/47.9%
associate-*r*47.9%
Applied egg-rr47.9%
associate-/l*51.1%
associate-*l*51.1%
times-frac37.7%
*-commutative37.7%
times-frac51.1%
unpow251.1%
times-frac47.7%
unpow247.7%
unpow247.7%
associate-/r*47.7%
unpow247.7%
*-commutative47.7%
unpow247.7%
times-frac47.7%
metadata-eval47.7%
Simplified54.5%
if -2.1000000000000001e214 < c0 < -1.35000000000000003e154 or 7.2000000000000001e154 < c0 < 1.7499999999999999e226Initial program 28.7%
associate-*l/25.9%
*-commutative25.9%
fma-def23.1%
associate-*l*23.1%
*-commutative23.1%
associate-*r*23.1%
associate-*l*23.1%
*-commutative23.1%
Simplified23.2%
Taylor expanded in c0 around -inf 0.0%
fma-def0.0%
*-commutative0.0%
unpow20.0%
distribute-rgt1-in0.0%
metadata-eval0.0%
mul0-lft0.0%
associate-/l*0.0%
unpow20.0%
unpow20.0%
*-commutative0.0%
unpow20.0%
Simplified0.0%
associate-/r/0.0%
Applied egg-rr0.0%
Taylor expanded in D around 0 0.0%
*-commutative0.0%
unpow20.0%
unpow20.0%
times-frac0.0%
unpow20.0%
associate-/l*0.0%
Simplified0.0%
Taylor expanded in c0 around 0 69.3%
if -1.35000000000000003e154 < c0 < 2.19999999999999996e44Initial program 20.0%
associate-*l/20.0%
*-commutative20.0%
fma-def18.6%
associate-*l*18.0%
*-commutative18.0%
associate-*r*18.0%
associate-*l*18.1%
*-commutative18.1%
Simplified19.3%
Taylor expanded in c0 around -inf 7.7%
fma-def7.7%
*-commutative7.7%
unpow27.7%
distribute-rgt1-in7.7%
metadata-eval7.7%
mul0-lft41.1%
associate-/l*41.8%
unpow241.8%
unpow241.8%
*-commutative41.8%
unpow241.8%
Simplified41.8%
associate-/r/41.0%
Applied egg-rr41.0%
Taylor expanded in D around 0 41.1%
*-commutative41.1%
unpow241.1%
unpow241.1%
times-frac45.5%
unpow245.5%
associate-/l*50.8%
Simplified50.8%
associate-*l/53.6%
associate-/l*54.9%
Applied egg-rr54.9%
if 2.19999999999999996e44 < c0 < 7.2000000000000001e154Initial program 43.5%
associate-*l*43.5%
difference-of-squares52.2%
associate-*l*52.2%
associate-*l*56.5%
Simplified56.5%
flip-+0.0%
Applied egg-rr0.3%
unpow20.3%
associate--r-0.8%
+-inverses13.8%
unpow213.8%
associate-/l/13.5%
associate-/l/13.8%
Simplified13.8%
Taylor expanded in M around 0 52.8%
associate-/r*52.8%
*-commutative52.8%
associate-*r/52.7%
unpow252.7%
unpow252.7%
times-frac61.4%
unpow261.4%
*-commutative61.4%
times-frac65.8%
Simplified65.8%
associate-*l/65.9%
associate-*r*65.9%
Applied egg-rr65.9%
unpow265.8%
Applied egg-rr65.9%
if 1.7499999999999999e226 < c0 Initial program 47.5%
associate-*l*47.5%
difference-of-squares52.3%
associate-*l*52.3%
associate-*l*52.3%
Simplified52.3%
flip-+0.0%
Applied egg-rr0.0%
unpow20.0%
associate--r-0.0%
+-inverses14.5%
unpow214.5%
associate-/l/14.8%
associate-/l/14.9%
Simplified14.9%
Taylor expanded in M around 0 57.7%
associate-/r*57.7%
*-commutative57.7%
associate-*r/52.9%
unpow252.9%
unpow252.9%
times-frac62.5%
unpow262.5%
*-commutative62.5%
times-frac57.7%
Simplified57.7%
associate-*l/57.8%
associate-*r*57.8%
Applied egg-rr57.8%
Taylor expanded in c0 around 0 53.0%
unpow253.0%
associate-*l*58.0%
unpow258.0%
unpow258.0%
associate-*r*62.8%
Simplified62.8%
Final simplification58.5%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0
(fma -0.5 (/ 0.0 w) (* 0.25 (* (/ D (/ d D)) (/ (* h (* M M)) d))))))
(if (<= c0 -4.2e+217)
(/ c0 (/ w (* (pow (/ d D) 2.0) (/ (/ c0 h) w))))
(if (<= c0 1.35e+46)
t_0
(if (<= c0 1.9e+155)
(/ (* c0 (* (* 2.0 (/ c0 h)) (/ (* (/ d D) (/ d D)) w))) (* 2.0 w))
(if (<= c0 1.35e+228)
t_0
(/
(* 2.0 (/ (* d (* d (* c0 c0))) (* D (* (* w h) D))))
(* 2.0 w))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = fma(-0.5, (0.0 / w), (0.25 * ((D / (d / D)) * ((h * (M * M)) / d))));
double tmp;
if (c0 <= -4.2e+217) {
tmp = c0 / (w / (pow((d / D), 2.0) * ((c0 / h) / w)));
} else if (c0 <= 1.35e+46) {
tmp = t_0;
} else if (c0 <= 1.9e+155) {
tmp = (c0 * ((2.0 * (c0 / h)) * (((d / D) * (d / D)) / w))) / (2.0 * w);
} else if (c0 <= 1.35e+228) {
tmp = t_0;
} else {
tmp = (2.0 * ((d * (d * (c0 * c0))) / (D * ((w * h) * D)))) / (2.0 * w);
}
return tmp;
}
function code(c0, w, h, D, d, M) t_0 = fma(-0.5, Float64(0.0 / w), Float64(0.25 * Float64(Float64(D / Float64(d / D)) * Float64(Float64(h * Float64(M * M)) / d)))) tmp = 0.0 if (c0 <= -4.2e+217) tmp = Float64(c0 / Float64(w / Float64((Float64(d / D) ^ 2.0) * Float64(Float64(c0 / h) / w)))); elseif (c0 <= 1.35e+46) tmp = t_0; elseif (c0 <= 1.9e+155) tmp = Float64(Float64(c0 * Float64(Float64(2.0 * Float64(c0 / h)) * Float64(Float64(Float64(d / D) * Float64(d / D)) / w))) / Float64(2.0 * w)); elseif (c0 <= 1.35e+228) tmp = t_0; else tmp = Float64(Float64(2.0 * Float64(Float64(d * Float64(d * Float64(c0 * c0))) / Float64(D * Float64(Float64(w * h) * D)))) / Float64(2.0 * w)); end return tmp end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(-0.5 * N[(0.0 / w), $MachinePrecision] + N[(0.25 * N[(N[(D / N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -4.2e+217], N[(c0 / N[(w / N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 1.35e+46], t$95$0, If[LessEqual[c0, 1.9e+155], N[(N[(c0 * N[(N[(2.0 * N[(c0 / h), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 1.35e+228], t$95$0, N[(N[(2.0 * N[(N[(d * N[(d * N[(c0 * c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(D * N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-0.5, \frac{0}{w}, 0.25 \cdot \left(\frac{D}{\frac{d}{D}} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}\right)\right)\\
\mathbf{if}\;c0 \leq -4.2 \cdot 10^{+217}:\\
\;\;\;\;\frac{c0}{\frac{w}{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{\frac{c0}{h}}{w}}}\\
\mathbf{elif}\;c0 \leq 1.35 \cdot 10^{+46}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;c0 \leq 1.9 \cdot 10^{+155}:\\
\;\;\;\;\frac{c0 \cdot \left(\left(2 \cdot \frac{c0}{h}\right) \cdot \frac{\frac{d}{D} \cdot \frac{d}{D}}{w}\right)}{2 \cdot w}\\
\mathbf{elif}\;c0 \leq 1.35 \cdot 10^{+228}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{d \cdot \left(d \cdot \left(c0 \cdot c0\right)\right)}{D \cdot \left(\left(w \cdot h\right) \cdot D\right)}}{2 \cdot w}\\
\end{array}
\end{array}
if c0 < -4.2000000000000002e217Initial program 26.7%
associate-*l*23.5%
difference-of-squares30.2%
associate-*l*30.2%
associate-*l*46.7%
Simplified46.7%
flip-+3.3%
Applied egg-rr3.3%
unpow23.3%
associate--r-3.3%
+-inverses13.5%
unpow213.5%
associate-/l/10.2%
associate-/l/6.8%
Simplified6.8%
Taylor expanded in M around 0 34.2%
associate-/r*34.3%
*-commutative34.3%
associate-*r/34.3%
unpow234.3%
unpow234.3%
times-frac37.7%
unpow237.7%
*-commutative37.7%
times-frac47.9%
Simplified47.9%
associate-*l/47.9%
associate-*r*47.9%
Applied egg-rr47.9%
associate-/l*51.1%
associate-*l*51.1%
times-frac37.7%
*-commutative37.7%
times-frac51.1%
unpow251.1%
times-frac47.7%
unpow247.7%
unpow247.7%
associate-/r*47.7%
unpow247.7%
*-commutative47.7%
unpow247.7%
times-frac47.7%
metadata-eval47.7%
Simplified54.5%
if -4.2000000000000002e217 < c0 < 1.3500000000000001e46 or 1.9e155 < c0 < 1.3500000000000001e228Initial program 21.7%
associate-*l/21.1%
*-commutative21.1%
fma-def19.5%
associate-*l*19.0%
*-commutative19.0%
associate-*r*19.0%
associate-*l*19.0%
*-commutative19.0%
Simplified20.0%
Taylor expanded in c0 around -inf 6.2%
fma-def6.2%
*-commutative6.2%
unpow26.2%
distribute-rgt1-in6.2%
metadata-eval6.2%
mul0-lft33.2%
associate-/l*33.7%
unpow233.7%
unpow233.7%
*-commutative33.7%
unpow233.7%
Simplified33.7%
associate-/r/33.1%
Applied egg-rr33.1%
Taylor expanded in D around 0 33.2%
*-commutative33.2%
unpow233.2%
unpow233.2%
times-frac36.7%
unpow236.7%
associate-/l*41.1%
Simplified41.1%
Taylor expanded in c0 around 0 54.4%
if 1.3500000000000001e46 < c0 < 1.9e155Initial program 43.5%
associate-*l*43.5%
difference-of-squares52.2%
associate-*l*52.2%
associate-*l*56.5%
Simplified56.5%
flip-+0.0%
Applied egg-rr0.3%
unpow20.3%
associate--r-0.8%
+-inverses13.8%
unpow213.8%
associate-/l/13.5%
associate-/l/13.8%
Simplified13.8%
Taylor expanded in M around 0 52.8%
associate-/r*52.8%
*-commutative52.8%
associate-*r/52.7%
unpow252.7%
unpow252.7%
times-frac61.4%
unpow261.4%
*-commutative61.4%
times-frac65.8%
Simplified65.8%
associate-*l/65.9%
associate-*r*65.9%
Applied egg-rr65.9%
unpow265.8%
Applied egg-rr65.9%
if 1.3500000000000001e228 < c0 Initial program 47.5%
associate-*l*47.5%
difference-of-squares52.3%
associate-*l*52.3%
associate-*l*52.3%
Simplified52.3%
flip-+0.0%
Applied egg-rr0.0%
unpow20.0%
associate--r-0.0%
+-inverses14.5%
unpow214.5%
associate-/l/14.8%
associate-/l/14.9%
Simplified14.9%
Taylor expanded in M around 0 57.7%
associate-/r*57.7%
*-commutative57.7%
associate-*r/52.9%
unpow252.9%
unpow252.9%
times-frac62.5%
unpow262.5%
*-commutative62.5%
times-frac57.7%
Simplified57.7%
associate-*l/57.8%
associate-*r*57.8%
Applied egg-rr57.8%
Taylor expanded in c0 around 0 53.0%
unpow253.0%
associate-*l*58.0%
unpow258.0%
unpow258.0%
associate-*r*62.8%
Simplified62.8%
Final simplification56.1%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* -0.5 (/ 0.0 w))))
(if (<= (* M M) 2.7e-155)
t_0
(if (<= (* M M) 1.65e+50)
(/ (* 2.0 (/ (* d (* d (* c0 c0))) (* D (* (* w h) D)))) (* 2.0 w))
(if (<= (* M M) 5e+130)
t_0
(/
(* c0 (* (* 2.0 (/ c0 h)) (/ (* (/ d D) (/ d D)) w)))
(* 2.0 w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = -0.5 * (0.0 / w);
double tmp;
if ((M * M) <= 2.7e-155) {
tmp = t_0;
} else if ((M * M) <= 1.65e+50) {
tmp = (2.0 * ((d * (d * (c0 * c0))) / (D * ((w * h) * D)))) / (2.0 * w);
} else if ((M * M) <= 5e+130) {
tmp = t_0;
} else {
tmp = (c0 * ((2.0 * (c0 / h)) * (((d / D) * (d / D)) / w))) / (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 = (-0.5d0) * (0.0d0 / w)
if ((m * m) <= 2.7d-155) then
tmp = t_0
else if ((m * m) <= 1.65d+50) then
tmp = (2.0d0 * ((d_1 * (d_1 * (c0 * c0))) / (d * ((w * h) * d)))) / (2.0d0 * w)
else if ((m * m) <= 5d+130) then
tmp = t_0
else
tmp = (c0 * ((2.0d0 * (c0 / h)) * (((d_1 / d) * (d_1 / d)) / w))) / (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 = -0.5 * (0.0 / w);
double tmp;
if ((M * M) <= 2.7e-155) {
tmp = t_0;
} else if ((M * M) <= 1.65e+50) {
tmp = (2.0 * ((d * (d * (c0 * c0))) / (D * ((w * h) * D)))) / (2.0 * w);
} else if ((M * M) <= 5e+130) {
tmp = t_0;
} else {
tmp = (c0 * ((2.0 * (c0 / h)) * (((d / D) * (d / D)) / w))) / (2.0 * w);
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = -0.5 * (0.0 / w) tmp = 0 if (M * M) <= 2.7e-155: tmp = t_0 elif (M * M) <= 1.65e+50: tmp = (2.0 * ((d * (d * (c0 * c0))) / (D * ((w * h) * D)))) / (2.0 * w) elif (M * M) <= 5e+130: tmp = t_0 else: tmp = (c0 * ((2.0 * (c0 / h)) * (((d / D) * (d / D)) / w))) / (2.0 * w) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(-0.5 * Float64(0.0 / w)) tmp = 0.0 if (Float64(M * M) <= 2.7e-155) tmp = t_0; elseif (Float64(M * M) <= 1.65e+50) tmp = Float64(Float64(2.0 * Float64(Float64(d * Float64(d * Float64(c0 * c0))) / Float64(D * Float64(Float64(w * h) * D)))) / Float64(2.0 * w)); elseif (Float64(M * M) <= 5e+130) tmp = t_0; else tmp = Float64(Float64(c0 * Float64(Float64(2.0 * Float64(c0 / h)) * Float64(Float64(Float64(d / D) * Float64(d / D)) / w))) / Float64(2.0 * w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = -0.5 * (0.0 / w); tmp = 0.0; if ((M * M) <= 2.7e-155) tmp = t_0; elseif ((M * M) <= 1.65e+50) tmp = (2.0 * ((d * (d * (c0 * c0))) / (D * ((w * h) * D)))) / (2.0 * w); elseif ((M * M) <= 5e+130) tmp = t_0; else tmp = (c0 * ((2.0 * (c0 / h)) * (((d / D) * (d / D)) / w))) / (2.0 * w); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(-0.5 * N[(0.0 / w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(M * M), $MachinePrecision], 2.7e-155], t$95$0, If[LessEqual[N[(M * M), $MachinePrecision], 1.65e+50], N[(N[(2.0 * N[(N[(d * N[(d * N[(c0 * c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(D * N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(M * M), $MachinePrecision], 5e+130], t$95$0, N[(N[(c0 * N[(N[(2.0 * N[(c0 / h), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.5 \cdot \frac{0}{w}\\
\mathbf{if}\;M \cdot M \leq 2.7 \cdot 10^{-155}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;M \cdot M \leq 1.65 \cdot 10^{+50}:\\
\;\;\;\;\frac{2 \cdot \frac{d \cdot \left(d \cdot \left(c0 \cdot c0\right)\right)}{D \cdot \left(\left(w \cdot h\right) \cdot D\right)}}{2 \cdot w}\\
\mathbf{elif}\;M \cdot M \leq 5 \cdot 10^{+130}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \left(\left(2 \cdot \frac{c0}{h}\right) \cdot \frac{\frac{d}{D} \cdot \frac{d}{D}}{w}\right)}{2 \cdot w}\\
\end{array}
\end{array}
if (*.f64 M M) < 2.69999999999999981e-155 or 1.65e50 < (*.f64 M M) < 4.9999999999999996e130Initial program 29.5%
associate-*l*26.7%
difference-of-squares26.7%
associate-*l*28.2%
associate-*l*32.4%
Simplified32.4%
Taylor expanded in c0 around -inf 5.5%
*-commutative5.5%
unpow25.5%
distribute-rgt1-in5.5%
metadata-eval5.5%
mul0-lft34.6%
Simplified34.6%
Taylor expanded in c0 around 0 52.4%
if 2.69999999999999981e-155 < (*.f64 M M) < 1.65e50Initial program 39.3%
associate-*l*39.3%
difference-of-squares39.3%
associate-*l*39.3%
associate-*l*41.7%
Simplified41.7%
flip-+0.1%
Applied egg-rr0.2%
unpow20.2%
associate--r-7.4%
+-inverses17.8%
unpow217.8%
associate-/l/18.0%
associate-/l/20.4%
Simplified20.4%
Taylor expanded in M around 0 44.5%
associate-/r*44.6%
*-commutative44.6%
associate-*r/42.2%
unpow242.2%
unpow242.2%
times-frac45.0%
unpow245.0%
*-commutative45.0%
times-frac47.2%
Simplified47.2%
associate-*l/47.4%
associate-*r*47.4%
Applied egg-rr47.4%
Taylor expanded in c0 around 0 41.9%
unpow241.9%
associate-*l*49.6%
unpow249.6%
unpow249.6%
associate-*r*54.7%
Simplified54.7%
if 4.9999999999999996e130 < (*.f64 M M) Initial program 14.7%
associate-*l*14.7%
difference-of-squares33.2%
associate-*l*33.2%
associate-*l*36.8%
Simplified36.8%
flip-+0.0%
Applied egg-rr0.0%
unpow20.0%
associate--r-1.2%
+-inverses6.8%
unpow26.8%
associate-/l/6.8%
associate-/l/6.8%
Simplified6.8%
Taylor expanded in M around 0 38.0%
associate-/r*37.9%
*-commutative37.9%
associate-*r/38.0%
unpow238.0%
unpow238.0%
times-frac42.9%
unpow242.9%
*-commutative42.9%
times-frac44.2%
Simplified44.2%
associate-*l/44.3%
associate-*r*44.3%
Applied egg-rr44.3%
unpow244.2%
Applied egg-rr44.3%
Final simplification50.2%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= M 2.6e-78) (and (not (<= M 4.7e+38)) (<= M 2.7e+65))) (* -0.5 (/ 0.0 w)) (* (/ c0 (* 2.0 w)) (* 2.0 (* (/ c0 h) (/ (* (/ d D) (/ d D)) w))))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M <= 2.6e-78) || (!(M <= 4.7e+38) && (M <= 2.7e+65))) {
tmp = -0.5 * (0.0 / w);
} else {
tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / h) * (((d / D) * (d / D)) / 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 <= 2.6d-78) .or. (.not. (m <= 4.7d+38)) .and. (m <= 2.7d+65)) then
tmp = (-0.5d0) * (0.0d0 / w)
else
tmp = (c0 / (2.0d0 * w)) * (2.0d0 * ((c0 / h) * (((d_1 / d) * (d_1 / d)) / 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 <= 2.6e-78) || (!(M <= 4.7e+38) && (M <= 2.7e+65))) {
tmp = -0.5 * (0.0 / w);
} else {
tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / h) * (((d / D) * (d / D)) / w)));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (M <= 2.6e-78) or (not (M <= 4.7e+38) and (M <= 2.7e+65)): tmp = -0.5 * (0.0 / w) else: tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / h) * (((d / D) * (d / D)) / w))) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((M <= 2.6e-78) || (!(M <= 4.7e+38) && (M <= 2.7e+65))) tmp = Float64(-0.5 * Float64(0.0 / w)); else tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(Float64(c0 / h) * Float64(Float64(Float64(d / D) * Float64(d / D)) / w)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((M <= 2.6e-78) || (~((M <= 4.7e+38)) && (M <= 2.7e+65))) tmp = -0.5 * (0.0 / w); else tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / h) * (((d / D) * (d / D)) / w))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[M, 2.6e-78], And[N[Not[LessEqual[M, 4.7e+38]], $MachinePrecision], LessEqual[M, 2.7e+65]]], N[(-0.5 * N[(0.0 / w), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(c0 / h), $MachinePrecision] * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.6 \cdot 10^{-78} \lor \neg \left(M \leq 4.7 \cdot 10^{+38}\right) \land M \leq 2.7 \cdot 10^{+65}:\\
\;\;\;\;-0.5 \cdot \frac{0}{w}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0}{h} \cdot \frac{\frac{d}{D} \cdot \frac{d}{D}}{w}\right)\right)\\
\end{array}
\end{array}
if M < 2.6000000000000001e-78 or 4.6999999999999999e38 < M < 2.70000000000000019e65Initial program 26.9%
associate-*l*24.8%
difference-of-squares28.1%
associate-*l*29.2%
associate-*l*33.4%
Simplified33.4%
Taylor expanded in c0 around -inf 4.1%
*-commutative4.1%
unpow24.1%
distribute-rgt1-in4.1%
metadata-eval4.1%
mul0-lft27.9%
Simplified27.9%
Taylor expanded in c0 around 0 41.8%
if 2.6000000000000001e-78 < M < 4.6999999999999999e38 or 2.70000000000000019e65 < M Initial program 25.1%
associate-*l*25.1%
difference-of-squares37.1%
associate-*l*37.1%
associate-*l*39.7%
Simplified39.7%
flip-+0.0%
Applied egg-rr0.0%
unpow20.0%
associate--r-1.4%
+-inverses9.9%
unpow29.9%
associate-/l/10.0%
associate-/l/10.0%
Simplified10.0%
Taylor expanded in M around 0 40.6%
associate-/r*40.6%
*-commutative40.6%
associate-*r/39.3%
unpow239.3%
unpow239.3%
times-frac42.2%
unpow242.2%
*-commutative42.2%
times-frac43.4%
Simplified43.4%
unpow243.4%
Applied egg-rr43.4%
Final simplification42.3%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* -0.5 (/ 0.0 w))))
(if (<= M 1.8e-80)
t_0
(if (<= M 1.3e+25)
(/ (* 2.0 (/ (* d (* d (* c0 c0))) (* D (* (* w h) D)))) (* 2.0 w))
(if (<= M 3.8e+64)
t_0
(*
(/ c0 (* 2.0 w))
(* 2.0 (* (/ c0 h) (/ (* (/ d D) (/ d D)) w)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = -0.5 * (0.0 / w);
double tmp;
if (M <= 1.8e-80) {
tmp = t_0;
} else if (M <= 1.3e+25) {
tmp = (2.0 * ((d * (d * (c0 * c0))) / (D * ((w * h) * D)))) / (2.0 * w);
} else if (M <= 3.8e+64) {
tmp = t_0;
} else {
tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / h) * (((d / D) * (d / D)) / 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 = (-0.5d0) * (0.0d0 / w)
if (m <= 1.8d-80) then
tmp = t_0
else if (m <= 1.3d+25) then
tmp = (2.0d0 * ((d_1 * (d_1 * (c0 * c0))) / (d * ((w * h) * d)))) / (2.0d0 * w)
else if (m <= 3.8d+64) then
tmp = t_0
else
tmp = (c0 / (2.0d0 * w)) * (2.0d0 * ((c0 / h) * (((d_1 / d) * (d_1 / d)) / 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 = -0.5 * (0.0 / w);
double tmp;
if (M <= 1.8e-80) {
tmp = t_0;
} else if (M <= 1.3e+25) {
tmp = (2.0 * ((d * (d * (c0 * c0))) / (D * ((w * h) * D)))) / (2.0 * w);
} else if (M <= 3.8e+64) {
tmp = t_0;
} else {
tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / h) * (((d / D) * (d / D)) / w)));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = -0.5 * (0.0 / w) tmp = 0 if M <= 1.8e-80: tmp = t_0 elif M <= 1.3e+25: tmp = (2.0 * ((d * (d * (c0 * c0))) / (D * ((w * h) * D)))) / (2.0 * w) elif M <= 3.8e+64: tmp = t_0 else: tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / h) * (((d / D) * (d / D)) / w))) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(-0.5 * Float64(0.0 / w)) tmp = 0.0 if (M <= 1.8e-80) tmp = t_0; elseif (M <= 1.3e+25) tmp = Float64(Float64(2.0 * Float64(Float64(d * Float64(d * Float64(c0 * c0))) / Float64(D * Float64(Float64(w * h) * D)))) / Float64(2.0 * w)); elseif (M <= 3.8e+64) tmp = t_0; else tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(Float64(c0 / h) * Float64(Float64(Float64(d / D) * Float64(d / D)) / w)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = -0.5 * (0.0 / w); tmp = 0.0; if (M <= 1.8e-80) tmp = t_0; elseif (M <= 1.3e+25) tmp = (2.0 * ((d * (d * (c0 * c0))) / (D * ((w * h) * D)))) / (2.0 * w); elseif (M <= 3.8e+64) tmp = t_0; else tmp = (c0 / (2.0 * w)) * (2.0 * ((c0 / h) * (((d / D) * (d / D)) / w))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(-0.5 * N[(0.0 / w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 1.8e-80], t$95$0, If[LessEqual[M, 1.3e+25], N[(N[(2.0 * N[(N[(d * N[(d * N[(c0 * c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(D * N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 3.8e+64], t$95$0, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(c0 / h), $MachinePrecision] * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.5 \cdot \frac{0}{w}\\
\mathbf{if}\;M \leq 1.8 \cdot 10^{-80}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;M \leq 1.3 \cdot 10^{+25}:\\
\;\;\;\;\frac{2 \cdot \frac{d \cdot \left(d \cdot \left(c0 \cdot c0\right)\right)}{D \cdot \left(\left(w \cdot h\right) \cdot D\right)}}{2 \cdot w}\\
\mathbf{elif}\;M \leq 3.8 \cdot 10^{+64}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0}{h} \cdot \frac{\frac{d}{D} \cdot \frac{d}{D}}{w}\right)\right)\\
\end{array}
\end{array}
if M < 1.8e-80 or 1.2999999999999999e25 < M < 3.8000000000000001e64Initial program 27.9%
associate-*l*25.9%
difference-of-squares29.1%
associate-*l*30.2%
associate-*l*34.3%
Simplified34.3%
Taylor expanded in c0 around -inf 4.0%
*-commutative4.0%
unpow24.0%
distribute-rgt1-in4.0%
metadata-eval4.0%
mul0-lft27.9%
Simplified27.9%
Taylor expanded in c0 around 0 41.4%
if 1.8e-80 < M < 1.2999999999999999e25Initial program 37.6%
associate-*l*37.6%
difference-of-squares37.6%
associate-*l*37.6%
associate-*l*41.8%
Simplified41.8%
flip-+0.0%
Applied egg-rr0.1%
unpow20.1%
associate--r-4.3%
+-inverses17.3%
unpow217.3%
associate-/l/17.5%
associate-/l/17.5%
Simplified17.5%
Taylor expanded in M around 0 42.2%
associate-/r*42.3%
*-commutative42.3%
associate-*r/38.1%
unpow238.1%
unpow238.1%
times-frac42.7%
unpow242.7%
*-commutative42.7%
times-frac46.6%
Simplified46.6%
associate-*l/46.9%
associate-*r*46.9%
Applied egg-rr46.9%
Taylor expanded in c0 around 0 38.1%
unpow238.1%
associate-*l*46.6%
unpow246.6%
unpow246.6%
associate-*r*50.9%
Simplified50.9%
if 3.8000000000000001e64 < M Initial program 14.7%
associate-*l*14.7%
difference-of-squares33.7%
associate-*l*33.7%
associate-*l*35.7%
Simplified35.7%
flip-+0.0%
Applied egg-rr0.0%
unpow20.0%
associate--r-0.0%
+-inverses4.9%
unpow24.9%
associate-/l/4.9%
associate-/l/4.9%
Simplified4.9%
Taylor expanded in M around 0 37.0%
associate-/r*36.9%
*-commutative36.9%
associate-*r/36.9%
unpow236.9%
unpow236.9%
times-frac39.2%
unpow239.2%
*-commutative39.2%
times-frac39.1%
Simplified39.1%
unpow239.1%
Applied egg-rr39.1%
Final simplification41.9%
(FPCore (c0 w h D d M) :precision binary64 (if (or (<= M 4e-78) (and (not (<= M 1.9e+38)) (<= M 6.2e+91))) (* -0.5 (/ 0.0 w)) (* (/ (* d d) (* D D)) (* (/ c0 (* w h)) (/ c0 w)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if ((M <= 4e-78) || (!(M <= 1.9e+38) && (M <= 6.2e+91))) {
tmp = -0.5 * (0.0 / w);
} else {
tmp = ((d * d) / (D * D)) * ((c0 / (w * h)) * (c0 / 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 <= 4d-78) .or. (.not. (m <= 1.9d+38)) .and. (m <= 6.2d+91)) then
tmp = (-0.5d0) * (0.0d0 / w)
else
tmp = ((d_1 * d_1) / (d * d)) * ((c0 / (w * h)) * (c0 / 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 <= 4e-78) || (!(M <= 1.9e+38) && (M <= 6.2e+91))) {
tmp = -0.5 * (0.0 / w);
} else {
tmp = ((d * d) / (D * D)) * ((c0 / (w * h)) * (c0 / w));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (M <= 4e-78) or (not (M <= 1.9e+38) and (M <= 6.2e+91)): tmp = -0.5 * (0.0 / w) else: tmp = ((d * d) / (D * D)) * ((c0 / (w * h)) * (c0 / w)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if ((M <= 4e-78) || (!(M <= 1.9e+38) && (M <= 6.2e+91))) tmp = Float64(-0.5 * Float64(0.0 / w)); else tmp = Float64(Float64(Float64(d * d) / Float64(D * D)) * Float64(Float64(c0 / Float64(w * h)) * Float64(c0 / w))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if ((M <= 4e-78) || (~((M <= 1.9e+38)) && (M <= 6.2e+91))) tmp = -0.5 * (0.0 / w); else tmp = ((d * d) / (D * D)) * ((c0 / (w * h)) * (c0 / w)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[M, 4e-78], And[N[Not[LessEqual[M, 1.9e+38]], $MachinePrecision], LessEqual[M, 6.2e+91]]], N[(-0.5 * N[(0.0 / w), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(c0 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 4 \cdot 10^{-78} \lor \neg \left(M \leq 1.9 \cdot 10^{+38}\right) \land M \leq 6.2 \cdot 10^{+91}:\\
\;\;\;\;-0.5 \cdot \frac{0}{w}\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot d}{D \cdot D} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{c0}{w}\right)\\
\end{array}
\end{array}
if M < 4e-78 or 1.8999999999999999e38 < M < 6.19999999999999995e91Initial program 26.2%
associate-*l*24.1%
difference-of-squares27.4%
associate-*l*28.4%
associate-*l*32.5%
Simplified32.5%
Taylor expanded in c0 around -inf 4.0%
*-commutative4.0%
unpow24.0%
distribute-rgt1-in4.0%
metadata-eval4.0%
mul0-lft27.9%
Simplified27.9%
Taylor expanded in c0 around 0 41.3%
if 4e-78 < M < 1.8999999999999999e38 or 6.19999999999999995e91 < M Initial program 26.8%
associate-*l*26.8%
difference-of-squares39.7%
associate-*l*39.7%
associate-*l*42.5%
Simplified42.5%
Taylor expanded in c0 around inf 31.8%
times-frac31.8%
unpow231.8%
unpow231.8%
unpow231.8%
*-commutative31.8%
unpow231.8%
Simplified31.8%
Taylor expanded in c0 around 0 31.8%
unpow231.8%
unpow231.8%
associate-*l*31.9%
*-commutative31.9%
times-frac41.7%
Simplified41.7%
Final simplification41.4%
(FPCore (c0 w h D d M) :precision binary64 (* -0.5 (/ 0.0 w)))
double code(double c0, double w, double h, double D, double d, double M) {
return -0.5 * (0.0 / w);
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = (-0.5d0) * (0.0d0 / w)
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return -0.5 * (0.0 / w);
}
def code(c0, w, h, D, d, M): return -0.5 * (0.0 / w)
function code(c0, w, h, D, d, M) return Float64(-0.5 * Float64(0.0 / w)) end
function tmp = code(c0, w, h, D, d, M) tmp = -0.5 * (0.0 / w); end
code[c0_, w_, h_, D_, d_, M_] := N[(-0.5 * N[(0.0 / w), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \frac{0}{w}
\end{array}
Initial program 26.3%
associate-*l*24.9%
difference-of-squares30.8%
associate-*l*31.5%
associate-*l*35.3%
Simplified35.3%
Taylor expanded in c0 around -inf 2.9%
*-commutative2.9%
unpow22.9%
distribute-rgt1-in2.9%
metadata-eval2.9%
mul0-lft22.9%
Simplified22.9%
Taylor expanded in c0 around 0 34.0%
Final simplification34.0%
herbie shell --seed 2023228
(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))))))