
(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 5 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_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D_m h l d) :precision binary64 (if (<= h -5e-310) (* w0 (sqrt (- 1.0 (/ (* h (pow (* M (* 0.5 (/ D_m d))) 2.0)) l)))) (* w0 (sqrt (- 1.0 (/ (pow (* (* 0.5 (* D_m (/ M d))) (sqrt h)) 2.0) l))))))
D_m = fabs(D);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d);
double code(double w0, double M, double D_m, double h, double l, double d) {
double tmp;
if (h <= -5e-310) {
tmp = w0 * sqrt((1.0 - ((h * pow((M * (0.5 * (D_m / d))), 2.0)) / l)));
} else {
tmp = w0 * sqrt((1.0 - (pow(((0.5 * (D_m * (M / d))) * sqrt(h)), 2.0) / l)));
}
return tmp;
}
D_m = abs(D)
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: tmp
if (h <= (-5d-310)) then
tmp = w0 * sqrt((1.0d0 - ((h * ((m * (0.5d0 * (d_m / d))) ** 2.0d0)) / l)))
else
tmp = w0 * sqrt((1.0d0 - ((((0.5d0 * (d_m * (m / d))) * sqrt(h)) ** 2.0d0) / l)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert w0 < M && M < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M, double D_m, double h, double l, double d) {
double tmp;
if (h <= -5e-310) {
tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow((M * (0.5 * (D_m / d))), 2.0)) / l)));
} else {
tmp = w0 * Math.sqrt((1.0 - (Math.pow(((0.5 * (D_m * (M / d))) * Math.sqrt(h)), 2.0) / l)));
}
return tmp;
}
D_m = math.fabs(D) [w0, M, D_m, h, l, d] = sort([w0, M, D_m, h, l, d]) def code(w0, M, D_m, h, l, d): tmp = 0 if h <= -5e-310: tmp = w0 * math.sqrt((1.0 - ((h * math.pow((M * (0.5 * (D_m / d))), 2.0)) / l))) else: tmp = w0 * math.sqrt((1.0 - (math.pow(((0.5 * (D_m * (M / d))) * math.sqrt(h)), 2.0) / l))) return tmp
D_m = abs(D) w0, M, D_m, h, l, d = sort([w0, M, D_m, h, l, d]) function code(w0, M, D_m, h, l, d) tmp = 0.0 if (h <= -5e-310) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(M * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(0.5 * Float64(D_m * Float64(M / d))) * sqrt(h)) ^ 2.0) / l)))); end return tmp end
D_m = abs(D);
w0, M, D_m, h, l, d = num2cell(sort([w0, M, D_m, h, l, d])){:}
function tmp_2 = code(w0, M, D_m, h, l, d)
tmp = 0.0;
if (h <= -5e-310)
tmp = w0 * sqrt((1.0 - ((h * ((M * (0.5 * (D_m / d))) ^ 2.0)) / l)));
else
tmp = w0 * sqrt((1.0 - ((((0.5 * (D_m * (M / d))) * sqrt(h)) ^ 2.0) / l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D$95$m_, h_, l_, d_] := If[LessEqual[h, -5e-310], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(M * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(0.5 * N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[w0, M, D_m, h, l, d] = \mathsf{sort}([w0, M, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(M \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{{\left(\left(0.5 \cdot \left(D\_m \cdot \frac{M}{d}\right)\right) \cdot \sqrt{h}\right)}^{2}}{\ell}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 79.5%
Simplified81.2%
associate-*r/84.5%
add-sqr-sqrt84.5%
pow284.5%
unpow284.5%
sqrt-prod46.3%
add-sqr-sqrt84.5%
*-un-lft-identity84.5%
times-frac84.5%
metadata-eval84.5%
Applied egg-rr84.5%
if -4.999999999999985e-310 < h Initial program 79.4%
Simplified77.4%
associate-*r/85.3%
add-sqr-sqrt85.3%
pow285.3%
unpow285.3%
sqrt-prod53.0%
add-sqr-sqrt85.3%
*-un-lft-identity85.3%
times-frac85.3%
metadata-eval85.3%
Applied egg-rr85.3%
add-sqr-sqrt85.3%
pow285.3%
sqrt-prod85.3%
unpow285.3%
sqrt-prod55.8%
add-sqr-sqrt88.7%
associate-*r/88.7%
Applied egg-rr88.7%
Taylor expanded in M around 0 90.7%
associate-/l*89.9%
Simplified89.9%
Final simplification87.3%
D_m = (fabs.f64 D) NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D_m h l d) :precision binary64 (if (<= (* (pow (/ (* M D_m) (* d 2.0)) 2.0) (/ h l)) -200.0) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ M d) (* 0.5 D_m)) 2.0))))) w0))
D_m = fabs(D);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d);
double code(double w0, double M, double D_m, double h, double l, double d) {
double tmp;
if ((pow(((M * D_m) / (d * 2.0)), 2.0) * (h / l)) <= -200.0) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((M / d) * (0.5 * D_m)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
D_m = abs(D)
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: tmp
if (((((m * d_m) / (d * 2.0d0)) ** 2.0d0) * (h / l)) <= (-200.0d0)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (((m / d) * (0.5d0 * d_m)) ** 2.0d0))))
else
tmp = w0
end if
code = tmp
end function
D_m = Math.abs(D);
assert w0 < M && M < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M, double D_m, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D_m) / (d * 2.0)), 2.0) * (h / l)) <= -200.0) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M / d) * (0.5 * D_m)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
D_m = math.fabs(D) [w0, M, D_m, h, l, d] = sort([w0, M, D_m, h, l, d]) def code(w0, M, D_m, h, l, d): tmp = 0 if (math.pow(((M * D_m) / (d * 2.0)), 2.0) * (h / l)) <= -200.0: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M / d) * (0.5 * D_m)), 2.0)))) else: tmp = w0 return tmp
D_m = abs(D) w0, M, D_m, h, l, d = sort([w0, M, D_m, h, l, d]) function code(w0, M, D_m, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l)) <= -200.0) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M / d) * Float64(0.5 * D_m)) ^ 2.0))))); else tmp = w0; end return tmp end
D_m = abs(D);
w0, M, D_m, h, l, d = num2cell(sort([w0, M, D_m, h, l, d])){:}
function tmp_2 = code(w0, M, D_m, h, l, d)
tmp = 0.0;
if (((((M * D_m) / (d * 2.0)) ^ 2.0) * (h / l)) <= -200.0)
tmp = w0 * sqrt((1.0 - ((h / l) * (((M / d) * (0.5 * D_m)) ^ 2.0))));
else
tmp = w0;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -200.0], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(0.5 * D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
D_m = \left|D\right|
\\
[w0, M, D_m, h, l, d] = \mathsf{sort}([w0, M, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq -200:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \left(0.5 \cdot D\_m\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -200Initial program 65.6%
*-commutative65.6%
times-frac66.8%
div-inv66.8%
metadata-eval66.8%
Applied egg-rr66.8%
if -200 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 85.8%
Simplified86.4%
Taylor expanded in M around 0 95.6%
Final simplification86.6%
D_m = (fabs.f64 D) NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D_m h l d) :precision binary64 (if (<= (/ h l) -5e-198) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* M (/ D_m (* d 2.0))) 2.0))))) w0))
D_m = fabs(D);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d);
double code(double w0, double M, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -5e-198) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow((M * (D_m / (d * 2.0))), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
D_m = abs(D)
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: tmp
if ((h / l) <= (-5d-198)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((m * (d_m / (d * 2.0d0))) ** 2.0d0))))
else
tmp = w0
end if
code = tmp
end function
D_m = Math.abs(D);
assert w0 < M && M < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -5e-198) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((M * (D_m / (d * 2.0))), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
D_m = math.fabs(D) [w0, M, D_m, h, l, d] = sort([w0, M, D_m, h, l, d]) def code(w0, M, D_m, h, l, d): tmp = 0 if (h / l) <= -5e-198: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((M * (D_m / (d * 2.0))), 2.0)))) else: tmp = w0 return tmp
D_m = abs(D) w0, M, D_m, h, l, d = sort([w0, M, D_m, h, l, d]) function code(w0, M, D_m, h, l, d) tmp = 0.0 if (Float64(h / l) <= -5e-198) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(M * Float64(D_m / Float64(d * 2.0))) ^ 2.0))))); else tmp = w0; end return tmp end
D_m = abs(D);
w0, M, D_m, h, l, d = num2cell(sort([w0, M, D_m, h, l, d])){:}
function tmp_2 = code(w0, M, D_m, h, l, d)
tmp = 0.0;
if ((h / l) <= -5e-198)
tmp = w0 * sqrt((1.0 - ((h / l) * ((M * (D_m / (d * 2.0))) ^ 2.0))));
else
tmp = w0;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -5e-198], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(D$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
D_m = \left|D\right|
\\
[w0, M, D_m, h, l, d] = \mathsf{sort}([w0, M, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-198}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(M \cdot \frac{D\_m}{d \cdot 2}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -4.9999999999999999e-198Initial program 76.8%
Simplified74.9%
if -4.9999999999999999e-198 < (/.f64 h l) Initial program 82.3%
Simplified83.9%
Taylor expanded in M around 0 93.6%
Final simplification83.9%
D_m = (fabs.f64 D) NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D_m h l d) :precision binary64 (if (<= d 1.02e-84) (* w0 (+ 1.0 (* (* (pow D_m 2.0) (* h (* (/ M d) (/ (/ M d) l)))) -0.125))) w0))
D_m = fabs(D);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d);
double code(double w0, double M, double D_m, double h, double l, double d) {
double tmp;
if (d <= 1.02e-84) {
tmp = w0 * (1.0 + ((pow(D_m, 2.0) * (h * ((M / d) * ((M / d) / l)))) * -0.125));
} else {
tmp = w0;
}
return tmp;
}
D_m = abs(D)
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: tmp
if (d <= 1.02d-84) then
tmp = w0 * (1.0d0 + (((d_m ** 2.0d0) * (h * ((m / d) * ((m / d) / l)))) * (-0.125d0)))
else
tmp = w0
end if
code = tmp
end function
D_m = Math.abs(D);
assert w0 < M && M < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M, double D_m, double h, double l, double d) {
double tmp;
if (d <= 1.02e-84) {
tmp = w0 * (1.0 + ((Math.pow(D_m, 2.0) * (h * ((M / d) * ((M / d) / l)))) * -0.125));
} else {
tmp = w0;
}
return tmp;
}
D_m = math.fabs(D) [w0, M, D_m, h, l, d] = sort([w0, M, D_m, h, l, d]) def code(w0, M, D_m, h, l, d): tmp = 0 if d <= 1.02e-84: tmp = w0 * (1.0 + ((math.pow(D_m, 2.0) * (h * ((M / d) * ((M / d) / l)))) * -0.125)) else: tmp = w0 return tmp
D_m = abs(D) w0, M, D_m, h, l, d = sort([w0, M, D_m, h, l, d]) function code(w0, M, D_m, h, l, d) tmp = 0.0 if (d <= 1.02e-84) tmp = Float64(w0 * Float64(1.0 + Float64(Float64((D_m ^ 2.0) * Float64(h * Float64(Float64(M / d) * Float64(Float64(M / d) / l)))) * -0.125))); else tmp = w0; end return tmp end
D_m = abs(D);
w0, M, D_m, h, l, d = num2cell(sort([w0, M, D_m, h, l, d])){:}
function tmp_2 = code(w0, M, D_m, h, l, d)
tmp = 0.0;
if (d <= 1.02e-84)
tmp = w0 * (1.0 + (((D_m ^ 2.0) * (h * ((M / d) * ((M / d) / l)))) * -0.125));
else
tmp = w0;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D$95$m_, h_, l_, d_] := If[LessEqual[d, 1.02e-84], N[(w0 * N[(1.0 + N[(N[(N[Power[D$95$m, 2.0], $MachinePrecision] * N[(h * N[(N[(M / d), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
D_m = \left|D\right|
\\
[w0, M, D_m, h, l, d] = \mathsf{sort}([w0, M, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.02 \cdot 10^{-84}:\\
\;\;\;\;w0 \cdot \left(1 + \left({D\_m}^{2} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \frac{\frac{M}{d}}{\ell}\right)\right)\right) \cdot -0.125\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if d < 1.02000000000000004e-84Initial program 79.8%
Simplified79.2%
Taylor expanded in M around 0 50.7%
*-commutative50.7%
associate-/l*50.8%
Simplified50.8%
*-commutative50.8%
associate-*r/50.9%
*-commutative50.9%
associate-/r*53.9%
unpow253.9%
unpow253.9%
frac-times63.0%
pow263.0%
Applied egg-rr63.0%
unpow263.0%
Applied egg-rr63.0%
associate-/l*64.1%
Applied egg-rr64.1%
if 1.02000000000000004e-84 < d Initial program 78.9%
Simplified79.2%
Taylor expanded in M around 0 77.8%
Final simplification68.8%
D_m = (fabs.f64 D) NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D_m h l d) :precision binary64 w0)
D_m = fabs(D);
assert(w0 < M && M < D_m && D_m < h && h < l && l < d);
double code(double w0, double M, double D_m, double h, double l, double d) {
return w0;
}
D_m = abs(D)
NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
code = w0
end function
D_m = Math.abs(D);
assert w0 < M && M < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M, double D_m, double h, double l, double d) {
return w0;
}
D_m = math.fabs(D) [w0, M, D_m, h, l, d] = sort([w0, M, D_m, h, l, d]) def code(w0, M, D_m, h, l, d): return w0
D_m = abs(D) w0, M, D_m, h, l, d = sort([w0, M, D_m, h, l, d]) function code(w0, M, D_m, h, l, d) return w0 end
D_m = abs(D);
w0, M, D_m, h, l, d = num2cell(sort([w0, M, D_m, h, l, d])){:}
function tmp = code(w0, M, D_m, h, l, d)
tmp = w0;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D$95$m_, h_, l_, d_] := w0
\begin{array}{l}
D_m = \left|D\right|
\\
[w0, M, D_m, h, l, d] = \mathsf{sort}([w0, M, D_m, h, l, d])\\
\\
w0
\end{array}
Initial program 79.5%
Simplified79.2%
Taylor expanded in M around 0 67.8%
Final simplification67.8%
herbie shell --seed 2024041
(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))))))