
(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 10 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}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (/ (* h (* (* M 0.5) (/ D d))) l) (* M (/ 0.5 (/ d D))))))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (((h * ((M * 0.5) * (D / d))) / l) * (M * (0.5 / (d / D))))));
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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 * ((m * 0.5d0) * (d / d_1))) / l) * (m * (0.5d0 / (d_1 / d))))))
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (((h * ((M * 0.5) * (D / d))) / l) * (M * (0.5 / (d / D))))));
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (((h * ((M * 0.5) * (D / d))) / l) * (M * (0.5 / (d / D))))))
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(h * Float64(Float64(M * 0.5) * Float64(D / d))) / l) * Float64(M * Float64(0.5 / Float64(d / D))))))) end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 - (((h * ((M * 0.5) * (D / d))) / l) * (M * (0.5 / (d / D))))));
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(h * N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(M * N[(0.5 / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
w0 \cdot \sqrt{1 - \frac{h \cdot \left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}{\ell} \cdot \left(M \cdot \frac{0.5}{\frac{d}{D}}\right)}
\end{array}
Initial program 82.1%
Simplified81.8%
associate-*r/86.7%
add-sqr-sqrt86.7%
pow286.7%
unpow286.7%
sqrt-prod51.6%
add-sqr-sqrt86.7%
*-un-lft-identity86.7%
times-frac86.7%
metadata-eval86.7%
Applied egg-rr86.7%
associate-*r/81.8%
*-commutative81.8%
unpow281.8%
associate-*r*84.1%
clear-num84.1%
un-div-inv84.1%
clear-num84.1%
un-div-inv84.1%
Applied egg-rr84.1%
associate-*l/91.1%
associate-*r/91.1%
div-inv91.1%
clear-num91.1%
Applied egg-rr91.1%
Final simplification91.1%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (* M D) 5e-19) w0 (+ w0 (* -0.125 (* (* (pow (* M (/ D d)) 2.0) (* w0 h)) (/ 1.0 l))))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((M * D) <= 5e-19) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((pow((M * (D / d)), 2.0) * (w0 * h)) * (1.0 / l)));
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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 ((m * d) <= 5d-19) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * ((((m * (d / d_1)) ** 2.0d0) * (w0 * h)) * (1.0d0 / l)))
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((M * D) <= 5e-19) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((Math.pow((M * (D / d)), 2.0) * (w0 * h)) * (1.0 / l)));
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): tmp = 0 if (M * D) <= 5e-19: tmp = w0 else: tmp = w0 + (-0.125 * ((math.pow((M * (D / d)), 2.0) * (w0 * h)) * (1.0 / l))) return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(M * D) <= 5e-19) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64((Float64(M * Float64(D / d)) ^ 2.0) * Float64(w0 * h)) * Float64(1.0 / l)))); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((M * D) <= 5e-19)
tmp = w0;
else
tmp = w0 + (-0.125 * ((((M * (D / d)) ^ 2.0) * (w0 * h)) * (1.0 / l)));
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(M * D), $MachinePrecision], 5e-19], w0, N[(w0 + N[(-0.125 * N[(N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(w0 * h), $MachinePrecision]), $MachinePrecision] * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M \cdot D \leq 5 \cdot 10^{-19}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left({\left(M \cdot \frac{D}{d}\right)}^{2} \cdot \left(w0 \cdot h\right)\right) \cdot \frac{1}{\ell}\right)\\
\end{array}
\end{array}
if (*.f64 M D) < 5.0000000000000004e-19Initial program 84.0%
Simplified83.1%
Taylor expanded in M around 0 74.8%
if 5.0000000000000004e-19 < (*.f64 M D) Initial program 73.7%
Simplified75.7%
Taylor expanded in M around 0 41.4%
times-frac43.1%
Simplified43.1%
associate-*r/43.2%
unpow243.2%
unpow243.2%
frac-times62.1%
pow262.1%
Applied egg-rr62.1%
div-inv62.1%
associate-*r*62.1%
pow-prod-down66.4%
Applied egg-rr66.4%
Final simplification73.2%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (* M (/ 0.5 (/ d D))) (* h (* M (/ (* D (/ 0.5 d)) l))))))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - ((M * (0.5 / (d / D))) * (h * (M * ((D * (0.5 / d)) / l))))));
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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 * (0.5d0 / (d_1 / d))) * (h * (m * ((d * (0.5d0 / d_1)) / l))))))
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - ((M * (0.5 / (d / D))) * (h * (M * ((D * (0.5 / d)) / l))))));
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - ((M * (0.5 / (d / D))) * (h * (M * ((D * (0.5 / d)) / l))))))
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M * Float64(0.5 / Float64(d / D))) * Float64(h * Float64(M * Float64(Float64(D * Float64(0.5 / d)) / l))))))) end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 - ((M * (0.5 / (d / D))) * (h * (M * ((D * (0.5 / d)) / l))))));
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M * N[(0.5 / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M * N[(N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
w0 \cdot \sqrt{1 - \left(M \cdot \frac{0.5}{\frac{d}{D}}\right) \cdot \left(h \cdot \left(M \cdot \frac{D \cdot \frac{0.5}{d}}{\ell}\right)\right)}
\end{array}
Initial program 82.1%
Simplified81.8%
associate-*r/86.7%
add-sqr-sqrt86.7%
pow286.7%
unpow286.7%
sqrt-prod51.6%
add-sqr-sqrt86.7%
*-un-lft-identity86.7%
times-frac86.7%
metadata-eval86.7%
Applied egg-rr86.7%
associate-*r/81.8%
*-commutative81.8%
unpow281.8%
associate-*r*84.1%
clear-num84.1%
un-div-inv84.1%
clear-num84.1%
un-div-inv84.1%
Applied egg-rr84.1%
associate-*l/91.1%
associate-*r/91.1%
div-inv91.1%
clear-num91.1%
Applied egg-rr91.1%
associate-*l*91.1%
clear-num91.1%
div-inv91.1%
associate-/l*89.6%
associate-*r/89.6%
Applied egg-rr89.6%
associate-/l*89.6%
associate-/l*87.6%
associate-/r/87.7%
Simplified87.7%
Final simplification87.7%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (* M (/ 0.5 (/ d D))) (* h (/ (/ (* M 0.5) (/ d D)) l)))))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - ((M * (0.5 / (d / D))) * (h * (((M * 0.5) / (d / D)) / l)))));
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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 * (0.5d0 / (d_1 / d))) * (h * (((m * 0.5d0) / (d_1 / d)) / l)))))
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - ((M * (0.5 / (d / D))) * (h * (((M * 0.5) / (d / D)) / l)))));
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - ((M * (0.5 / (d / D))) * (h * (((M * 0.5) / (d / D)) / l)))))
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M * Float64(0.5 / Float64(d / D))) * Float64(h * Float64(Float64(Float64(M * 0.5) / Float64(d / D)) / l)))))) end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 - ((M * (0.5 / (d / D))) * (h * (((M * 0.5) / (d / D)) / l)))));
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M * N[(0.5 / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(N[(M * 0.5), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
w0 \cdot \sqrt{1 - \left(M \cdot \frac{0.5}{\frac{d}{D}}\right) \cdot \left(h \cdot \frac{\frac{M \cdot 0.5}{\frac{d}{D}}}{\ell}\right)}
\end{array}
Initial program 82.1%
Simplified81.8%
associate-*r/86.7%
add-sqr-sqrt86.7%
pow286.7%
unpow286.7%
sqrt-prod51.6%
add-sqr-sqrt86.7%
*-un-lft-identity86.7%
times-frac86.7%
metadata-eval86.7%
Applied egg-rr86.7%
associate-*r/81.8%
*-commutative81.8%
unpow281.8%
associate-*r*84.1%
clear-num84.1%
un-div-inv84.1%
clear-num84.1%
un-div-inv84.1%
Applied egg-rr84.1%
associate-*l/91.1%
associate-*r/91.1%
div-inv91.1%
clear-num91.1%
Applied egg-rr91.1%
associate-*l*91.1%
clear-num91.1%
div-inv91.1%
associate-/l*89.6%
associate-*r/89.6%
Applied egg-rr89.6%
Final simplification89.6%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= D 4.2e+18) w0 (+ w0 (* -0.125 (* (pow (* D (/ M d)) 2.0) (* h (/ w0 l)))))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 4.2e+18) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (pow((D * (M / d)), 2.0) * (h * (w0 / l))));
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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 <= 4.2d+18) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((d * (m / d_1)) ** 2.0d0) * (h * (w0 / l))))
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 4.2e+18) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (Math.pow((D * (M / d)), 2.0) * (h * (w0 / l))));
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): tmp = 0 if D <= 4.2e+18: tmp = w0 else: tmp = w0 + (-0.125 * (math.pow((D * (M / d)), 2.0) * (h * (w0 / l)))) return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (D <= 4.2e+18) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64((Float64(D * Float64(M / d)) ^ 2.0) * Float64(h * Float64(w0 / l))))); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (D <= 4.2e+18)
tmp = w0;
else
tmp = w0 + (-0.125 * (((D * (M / d)) ^ 2.0) * (h * (w0 / l))));
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[D, 4.2e+18], w0, N[(w0 + N[(-0.125 * N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * N[(w0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 4.2 \cdot 10^{+18}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \left(h \cdot \frac{w0}{\ell}\right)\right)\\
\end{array}
\end{array}
if D < 4.2e18Initial program 85.3%
Simplified84.9%
Taylor expanded in M around 0 75.0%
if 4.2e18 < D Initial program 68.2%
Simplified68.4%
Taylor expanded in M around 0 35.7%
times-frac37.7%
Simplified37.7%
unpow237.7%
unpow237.7%
frac-times59.2%
Applied egg-rr59.2%
Taylor expanded in D around 0 35.7%
times-frac37.7%
associate-*r/37.6%
unpow237.6%
unpow237.6%
times-frac57.1%
unpow257.1%
associate-*r*57.0%
unpow257.0%
unpow257.0%
swap-sqr58.3%
unpow258.3%
associate-*l/58.2%
associate-/l*54.1%
Simplified54.1%
Taylor expanded in D around 0 37.5%
*-commutative37.5%
associate-/l*37.5%
unpow237.5%
unpow237.5%
unpow237.5%
times-frac53.0%
swap-sqr54.3%
unpow254.3%
*-commutative54.3%
associate-*l/54.1%
associate-*r/53.6%
Simplified53.6%
Final simplification70.9%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= D 6.9e+19) w0 (+ w0 (* -0.125 (* (pow (/ (* M D) d) 2.0) (* h (/ w0 l)))))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 6.9e+19) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (pow(((M * D) / d), 2.0) * (h * (w0 / l))));
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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 <= 6.9d+19) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * ((((m * d) / d_1) ** 2.0d0) * (h * (w0 / l))))
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 6.9e+19) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (Math.pow(((M * D) / d), 2.0) * (h * (w0 / l))));
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): tmp = 0 if D <= 6.9e+19: tmp = w0 else: tmp = w0 + (-0.125 * (math.pow(((M * D) / d), 2.0) * (h * (w0 / l)))) return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (D <= 6.9e+19) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64((Float64(Float64(M * D) / d) ^ 2.0) * Float64(h * Float64(w0 / l))))); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (D <= 6.9e+19)
tmp = w0;
else
tmp = w0 + (-0.125 * ((((M * D) / d) ^ 2.0) * (h * (w0 / l))));
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[D, 6.9e+19], w0, N[(w0 + N[(-0.125 * N[(N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * N[(w0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 6.9 \cdot 10^{+19}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot \left(h \cdot \frac{w0}{\ell}\right)\right)\\
\end{array}
\end{array}
if D < 6.9e19Initial program 85.3%
Simplified84.9%
Taylor expanded in M around 0 75.0%
if 6.9e19 < D Initial program 68.2%
Simplified68.4%
Taylor expanded in M around 0 35.7%
times-frac37.7%
Simplified37.7%
unpow237.7%
unpow237.7%
frac-times59.2%
Applied egg-rr59.2%
Taylor expanded in D around 0 35.7%
times-frac37.7%
associate-*r/37.6%
unpow237.6%
unpow237.6%
times-frac57.1%
unpow257.1%
associate-*r*57.0%
unpow257.0%
unpow257.0%
swap-sqr58.3%
unpow258.3%
associate-*l/58.2%
associate-/l*54.1%
Simplified54.1%
Final simplification71.0%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= D 1.2e+19) w0 (+ w0 (* -0.125 (/ (* (* w0 h) (pow (* D (/ M d)) 2.0)) l)))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 1.2e+19) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((w0 * h) * pow((D * (M / d)), 2.0)) / l));
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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 <= 1.2d+19) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((w0 * h) * ((d * (m / d_1)) ** 2.0d0)) / l))
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 1.2e+19) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((w0 * h) * Math.pow((D * (M / d)), 2.0)) / l));
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): tmp = 0 if D <= 1.2e+19: tmp = w0 else: tmp = w0 + (-0.125 * (((w0 * h) * math.pow((D * (M / d)), 2.0)) / l)) return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (D <= 1.2e+19) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(Float64(w0 * h) * (Float64(D * Float64(M / d)) ^ 2.0)) / l))); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (D <= 1.2e+19)
tmp = w0;
else
tmp = w0 + (-0.125 * (((w0 * h) * ((D * (M / d)) ^ 2.0)) / l));
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[D, 1.2e+19], w0, N[(w0 + N[(-0.125 * N[(N[(N[(w0 * h), $MachinePrecision] * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 1.2 \cdot 10^{+19}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \frac{\left(w0 \cdot h\right) \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}\\
\end{array}
\end{array}
if D < 1.2e19Initial program 85.3%
Simplified84.9%
Taylor expanded in M around 0 75.0%
if 1.2e19 < D Initial program 68.2%
Simplified68.4%
Taylor expanded in M around 0 35.7%
times-frac37.7%
Simplified37.7%
associate-*r/37.8%
unpow237.8%
unpow237.8%
frac-times59.3%
pow259.3%
Applied egg-rr59.3%
pow159.3%
associate-*r*59.3%
pow-prod-down60.0%
Applied egg-rr60.0%
unpow160.0%
*-commutative60.0%
associate-*l/59.8%
associate-/l*60.0%
Simplified60.0%
Final simplification72.1%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= D 6e+17) w0 (+ w0 (* -0.125 (/ (* (* w0 h) (pow (/ (* M D) d) 2.0)) l)))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 6e+17) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((w0 * h) * pow(((M * D) / d), 2.0)) / l));
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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 <= 6d+17) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((w0 * h) * (((m * d) / d_1) ** 2.0d0)) / l))
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 6e+17) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (((w0 * h) * Math.pow(((M * D) / d), 2.0)) / l));
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): tmp = 0 if D <= 6e+17: tmp = w0 else: tmp = w0 + (-0.125 * (((w0 * h) * math.pow(((M * D) / d), 2.0)) / l)) return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) tmp = 0.0 if (D <= 6e+17) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(Float64(w0 * h) * (Float64(Float64(M * D) / d) ^ 2.0)) / l))); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (D <= 6e+17)
tmp = w0;
else
tmp = w0 + (-0.125 * (((w0 * h) * (((M * D) / d) ^ 2.0)) / l));
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[D, 6e+17], w0, N[(w0 + N[(-0.125 * N[(N[(N[(w0 * h), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 6 \cdot 10^{+17}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \frac{\left(w0 \cdot h\right) \cdot {\left(\frac{M \cdot D}{d}\right)}^{2}}{\ell}\\
\end{array}
\end{array}
if D < 6e17Initial program 85.3%
Simplified84.9%
Taylor expanded in M around 0 75.0%
if 6e17 < D Initial program 68.2%
Simplified68.4%
Taylor expanded in M around 0 35.7%
times-frac37.7%
Simplified37.7%
associate-*r/37.8%
unpow237.8%
unpow237.8%
frac-times59.3%
pow259.3%
Applied egg-rr59.3%
pow159.3%
associate-*r*59.3%
pow-prod-down60.0%
Applied egg-rr60.0%
unpow160.0%
*-commutative60.0%
associate-*l/59.8%
Simplified59.8%
Final simplification72.1%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (let* ((t_0 (* M (/ D d)))) (if (<= D 1.4e+51) w0 (+ w0 (* -0.125 (* (* h (/ w0 l)) (* t_0 t_0)))))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = M * (D / d);
double tmp;
if (D <= 1.4e+51) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((h * (w0 / l)) * (t_0 * t_0)));
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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 = m * (d / d_1)
if (d <= 1.4d+51) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * ((h * (w0 / l)) * (t_0 * t_0)))
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = M * (D / d);
double tmp;
if (D <= 1.4e+51) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((h * (w0 / l)) * (t_0 * t_0)));
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): t_0 = M * (D / d) tmp = 0 if D <= 1.4e+51: tmp = w0 else: tmp = w0 + (-0.125 * ((h * (w0 / l)) * (t_0 * t_0))) return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) t_0 = Float64(M * Float64(D / d)) tmp = 0.0 if (D <= 1.4e+51) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h * Float64(w0 / l)) * Float64(t_0 * t_0)))); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
t_0 = M * (D / d);
tmp = 0.0;
if (D <= 1.4e+51)
tmp = w0;
else
tmp = w0 + (-0.125 * ((h * (w0 / l)) * (t_0 * t_0)));
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, 1.4e+51], w0, N[(w0 + N[(-0.125 * N[(N[(h * N[(w0 / l), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
t_0 := M \cdot \frac{D}{d}\\
\mathbf{if}\;D \leq 1.4 \cdot 10^{+51}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(h \cdot \frac{w0}{\ell}\right) \cdot \left(t\_0 \cdot t\_0\right)\right)\\
\end{array}
\end{array}
if D < 1.40000000000000002e51Initial program 85.5%
Simplified85.1%
Taylor expanded in M around 0 74.0%
if 1.40000000000000002e51 < D Initial program 66.2%
Simplified66.3%
Taylor expanded in M around 0 35.6%
times-frac37.7%
Simplified37.7%
unpow237.7%
unpow237.7%
frac-times60.6%
Applied egg-rr60.6%
Taylor expanded in D around 0 35.6%
times-frac37.7%
associate-*r/37.6%
unpow237.6%
unpow237.6%
times-frac58.4%
unpow258.4%
associate-*r*58.2%
unpow258.2%
unpow258.2%
swap-sqr59.7%
unpow259.7%
associate-*l/59.5%
associate-/l*55.2%
Simplified55.2%
associate-*l/55.4%
unpow255.4%
*-commutative55.4%
*-commutative55.4%
Applied egg-rr55.4%
Final simplification70.6%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 w0)
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
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
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): return w0
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) return w0 end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
w0
\end{array}
Initial program 82.1%
Simplified81.8%
Taylor expanded in M around 0 68.2%
Final simplification68.2%
herbie shell --seed 2024039
(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))))))