
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (/ h l) (- INFINITY))
(+ w0 (* -0.125 (/ 1.0 (/ (/ l (* h (pow (* D (/ M d)) 2.0))) w0))))
(if (<= (/ h l) -4e-258)
(* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ M d) (/ D 2.0)) 2.0)))))
w0)))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -((double) INFINITY)) {
tmp = w0 + (-0.125 * (1.0 / ((l / (h * pow((D * (M / d)), 2.0))) / w0)));
} else if ((h / l) <= -4e-258) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -Double.POSITIVE_INFINITY) {
tmp = w0 + (-0.125 * (1.0 / ((l / (h * Math.pow((D * (M / d)), 2.0))) / w0)));
} else if ((h / l) <= -4e-258) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (h / l) <= -math.inf: tmp = w0 + (-0.125 * (1.0 / ((l / (h * math.pow((D * (M / d)), 2.0))) / w0))) elif (h / l) <= -4e-258: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M / d) * (D / 2.0)), 2.0)))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(h / l) <= Float64(-Inf)) tmp = Float64(w0 + Float64(-0.125 * Float64(1.0 / Float64(Float64(l / Float64(h * (Float64(D * Float64(M / d)) ^ 2.0))) / w0)))); elseif (Float64(h / l) <= -4e-258) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0))))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if ((h / l) <= -Inf) tmp = w0 + (-0.125 * (1.0 / ((l / (h * ((D * (M / d)) ^ 2.0))) / w0))); elseif ((h / l) <= -4e-258) tmp = w0 * sqrt((1.0 - ((h / l) * (((M / d) * (D / 2.0)) ^ 2.0)))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], (-Infinity)], N[(w0 + N[(-0.125 * N[(1.0 / N[(N[(l / N[(h * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / w0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -4e-258], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\
\;\;\;\;w0 + -0.125 \cdot \frac{1}{\frac{\frac{\ell}{h \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}}{w0}}\\
\mathbf{elif}\;\frac{h}{\ell} \leq -4 \cdot 10^{-258}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -inf.0Initial program 50.4%
Simplified50.4%
Taylor expanded in D around 0 44.9%
expm1-log1p-u28.3%
expm1-udef28.3%
associate-*r*33.8%
pow-prod-down44.9%
*-commutative44.9%
Applied egg-rr44.9%
expm1-def44.9%
expm1-log1p67.1%
associate-*r*72.7%
*-commutative72.7%
unpow272.7%
swap-sqr56.0%
unpow256.0%
unpow256.0%
associate-*r*56.0%
associate-*r*50.5%
times-frac50.5%
associate-*r/50.5%
Simplified73.2%
clear-num73.2%
inv-pow73.2%
*-commutative73.2%
Applied egg-rr73.2%
unpow-173.2%
associate-*r*84.3%
*-commutative84.3%
associate-/r*84.3%
*-commutative84.3%
associate-*l/84.3%
associate-*r/84.3%
Simplified84.3%
if -inf.0 < (/.f64 h l) < -3.99999999999999982e-258Initial program 82.1%
Simplified83.0%
if -3.99999999999999982e-258 < (/.f64 h l) Initial program 85.2%
Simplified84.4%
Taylor expanded in D around 0 93.7%
Final simplification87.8%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* D M) (* d 2.0)) 2.0) (/ h l)) -10.0) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ D (* (/ d M) 2.0)) 2.0))))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((D * M) / (d * 2.0)), 2.0) * (h / l)) <= -10.0) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow((D / ((d / M) * 2.0)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((d * m) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l)) <= (-10.0d0)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((d / ((d_1 / m) * 2.0d0)) ** 2.0d0))))
else
tmp = w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l)) <= -10.0) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((D / ((d / M) * 2.0)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l)) <= -10.0: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((D / ((d / M) * 2.0)), 2.0)))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l)) <= -10.0) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(D / Float64(Float64(d / M) * 2.0)) ^ 2.0))))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((D * M) / (d * 2.0)) ^ 2.0) * (h / l)) <= -10.0) tmp = w0 * sqrt((1.0 - ((h / l) * ((D / ((d / M) * 2.0)) ^ 2.0)))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -10.0], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(D / N[(N[(d / M), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq -10:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{D}{\frac{d}{M} \cdot 2}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -10Initial program 69.7%
Simplified71.0%
*-commutative71.0%
clear-num70.9%
frac-times71.0%
*-un-lft-identity71.0%
Applied egg-rr71.0%
if -10 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 87.1%
Simplified86.5%
Taylor expanded in D around 0 96.3%
Final simplification87.8%
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (pow (/ l (* (* 0.25 (pow (/ D (/ d M)) 2.0)) h)) -1.0)))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - pow((l / ((0.25 * pow((D / (d / M)), 2.0)) * h)), -1.0)));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((l / ((0.25d0 * ((d / (d_1 / m)) ** 2.0d0)) * h)) ** (-1.0d0))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - Math.pow((l / ((0.25 * Math.pow((D / (d / M)), 2.0)) * h)), -1.0)));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - math.pow((l / ((0.25 * math.pow((D / (d / M)), 2.0)) * h)), -1.0)))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - (Float64(l / Float64(Float64(0.25 * (Float64(D / Float64(d / M)) ^ 2.0)) * h)) ^ -1.0)))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((l / ((0.25 * ((D / (d / M)) ^ 2.0)) * h)) ^ -1.0))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[Power[N[(l / N[(N[(0.25 * N[Power[N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{\ell}{\left(0.25 \cdot {\left(\frac{D}{\frac{d}{M}}\right)}^{2}\right) \cdot h}\right)}^{-1}}
\end{array}
Initial program 81.2%
Simplified81.3%
associate-*r/87.0%
frac-times86.9%
*-commutative86.9%
*-un-lft-identity86.9%
times-frac86.9%
metadata-eval86.9%
*-commutative86.9%
Applied egg-rr86.9%
clear-num86.9%
inv-pow86.9%
unpow-prod-down86.9%
metadata-eval86.9%
associate-/l*87.0%
Applied egg-rr87.0%
Final simplification87.0%
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (+ 1.0 (/ -1.0 (/ l (* h (/ 0.25 (pow (/ d (* D M)) 2.0)))))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 + (-1.0 / (l / (h * (0.25 / pow((d / (D * M)), 2.0)))))));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 + ((-1.0d0) / (l / (h * (0.25d0 / ((d_1 / (d * m)) ** 2.0d0)))))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 + (-1.0 / (l / (h * (0.25 / Math.pow((d / (D * M)), 2.0)))))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 + (-1.0 / (l / (h * (0.25 / math.pow((d / (D * M)), 2.0)))))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 + Float64(-1.0 / Float64(l / Float64(h * Float64(0.25 / (Float64(d / Float64(D * M)) ^ 2.0)))))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 + (-1.0 / (l / (h * (0.25 / ((d / (D * M)) ^ 2.0))))))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 + N[(-1.0 / N[(l / N[(h * N[(0.25 / N[Power[N[(d / N[(D * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 + \frac{-1}{\frac{\ell}{h \cdot \frac{0.25}{{\left(\frac{d}{D \cdot M}\right)}^{2}}}}}
\end{array}
Initial program 81.2%
Simplified81.3%
associate-*r/87.0%
frac-times86.9%
*-commutative86.9%
*-un-lft-identity86.9%
times-frac86.9%
metadata-eval86.9%
*-commutative86.9%
Applied egg-rr86.9%
clear-num86.9%
inv-pow86.9%
unpow-prod-down86.9%
metadata-eval86.9%
associate-/l*87.0%
Applied egg-rr87.0%
unpow287.0%
clear-num87.0%
frac-times86.2%
*-un-lft-identity86.2%
Applied egg-rr86.2%
expm1-log1p-u85.7%
expm1-udef85.8%
Applied egg-rr81.2%
expm1-def81.2%
expm1-log1p81.4%
sub-neg81.4%
distribute-neg-frac81.4%
metadata-eval81.4%
associate-/l/82.2%
associate-/l*82.2%
associate-/l/72.6%
unpow272.6%
times-frac87.0%
associate-/r*86.2%
*-commutative86.2%
associate-/r*87.0%
*-commutative87.0%
unpow187.0%
pow-plus87.0%
metadata-eval87.0%
Simplified87.0%
Final simplification87.0%
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* h (pow (* 0.5 (/ (* D M) d)) 2.0)) l)))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - ((h * pow((0.5 * ((D * M) / d)), 2.0)) / l)));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((h * ((0.5d0 * ((d * m) / d_1)) ** 2.0d0)) / l)))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - ((h * Math.pow((0.5 * ((D * M) / d)), 2.0)) / l)));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - ((h * math.pow((0.5 * ((D * M) / d)), 2.0)) / l)))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(0.5 * Float64(Float64(D * M) / d)) ^ 2.0)) / l)))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((h * ((0.5 * ((D * M) / d)) ^ 2.0)) / l))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(0.5 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - \frac{h \cdot {\left(0.5 \cdot \frac{D \cdot M}{d}\right)}^{2}}{\ell}}
\end{array}
Initial program 81.2%
Simplified81.3%
associate-*r/87.0%
frac-times86.9%
*-commutative86.9%
*-un-lft-identity86.9%
times-frac86.9%
metadata-eval86.9%
*-commutative86.9%
Applied egg-rr86.9%
Final simplification86.9%
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (/ h l) (- INFINITY))
(+ w0 (* -0.125 (/ (* (pow (* D (/ M d)) 2.0) (* w0 h)) l)))
(if (<= (/ h l) -1e-142)
(+ w0 (* -0.125 (* (/ h l) (* w0 (pow (/ d (* D M)) -2.0)))))
w0)))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -((double) INFINITY)) {
tmp = w0 + (-0.125 * ((pow((D * (M / d)), 2.0) * (w0 * h)) / l));
} else if ((h / l) <= -1e-142) {
tmp = w0 + (-0.125 * ((h / l) * (w0 * pow((d / (D * M)), -2.0))));
} else {
tmp = w0;
}
return tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -Double.POSITIVE_INFINITY) {
tmp = w0 + (-0.125 * ((Math.pow((D * (M / d)), 2.0) * (w0 * h)) / l));
} else if ((h / l) <= -1e-142) {
tmp = w0 + (-0.125 * ((h / l) * (w0 * Math.pow((d / (D * M)), -2.0))));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (h / l) <= -math.inf: tmp = w0 + (-0.125 * ((math.pow((D * (M / d)), 2.0) * (w0 * h)) / l)) elif (h / l) <= -1e-142: tmp = w0 + (-0.125 * ((h / l) * (w0 * math.pow((d / (D * M)), -2.0)))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(h / l) <= Float64(-Inf)) tmp = Float64(w0 + Float64(-0.125 * Float64(Float64((Float64(D * Float64(M / d)) ^ 2.0) * Float64(w0 * h)) / l))); elseif (Float64(h / l) <= -1e-142) tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h / l) * Float64(w0 * (Float64(d / Float64(D * M)) ^ -2.0))))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if ((h / l) <= -Inf) tmp = w0 + (-0.125 * ((((D * (M / d)) ^ 2.0) * (w0 * h)) / l)); elseif ((h / l) <= -1e-142) tmp = w0 + (-0.125 * ((h / l) * (w0 * ((d / (D * M)) ^ -2.0)))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], (-Infinity)], N[(w0 + N[(-0.125 * N[(N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(w0 * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -1e-142], N[(w0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[(w0 * N[Power[N[(d / N[(D * M), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\
\;\;\;\;w0 + -0.125 \cdot \frac{{\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(w0 \cdot h\right)}{\ell}\\
\mathbf{elif}\;\frac{h}{\ell} \leq -1 \cdot 10^{-142}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\frac{h}{\ell} \cdot \left(w0 \cdot {\left(\frac{d}{D \cdot M}\right)}^{-2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -inf.0Initial program 50.4%
Simplified50.4%
Taylor expanded in D around 0 44.9%
expm1-log1p-u28.3%
expm1-udef28.3%
associate-*r*33.8%
pow-prod-down44.9%
*-commutative44.9%
Applied egg-rr44.9%
expm1-def44.9%
expm1-log1p67.1%
associate-*r*72.7%
*-commutative72.7%
unpow272.7%
swap-sqr56.0%
unpow256.0%
unpow256.0%
associate-*r*56.0%
associate-*r*50.5%
times-frac50.5%
associate-*r/50.5%
Simplified73.2%
Taylor expanded in D around 0 44.9%
*-commutative44.9%
associate-*r/44.9%
associate-/l*50.5%
associate-*r/50.2%
associate-*l/50.5%
unpow250.5%
unpow250.5%
unpow250.5%
times-frac67.1%
times-frac73.2%
associate-/l*73.2%
times-frac67.7%
Simplified73.2%
if -inf.0 < (/.f64 h l) < -1e-142Initial program 82.3%
Simplified82.5%
Taylor expanded in D around 0 41.3%
expm1-log1p-u29.3%
expm1-udef29.3%
associate-*r*29.3%
pow-prod-down32.4%
*-commutative32.4%
Applied egg-rr32.4%
expm1-def32.4%
expm1-log1p47.4%
associate-*r*51.4%
*-commutative51.4%
unpow251.4%
swap-sqr47.2%
unpow247.2%
unpow247.2%
associate-*r*45.3%
associate-*r*45.1%
times-frac45.1%
associate-*r/46.1%
Simplified56.7%
Taylor expanded in D around 0 41.3%
*-commutative41.3%
*-commutative41.3%
times-frac40.2%
associate-*l/42.3%
Simplified60.7%
Taylor expanded in D around 0 41.3%
associate-*r*41.3%
times-frac40.3%
Simplified65.7%
if -1e-142 < (/.f64 h l) Initial program 84.5%
Simplified84.5%
Taylor expanded in D around 0 91.1%
Final simplification79.5%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (/ h l) -1e-142) (+ w0 (* -0.125 (* (/ h l) (* w0 (pow (/ d (* D M)) -2.0))))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -1e-142) {
tmp = w0 + (-0.125 * ((h / l) * (w0 * pow((d / (D * M)), -2.0))));
} else {
tmp = w0;
}
return tmp;
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if ((h / l) <= (-1d-142)) then
tmp = w0 + ((-0.125d0) * ((h / l) * (w0 * ((d_1 / (d * m)) ** (-2.0d0)))))
else
tmp = w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -1e-142) {
tmp = w0 + (-0.125 * ((h / l) * (w0 * Math.pow((d / (D * M)), -2.0))));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (h / l) <= -1e-142: tmp = w0 + (-0.125 * ((h / l) * (w0 * math.pow((d / (D * M)), -2.0)))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(h / l) <= -1e-142) tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h / l) * Float64(w0 * (Float64(d / Float64(D * M)) ^ -2.0))))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if ((h / l) <= -1e-142) tmp = w0 + (-0.125 * ((h / l) * (w0 * ((d / (D * M)) ^ -2.0)))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -1e-142], N[(w0 + N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[(w0 * N[Power[N[(d / N[(D * M), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{-142}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\frac{h}{\ell} \cdot \left(w0 \cdot {\left(\frac{d}{D \cdot M}\right)}^{-2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -1e-142Initial program 77.6%
Simplified77.8%
Taylor expanded in D around 0 41.9%
expm1-log1p-u29.2%
expm1-udef29.2%
associate-*r*30.0%
pow-prod-down34.2%
*-commutative34.2%
Applied egg-rr34.2%
expm1-def34.2%
expm1-log1p50.3%
associate-*r*54.6%
*-commutative54.6%
unpow254.6%
swap-sqr48.5%
unpow248.5%
unpow248.5%
associate-*r*46.9%
associate-*r*45.9%
times-frac45.9%
associate-*r/46.8%
Simplified59.1%
Taylor expanded in D around 0 41.9%
*-commutative41.9%
*-commutative41.9%
times-frac40.0%
associate-*l/42.7%
Simplified61.7%
Taylor expanded in D around 0 41.9%
associate-*r*42.6%
times-frac40.9%
Simplified63.5%
if -1e-142 < (/.f64 h l) Initial program 84.5%
Simplified84.5%
Taylor expanded in D around 0 91.1%
Final simplification77.9%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (/ h l) -2e-120) (+ w0 (* -0.125 (/ (* h (pow (/ d (* D M)) -2.0)) (/ l w0)))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -2e-120) {
tmp = w0 + (-0.125 * ((h * pow((d / (D * M)), -2.0)) / (l / w0)));
} else {
tmp = w0;
}
return tmp;
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if ((h / l) <= (-2d-120)) then
tmp = w0 + ((-0.125d0) * ((h * ((d_1 / (d * m)) ** (-2.0d0))) / (l / w0)))
else
tmp = w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -2e-120) {
tmp = w0 + (-0.125 * ((h * Math.pow((d / (D * M)), -2.0)) / (l / w0)));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (h / l) <= -2e-120: tmp = w0 + (-0.125 * ((h * math.pow((d / (D * M)), -2.0)) / (l / w0))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(h / l) <= -2e-120) tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h * (Float64(d / Float64(D * M)) ^ -2.0)) / Float64(l / w0)))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if ((h / l) <= -2e-120) tmp = w0 + (-0.125 * ((h * ((d / (D * M)) ^ -2.0)) / (l / w0))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -2e-120], N[(w0 + N[(-0.125 * N[(N[(h * N[Power[N[(d / N[(D * M), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / N[(l / w0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -2 \cdot 10^{-120}:\\
\;\;\;\;w0 + -0.125 \cdot \frac{h \cdot {\left(\frac{d}{D \cdot M}\right)}^{-2}}{\frac{\ell}{w0}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -1.99999999999999996e-120Initial program 79.5%
Simplified79.6%
Taylor expanded in D around 0 42.9%
expm1-log1p-u29.9%
expm1-udef29.9%
associate-*r*30.7%
pow-prod-down35.1%
*-commutative35.1%
Applied egg-rr35.1%
expm1-def35.1%
expm1-log1p51.5%
associate-*r*55.9%
*-commutative55.9%
unpow255.9%
swap-sqr49.7%
unpow249.7%
unpow249.7%
associate-*r*48.0%
associate-*r*47.0%
times-frac47.0%
associate-*r/47.9%
Simplified60.6%
Taylor expanded in D around 0 42.9%
*-commutative42.9%
*-commutative42.9%
times-frac41.0%
associate-*l/43.7%
Simplified63.2%
associate-*r/66.7%
*-commutative66.7%
clear-num66.7%
associate-/r/66.7%
inv-pow66.7%
pow-pow66.7%
associate-/l/66.7%
metadata-eval66.7%
Applied egg-rr66.7%
if -1.99999999999999996e-120 < (/.f64 h l) Initial program 82.8%
Simplified82.8%
Taylor expanded in D around 0 89.2%
Final simplification78.7%
(FPCore (w0 M D h l d) :precision binary64 (+ w0 (* -0.125 (/ 1.0 (/ (/ l (* h (pow (* D (/ M d)) 2.0))) w0)))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 + (-0.125 * (1.0 / ((l / (h * pow((D * (M / d)), 2.0))) / w0)));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 + ((-0.125d0) * (1.0d0 / ((l / (h * ((d * (m / d_1)) ** 2.0d0))) / w0)))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 + (-0.125 * (1.0 / ((l / (h * Math.pow((D * (M / d)), 2.0))) / w0)));
}
def code(w0, M, D, h, l, d): return w0 + (-0.125 * (1.0 / ((l / (h * math.pow((D * (M / d)), 2.0))) / w0)))
function code(w0, M, D, h, l, d) return Float64(w0 + Float64(-0.125 * Float64(1.0 / Float64(Float64(l / Float64(h * (Float64(D * Float64(M / d)) ^ 2.0))) / w0)))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 + (-0.125 * (1.0 / ((l / (h * ((D * (M / d)) ^ 2.0))) / w0))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 + N[(-0.125 * N[(1.0 / N[(N[(l / N[(h * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / w0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 + -0.125 \cdot \frac{1}{\frac{\frac{\ell}{h \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}}{w0}}
\end{array}
Initial program 81.2%
Simplified81.3%
Taylor expanded in D around 0 46.7%
expm1-log1p-u40.6%
expm1-udef40.6%
associate-*r*41.3%
pow-prod-down52.4%
*-commutative52.4%
Applied egg-rr52.4%
expm1-def52.4%
expm1-log1p60.5%
associate-*r*66.9%
*-commutative66.9%
unpow266.9%
swap-sqr53.9%
unpow253.9%
unpow253.9%
associate-*r*53.0%
associate-*r*51.4%
times-frac51.0%
associate-*r/52.6%
Simplified69.5%
clear-num69.5%
inv-pow69.5%
*-commutative69.5%
Applied egg-rr69.5%
unpow-169.5%
associate-*r*79.1%
*-commutative79.1%
associate-/r*79.9%
*-commutative79.9%
associate-*l/79.7%
associate-*r/79.7%
Simplified79.7%
Final simplification79.7%
(FPCore (w0 M D h l d) :precision binary64 (let* ((t_0 (* D (/ M d)))) (if (<= M 2.06e-7) w0 (+ w0 (* -0.125 (* (* t_0 t_0) (/ h (/ l w0))))))))
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D * (M / d);
double tmp;
if (M <= 2.06e-7) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((t_0 * t_0) * (h / (l / w0))));
}
return tmp;
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d * (m / d_1)
if (m <= 2.06d-7) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * ((t_0 * t_0) * (h / (l / w0))))
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D * (M / d);
double tmp;
if (M <= 2.06e-7) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((t_0 * t_0) * (h / (l / w0))));
}
return tmp;
}
def code(w0, M, D, h, l, d): t_0 = D * (M / d) tmp = 0 if M <= 2.06e-7: tmp = w0 else: tmp = w0 + (-0.125 * ((t_0 * t_0) * (h / (l / w0)))) return tmp
function code(w0, M, D, h, l, d) t_0 = Float64(D * Float64(M / d)) tmp = 0.0 if (M <= 2.06e-7) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(t_0 * t_0) * Float64(h / Float64(l / w0))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = D * (M / d); tmp = 0.0; if (M <= 2.06e-7) tmp = w0; else tmp = w0 + (-0.125 * ((t_0 * t_0) * (h / (l / w0)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 2.06e-7], w0, N[(w0 + N[(-0.125 * N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(h / N[(l / w0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := D \cdot \frac{M}{d}\\
\mathbf{if}\;M \leq 2.06 \cdot 10^{-7}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(t_0 \cdot t_0\right) \cdot \frac{h}{\frac{\ell}{w0}}\right)\\
\end{array}
\end{array}
if M < 2.05999999999999992e-7Initial program 80.9%
Simplified80.4%
Taylor expanded in D around 0 72.1%
if 2.05999999999999992e-7 < M Initial program 82.4%
Simplified84.1%
Taylor expanded in D around 0 43.3%
expm1-log1p-u25.1%
expm1-udef25.1%
associate-*r*25.1%
pow-prod-down38.2%
*-commutative38.2%
Applied egg-rr38.2%
expm1-def38.2%
expm1-log1p58.1%
associate-*r*63.1%
*-commutative63.1%
unpow263.1%
swap-sqr46.7%
unpow246.7%
unpow246.7%
associate-*r*45.1%
associate-*r*43.4%
times-frac41.7%
associate-*r/43.3%
Simplified68.7%
Taylor expanded in D around 0 43.3%
*-commutative43.3%
*-commutative43.3%
times-frac39.9%
associate-*l/41.6%
Simplified68.7%
unpow268.7%
Applied egg-rr68.7%
Final simplification71.3%
(FPCore (w0 M D h l d) :precision binary64 w0)
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
def code(w0, M, D, h, l, d): return w0
function code(w0, M, D, h, l, d) return w0 end
function tmp = code(w0, M, D, h, l, d) tmp = w0; end
code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
\\
w0
\end{array}
Initial program 81.2%
Simplified81.3%
Taylor expanded in D around 0 66.1%
Final simplification66.1%
herbie shell --seed 2023298
(FPCore (w0 M D h l d)
:name "Henrywood and Agarwal, Equation (9a)"
:precision binary64
(* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))