
(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 8 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}
d_m = (fabs.f64 d)
NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d_m)
:precision binary64
(if (<= (pow (/ (* M D) (* 2.0 d_m)) 2.0) 5e+220)
(* w0 (sqrt (- 1.0 (/ (* (pow (* 0.5 (/ D (/ d_m M))) 2.0) h) l))))
(pow
(*
(cbrt w0)
(pow
(exp 0.16666666666666666)
(fma -2.0 (log d_m) (log (* -0.25 (/ (* h (pow (* M D) 2.0)) l))))))
3.0)))d_m = fabs(d);
assert(w0 < M && M < D && D < h && h < l && l < d_m);
double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if (pow(((M * D) / (2.0 * d_m)), 2.0) <= 5e+220) {
tmp = w0 * sqrt((1.0 - ((pow((0.5 * (D / (d_m / M))), 2.0) * h) / l)));
} else {
tmp = pow((cbrt(w0) * pow(exp(0.16666666666666666), fma(-2.0, log(d_m), log((-0.25 * ((h * pow((M * D), 2.0)) / l)))))), 3.0);
}
return tmp;
}
d_m = abs(d) w0, M, D, h, l, d_m = sort([w0, M, D, h, l, d_m]) function code(w0, M, D, h, l, d_m) tmp = 0.0 if ((Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0) <= 5e+220) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64((Float64(0.5 * Float64(D / Float64(d_m / M))) ^ 2.0) * h) / l)))); else tmp = Float64(cbrt(w0) * (exp(0.16666666666666666) ^ fma(-2.0, log(d_m), log(Float64(-0.25 * Float64(Float64(h * (Float64(M * D) ^ 2.0)) / l)))))) ^ 3.0; end return tmp end
d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d$95$m_] := If[LessEqual[N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], 5e+220], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[Power[N[(0.5 * N[(D / N[(d$95$m / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(N[Power[w0, 1/3], $MachinePrecision] * N[Power[N[Exp[0.16666666666666666], $MachinePrecision], N[(-2.0 * N[Log[d$95$m], $MachinePrecision] + N[Log[N[(-0.25 * N[(N[(h * N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
[w0, M, D, h, l, d_m] = \mathsf{sort}([w0, M, D, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d_m}\right)}^{2} \leq 5 \cdot 10^{+220}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{{\left(0.5 \cdot \frac{D}{\frac{d_m}{M}}\right)}^{2} \cdot h}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\mathsf{fma}\left(-2, \log d_m, \log \left(-0.25 \cdot \frac{h \cdot {\left(M \cdot D\right)}^{2}}{\ell}\right)\right)\right)}\right)}^{3}\\
\end{array}
\end{array}
if (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) < 5.0000000000000002e220Initial program 91.5%
Simplified90.4%
associate-*r/96.4%
associate-*l/96.6%
div-inv96.6%
associate-*l*96.4%
associate-/r*96.4%
metadata-eval96.4%
Applied egg-rr96.4%
Taylor expanded in M around 0 96.6%
associate-/l*96.9%
Simplified96.9%
if 5.0000000000000002e220 < (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) Initial program 50.3%
Simplified49.0%
associate-*r/53.8%
associate-*l/55.2%
div-inv55.2%
associate-*l*55.2%
associate-/r*55.2%
metadata-eval55.2%
Applied egg-rr55.2%
add-sqr-sqrt24.4%
pow224.4%
sqrt-prod24.4%
unpow224.4%
sqrt-prod13.7%
add-sqr-sqrt27.2%
associate-*r/27.2%
Applied egg-rr27.2%
add-cube-cbrt27.0%
pow327.0%
Applied egg-rr55.2%
Taylor expanded in d around 0 15.5%
unpow1/331.3%
*-lft-identity31.3%
exp-prod31.0%
+-commutative31.0%
fma-def31.0%
distribute-lft-neg-in31.0%
metadata-eval31.0%
associate-*r*29.8%
*-commutative29.8%
unpow229.8%
unpow229.8%
swap-sqr38.3%
unpow238.3%
*-commutative38.3%
Simplified38.3%
Final simplification80.9%
d_m = (fabs.f64 d) NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d_m) :precision binary64 (* w0 (sqrt (- 1.0 (* h (/ 0.25 (/ l (pow (/ D (/ d_m M)) 2.0))))))))
d_m = fabs(d);
assert(w0 < M && M < D && D < h && h < l && l < d_m);
double code(double w0, double M, double D, double h, double l, double d_m) {
return w0 * sqrt((1.0 - (h * (0.25 / (l / pow((D / (d_m / M)), 2.0))))));
}
d_m = abs(d)
NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_m)
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_m
code = w0 * sqrt((1.0d0 - (h * (0.25d0 / (l / ((d / (d_m / m)) ** 2.0d0))))))
end function
d_m = Math.abs(d);
assert w0 < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0, double M, double D, double h, double l, double d_m) {
return w0 * Math.sqrt((1.0 - (h * (0.25 / (l / Math.pow((D / (d_m / M)), 2.0))))));
}
d_m = math.fabs(d) [w0, M, D, h, l, d_m] = sort([w0, M, D, h, l, d_m]) def code(w0, M, D, h, l, d_m): return w0 * math.sqrt((1.0 - (h * (0.25 / (l / math.pow((D / (d_m / M)), 2.0))))))
d_m = abs(d) w0, M, D, h, l, d_m = sort([w0, M, D, h, l, d_m]) function code(w0, M, D, h, l, d_m) return Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(0.25 / Float64(l / (Float64(D / Float64(d_m / M)) ^ 2.0))))))) end
d_m = abs(d);
w0, M, D, h, l, d_m = num2cell(sort([w0, M, D, h, l, d_m])){:}
function tmp = code(w0, M, D, h, l, d_m)
tmp = w0 * sqrt((1.0 - (h * (0.25 / (l / ((D / (d_m / M)) ^ 2.0))))));
end
d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(0.25 / N[(l / N[Power[N[(D / N[(d$95$m / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
[w0, M, D, h, l, d_m] = \mathsf{sort}([w0, M, D, h, l, d_m])\\
\\
w0 \cdot \sqrt{1 - h \cdot \frac{0.25}{\frac{\ell}{{\left(\frac{D}{\frac{d_m}{M}}\right)}^{2}}}}
\end{array}
Initial program 80.2%
Simplified79.1%
expm1-log1p-u61.3%
expm1-udef61.3%
log1p-udef61.3%
add-exp-log79.1%
+-commutative79.1%
associate-*l/80.2%
div-inv80.2%
associate-*l*79.4%
associate-/r*79.4%
metadata-eval79.4%
Applied egg-rr79.4%
associate--l+79.4%
metadata-eval79.4%
+-rgt-identity79.4%
associate-*r/85.1%
associate-*l/84.7%
*-commutative84.7%
associate-*r*84.9%
*-commutative84.9%
associate-*l/84.9%
*-commutative84.9%
associate-*r/84.9%
associate-*r/84.4%
Simplified84.4%
expm1-log1p-u84.1%
expm1-udef84.0%
unpow-prod-down84.0%
metadata-eval84.0%
associate-*r/84.7%
Applied egg-rr84.7%
expm1-def84.7%
expm1-log1p84.9%
associate-/l*84.9%
associate-/l*84.7%
Simplified84.7%
Final simplification84.7%
d_m = (fabs.f64 d) NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d_m) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* (pow (* 0.5 (/ D (/ d_m M))) 2.0) h) l)))))
d_m = fabs(d);
assert(w0 < M && M < D && D < h && h < l && l < d_m);
double code(double w0, double M, double D, double h, double l, double d_m) {
return w0 * sqrt((1.0 - ((pow((0.5 * (D / (d_m / M))), 2.0) * h) / l)));
}
d_m = abs(d)
NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_m)
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_m
code = w0 * sqrt((1.0d0 - ((((0.5d0 * (d / (d_m / m))) ** 2.0d0) * h) / l)))
end function
d_m = Math.abs(d);
assert w0 < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0, double M, double D, double h, double l, double d_m) {
return w0 * Math.sqrt((1.0 - ((Math.pow((0.5 * (D / (d_m / M))), 2.0) * h) / l)));
}
d_m = math.fabs(d) [w0, M, D, h, l, d_m] = sort([w0, M, D, h, l, d_m]) def code(w0, M, D, h, l, d_m): return w0 * math.sqrt((1.0 - ((math.pow((0.5 * (D / (d_m / M))), 2.0) * h) / l)))
d_m = abs(d) w0, M, D, h, l, d_m = sort([w0, M, D, h, l, d_m]) function code(w0, M, D, h, l, d_m) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64((Float64(0.5 * Float64(D / Float64(d_m / M))) ^ 2.0) * h) / l)))) end
d_m = abs(d);
w0, M, D, h, l, d_m = num2cell(sort([w0, M, D, h, l, d_m])){:}
function tmp = code(w0, M, D, h, l, d_m)
tmp = w0 * sqrt((1.0 - ((((0.5 * (D / (d_m / M))) ^ 2.0) * h) / l)));
end
d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[Power[N[(0.5 * N[(D / N[(d$95$m / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
[w0, M, D, h, l, d_m] = \mathsf{sort}([w0, M, D, h, l, d_m])\\
\\
w0 \cdot \sqrt{1 - \frac{{\left(0.5 \cdot \frac{D}{\frac{d_m}{M}}\right)}^{2} \cdot h}{\ell}}
\end{array}
Initial program 80.2%
Simplified79.1%
associate-*r/84.7%
associate-*l/85.3%
div-inv85.3%
associate-*l*85.1%
associate-/r*85.1%
metadata-eval85.1%
Applied egg-rr85.1%
Taylor expanded in M around 0 85.3%
associate-/l*85.1%
Simplified85.1%
Final simplification85.1%
d_m = (fabs.f64 d) NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d_m) :precision binary64 (if (<= (/ h l) -1e-311) (+ w0 (* -0.125 (* (pow (* M (/ D d_m)) 2.0) (* w0 (/ h l))))) w0))
d_m = fabs(d);
assert(w0 < M && M < D && D < h && h < l && l < d_m);
double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if ((h / l) <= -1e-311) {
tmp = w0 + (-0.125 * (pow((M * (D / d_m)), 2.0) * (w0 * (h / l))));
} else {
tmp = w0;
}
return tmp;
}
d_m = abs(d)
NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_m)
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_m
real(8) :: tmp
if ((h / l) <= (-1d-311)) then
tmp = w0 + ((-0.125d0) * (((m * (d / d_m)) ** 2.0d0) * (w0 * (h / l))))
else
tmp = w0
end if
code = tmp
end function
d_m = Math.abs(d);
assert w0 < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if ((h / l) <= -1e-311) {
tmp = w0 + (-0.125 * (Math.pow((M * (D / d_m)), 2.0) * (w0 * (h / l))));
} else {
tmp = w0;
}
return tmp;
}
d_m = math.fabs(d) [w0, M, D, h, l, d_m] = sort([w0, M, D, h, l, d_m]) def code(w0, M, D, h, l, d_m): tmp = 0 if (h / l) <= -1e-311: tmp = w0 + (-0.125 * (math.pow((M * (D / d_m)), 2.0) * (w0 * (h / l)))) else: tmp = w0 return tmp
d_m = abs(d) w0, M, D, h, l, d_m = sort([w0, M, D, h, l, d_m]) function code(w0, M, D, h, l, d_m) tmp = 0.0 if (Float64(h / l) <= -1e-311) tmp = Float64(w0 + Float64(-0.125 * Float64((Float64(M * Float64(D / d_m)) ^ 2.0) * Float64(w0 * Float64(h / l))))); else tmp = w0; end return tmp end
d_m = abs(d);
w0, M, D, h, l, d_m = num2cell(sort([w0, M, D, h, l, d_m])){:}
function tmp_2 = code(w0, M, D, h, l, d_m)
tmp = 0.0;
if ((h / l) <= -1e-311)
tmp = w0 + (-0.125 * (((M * (D / d_m)) ^ 2.0) * (w0 * (h / l))));
else
tmp = w0;
end
tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d$95$m_] := If[LessEqual[N[(h / l), $MachinePrecision], -1e-311], N[(w0 + N[(-0.125 * N[(N[Power[N[(M * N[(D / d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(w0 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
d_m = \left|d\right|
\\
[w0, M, D, h, l, d_m] = \mathsf{sort}([w0, M, D, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{-311}:\\
\;\;\;\;w0 + -0.125 \cdot \left({\left(M \cdot \frac{D}{d_m}\right)}^{2} \cdot \left(w0 \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -9.99999999999948e-312Initial program 76.0%
Simplified75.4%
Taylor expanded in M around 0 53.2%
add-sqr-sqrt40.6%
pow240.6%
sqrt-prod37.2%
unpow237.2%
sqrt-prod16.4%
add-sqr-sqrt37.4%
sqrt-prod28.6%
unpow228.6%
sqrt-prod18.4%
add-sqr-sqrt31.4%
Applied egg-rr31.4%
Taylor expanded in D around 0 53.2%
associate-*r*53.2%
times-frac51.9%
unpow251.9%
unpow251.9%
swap-sqr58.9%
unpow258.9%
times-frac66.7%
associate-*l/66.7%
associate-*l/66.7%
unpow266.7%
*-commutative66.7%
Simplified66.7%
expm1-log1p-u55.2%
expm1-udef54.7%
associate-/l*53.4%
Applied egg-rr53.4%
expm1-def53.9%
expm1-log1p65.2%
associate-/r/67.1%
Simplified67.1%
if -9.99999999999948e-312 < (/.f64 h l) Initial program 86.0%
Simplified84.2%
Taylor expanded in M around 0 91.3%
Final simplification77.2%
d_m = (fabs.f64 d) NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d_m) :precision binary64 (if (<= (/ h l) -5e-324) (+ w0 (* -0.125 (/ (* (pow (* M (/ D d_m)) 2.0) (* w0 h)) l))) w0))
d_m = fabs(d);
assert(w0 < M && M < D && D < h && h < l && l < d_m);
double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if ((h / l) <= -5e-324) {
tmp = w0 + (-0.125 * ((pow((M * (D / d_m)), 2.0) * (w0 * h)) / l));
} else {
tmp = w0;
}
return tmp;
}
d_m = abs(d)
NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_m)
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_m
real(8) :: tmp
if ((h / l) <= (-5d-324)) then
tmp = w0 + ((-0.125d0) * ((((m * (d / d_m)) ** 2.0d0) * (w0 * h)) / l))
else
tmp = w0
end if
code = tmp
end function
d_m = Math.abs(d);
assert w0 < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if ((h / l) <= -5e-324) {
tmp = w0 + (-0.125 * ((Math.pow((M * (D / d_m)), 2.0) * (w0 * h)) / l));
} else {
tmp = w0;
}
return tmp;
}
d_m = math.fabs(d) [w0, M, D, h, l, d_m] = sort([w0, M, D, h, l, d_m]) def code(w0, M, D, h, l, d_m): tmp = 0 if (h / l) <= -5e-324: tmp = w0 + (-0.125 * ((math.pow((M * (D / d_m)), 2.0) * (w0 * h)) / l)) else: tmp = w0 return tmp
d_m = abs(d) w0, M, D, h, l, d_m = sort([w0, M, D, h, l, d_m]) function code(w0, M, D, h, l, d_m) tmp = 0.0 if (Float64(h / l) <= -5e-324) tmp = Float64(w0 + Float64(-0.125 * Float64(Float64((Float64(M * Float64(D / d_m)) ^ 2.0) * Float64(w0 * h)) / l))); else tmp = w0; end return tmp end
d_m = abs(d);
w0, M, D, h, l, d_m = num2cell(sort([w0, M, D, h, l, d_m])){:}
function tmp_2 = code(w0, M, D, h, l, d_m)
tmp = 0.0;
if ((h / l) <= -5e-324)
tmp = w0 + (-0.125 * ((((M * (D / d_m)) ^ 2.0) * (w0 * h)) / l));
else
tmp = w0;
end
tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d$95$m_] := If[LessEqual[N[(h / l), $MachinePrecision], -5e-324], N[(w0 + N[(-0.125 * N[(N[(N[Power[N[(M * N[(D / d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(w0 * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
d_m = \left|d\right|
\\
[w0, M, D, h, l, d_m] = \mathsf{sort}([w0, M, D, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-324}:\\
\;\;\;\;w0 + -0.125 \cdot \frac{{\left(M \cdot \frac{D}{d_m}\right)}^{2} \cdot \left(w0 \cdot h\right)}{\ell}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -4.94066e-324Initial program 75.7%
Simplified75.1%
Taylor expanded in M around 0 52.5%
add-sqr-sqrt40.1%
pow240.1%
sqrt-prod36.8%
unpow236.8%
sqrt-prod16.2%
add-sqr-sqrt37.6%
sqrt-prod28.9%
unpow228.9%
sqrt-prod18.1%
add-sqr-sqrt31.7%
Applied egg-rr31.7%
Taylor expanded in D around 0 52.5%
associate-*r*52.5%
times-frac51.2%
unpow251.2%
unpow251.2%
swap-sqr58.8%
unpow258.8%
times-frac66.5%
associate-*l/66.4%
associate-*l/66.4%
unpow266.4%
*-commutative66.4%
Simplified66.4%
associate-*r/69.6%
Applied egg-rr69.6%
if -4.94066e-324 < (/.f64 h l) Initial program 86.7%
Simplified84.8%
Taylor expanded in M around 0 92.0%
Final simplification78.8%
d_m = (fabs.f64 d) NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d_m) :precision binary64 (if (<= D 2.6e+122) w0 (+ w0 (* -0.125 (* (pow (/ (* M D) d_m) 2.0) (/ (* w0 h) l))))))
d_m = fabs(d);
assert(w0 < M && M < D && D < h && h < l && l < d_m);
double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if (D <= 2.6e+122) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (pow(((M * D) / d_m), 2.0) * ((w0 * h) / l)));
}
return tmp;
}
d_m = abs(d)
NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_m)
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_m
real(8) :: tmp
if (d <= 2.6d+122) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * ((((m * d) / d_m) ** 2.0d0) * ((w0 * h) / l)))
end if
code = tmp
end function
d_m = Math.abs(d);
assert w0 < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0, double M, double D, double h, double l, double d_m) {
double tmp;
if (D <= 2.6e+122) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (Math.pow(((M * D) / d_m), 2.0) * ((w0 * h) / l)));
}
return tmp;
}
d_m = math.fabs(d) [w0, M, D, h, l, d_m] = sort([w0, M, D, h, l, d_m]) def code(w0, M, D, h, l, d_m): tmp = 0 if D <= 2.6e+122: tmp = w0 else: tmp = w0 + (-0.125 * (math.pow(((M * D) / d_m), 2.0) * ((w0 * h) / l))) return tmp
d_m = abs(d) w0, M, D, h, l, d_m = sort([w0, M, D, h, l, d_m]) function code(w0, M, D, h, l, d_m) tmp = 0.0 if (D <= 2.6e+122) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64((Float64(Float64(M * D) / d_m) ^ 2.0) * Float64(Float64(w0 * h) / l)))); end return tmp end
d_m = abs(d);
w0, M, D, h, l, d_m = num2cell(sort([w0, M, D, h, l, d_m])){:}
function tmp_2 = code(w0, M, D, h, l, d_m)
tmp = 0.0;
if (D <= 2.6e+122)
tmp = w0;
else
tmp = w0 + (-0.125 * ((((M * D) / d_m) ^ 2.0) * ((w0 * h) / l)));
end
tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d$95$m_] := If[LessEqual[D, 2.6e+122], w0, N[(w0 + N[(-0.125 * N[(N[Power[N[(N[(M * D), $MachinePrecision] / d$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(w0 * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
[w0, M, D, h, l, d_m] = \mathsf{sort}([w0, M, D, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 2.6 \cdot 10^{+122}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left({\left(\frac{M \cdot D}{d_m}\right)}^{2} \cdot \frac{w0 \cdot h}{\ell}\right)\\
\end{array}
\end{array}
if D < 2.60000000000000007e122Initial program 81.5%
Simplified80.2%
Taylor expanded in M around 0 70.6%
if 2.60000000000000007e122 < D Initial program 70.1%
Simplified70.1%
Taylor expanded in M around 0 32.0%
add-sqr-sqrt14.0%
pow214.0%
sqrt-prod14.0%
unpow214.0%
sqrt-prod31.6%
add-sqr-sqrt31.6%
sqrt-prod20.8%
unpow220.8%
sqrt-prod13.8%
add-sqr-sqrt21.2%
Applied egg-rr21.2%
Taylor expanded in D around 0 32.0%
associate-*r*32.0%
times-frac31.7%
unpow231.7%
unpow231.7%
swap-sqr49.5%
unpow249.5%
times-frac70.3%
associate-*l/66.8%
associate-*l/66.8%
unpow266.8%
*-commutative66.8%
Simplified66.8%
associate-*r/70.3%
Applied egg-rr70.3%
Final simplification70.6%
d_m = (fabs.f64 d) NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d_m) :precision binary64 (let* ((t_0 (* M (/ D d_m)))) (if (<= M 1.8e-94) w0 (+ w0 (* -0.125 (* (/ (* w0 h) l) (* t_0 t_0)))))))
d_m = fabs(d);
assert(w0 < M && M < D && D < h && h < l && l < d_m);
double code(double w0, double M, double D, double h, double l, double d_m) {
double t_0 = M * (D / d_m);
double tmp;
if (M <= 1.8e-94) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((w0 * h) / l) * (t_0 * t_0)));
}
return tmp;
}
d_m = abs(d)
NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = m * (d / d_m)
if (m <= 1.8d-94) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((w0 * h) / l) * (t_0 * t_0)))
end if
code = tmp
end function
d_m = Math.abs(d);
assert w0 < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0, double M, double D, double h, double l, double d_m) {
double t_0 = M * (D / d_m);
double tmp;
if (M <= 1.8e-94) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((w0 * h) / l) * (t_0 * t_0)));
}
return tmp;
}
d_m = math.fabs(d) [w0, M, D, h, l, d_m] = sort([w0, M, D, h, l, d_m]) def code(w0, M, D, h, l, d_m): t_0 = M * (D / d_m) tmp = 0 if M <= 1.8e-94: tmp = w0 else: tmp = w0 + (-0.125 * (((w0 * h) / l) * (t_0 * t_0))) return tmp
d_m = abs(d) w0, M, D, h, l, d_m = sort([w0, M, D, h, l, d_m]) function code(w0, M, D, h, l, d_m) t_0 = Float64(M * Float64(D / d_m)) tmp = 0.0 if (M <= 1.8e-94) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(Float64(w0 * h) / l) * Float64(t_0 * t_0)))); end return tmp end
d_m = abs(d);
w0, M, D, h, l, d_m = num2cell(sort([w0, M, D, h, l, d_m])){:}
function tmp_2 = code(w0, M, D, h, l, d_m)
t_0 = M * (D / d_m);
tmp = 0.0;
if (M <= 1.8e-94)
tmp = w0;
else
tmp = w0 + (-0.125 * (((w0 * h) / l) * (t_0 * t_0)));
end
tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(M * N[(D / d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 1.8e-94], w0, N[(w0 + N[(-0.125 * N[(N[(N[(w0 * h), $MachinePrecision] / l), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
[w0, M, D, h, l, d_m] = \mathsf{sort}([w0, M, D, h, l, d_m])\\
\\
\begin{array}{l}
t_0 := M \cdot \frac{D}{d_m}\\
\mathbf{if}\;M \leq 1.8 \cdot 10^{-94}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\frac{w0 \cdot h}{\ell} \cdot \left(t_0 \cdot t_0\right)\right)\\
\end{array}
\end{array}
if M < 1.8e-94Initial program 82.0%
Simplified82.0%
Taylor expanded in M around 0 69.9%
if 1.8e-94 < M Initial program 76.1%
Simplified72.3%
Taylor expanded in M around 0 49.3%
add-sqr-sqrt34.9%
pow234.9%
sqrt-prod32.3%
unpow232.3%
sqrt-prod19.2%
add-sqr-sqrt33.5%
sqrt-prod33.5%
unpow233.5%
sqrt-prod37.4%
add-sqr-sqrt37.4%
Applied egg-rr37.4%
Taylor expanded in D around 0 49.3%
associate-*r*51.9%
times-frac48.0%
unpow248.0%
unpow248.0%
swap-sqr59.7%
unpow259.7%
times-frac63.8%
associate-*l/63.8%
associate-*l/63.8%
unpow263.8%
*-commutative63.8%
Simplified63.8%
unpow263.8%
Applied egg-rr63.8%
Final simplification68.0%
d_m = (fabs.f64 d) NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d_m) :precision binary64 w0)
d_m = fabs(d);
assert(w0 < M && M < D && D < h && h < l && l < d_m);
double code(double w0, double M, double D, double h, double l, double d_m) {
return w0;
}
d_m = abs(d)
NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_m)
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_m
code = w0
end function
d_m = Math.abs(d);
assert w0 < M && M < D && D < h && h < l && l < d_m;
public static double code(double w0, double M, double D, double h, double l, double d_m) {
return w0;
}
d_m = math.fabs(d) [w0, M, D, h, l, d_m] = sort([w0, M, D, h, l, d_m]) def code(w0, M, D, h, l, d_m): return w0
d_m = abs(d) w0, M, D, h, l, d_m = sort([w0, M, D, h, l, d_m]) function code(w0, M, D, h, l, d_m) return w0 end
d_m = abs(d);
w0, M, D, h, l, d_m = num2cell(sort([w0, M, D, h, l, d_m])){:}
function tmp = code(w0, M, D, h, l, d_m)
tmp = w0;
end
d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M, D, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d$95$m_] := w0
\begin{array}{l}
d_m = \left|d\right|
\\
[w0, M, D, h, l, d_m] = \mathsf{sort}([w0, M, D, h, l, d_m])\\
\\
w0
\end{array}
Initial program 80.2%
Simplified79.1%
Taylor expanded in M around 0 67.0%
Final simplification67.0%
herbie shell --seed 2023326
(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))))))