
(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}
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0) (/ h l)) -5e+28) (* w0 (* (sqrt (* h (/ (cbrt -0.015625) l))) (* D_m (/ M_m d_m)))) w0))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -5e+28) {
tmp = w0 * (sqrt((h * (cbrt(-0.015625) / l))) * (D_m * (M_m / d_m)));
} else {
tmp = w0;
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -5e+28) {
tmp = w0 * (Math.sqrt((h * (Math.cbrt(-0.015625) / l))) * (D_m * (M_m / d_m)));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l)) <= -5e+28) tmp = Float64(w0 * Float64(sqrt(Float64(h * Float64(cbrt(-0.015625) / l))) * Float64(D_m * Float64(M_m / d_m)))); else tmp = w0; end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+28], N[(w0 * N[(N[Sqrt[N[(h * N[(N[Power[-0.015625, 1/3], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(D$95$m * N[(M$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+28}:\\
\;\;\;\;w0 \cdot \left(\sqrt{h \cdot \frac{\sqrt[3]{-0.015625}}{\ell}} \cdot \left(D\_m \cdot \frac{M\_m}{d\_m}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.99999999999999957e28Initial program 77.4%
Simplified76.2%
associate-*r/72.2%
add-sqr-sqrt72.2%
pow272.2%
sqrt-pow172.2%
metadata-eval72.2%
pow172.2%
*-un-lft-identity72.2%
times-frac72.2%
metadata-eval72.2%
Applied egg-rr72.2%
add-cbrt-cube62.3%
pow362.3%
clear-num62.3%
inv-pow62.3%
pow-pow62.3%
Applied egg-rr62.3%
Taylor expanded in h around -inf 0.0%
mul-1-neg0.0%
distribute-rgt-neg-in0.0%
associate-/l*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.7%
mul-1-neg47.7%
associate-/l*47.7%
Simplified47.7%
if -4.99999999999999957e28 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 91.7%
Simplified91.7%
Taylor expanded in M around 0 96.2%
Final simplification81.8%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 (if (<= (/ h l) -5e-273) (* w0 (fma -0.125 (* (/ h l) (pow (* D_m (/ M_m d_m)) 2.0)) 1.0)) w0))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((h / l) <= -5e-273) {
tmp = w0 * fma(-0.125, ((h / l) * pow((D_m * (M_m / d_m)), 2.0)), 1.0);
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (Float64(h / l) <= -5e-273) tmp = Float64(w0 * fma(-0.125, Float64(Float64(h / l) * (Float64(D_m * Float64(M_m / d_m)) ^ 2.0)), 1.0)); else tmp = w0; end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(h / l), $MachinePrecision], -5e-273], N[(w0 * N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m / d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-273}:\\
\;\;\;\;w0 \cdot \mathsf{fma}\left(-0.125, \frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M\_m}{d\_m}\right)}^{2}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -4.99999999999999965e-273Initial program 84.2%
Simplified83.5%
associate-*r/84.2%
associate-/r*84.2%
clear-num84.2%
associate-/l*84.2%
div-inv84.2%
metadata-eval84.2%
Applied egg-rr84.2%
associate-*r/85.0%
inv-pow85.0%
pow-pow85.0%
associate-/r*85.0%
metadata-eval85.0%
Applied egg-rr85.0%
Taylor expanded in d around inf 55.2%
+-commutative55.2%
fma-define55.2%
associate-*r*56.8%
times-frac56.3%
associate-/l*56.4%
unpow256.4%
unpow256.4%
unpow256.4%
times-frac61.1%
swap-sqr71.8%
associate-/l*71.8%
associate-/l*71.8%
unpow271.8%
associate-/l*71.8%
Simplified71.8%
if -4.99999999999999965e-273 < (/.f64 h l) Initial program 91.0%
Simplified91.0%
Taylor expanded in M around 0 95.8%
Final simplification83.2%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 (if (<= d_m 950000000.0) (+ w0 (* -0.125 (* (/ (pow (* D_m (/ M_m d_m)) 2.0) l) (* h w0)))) w0))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (d_m <= 950000000.0) {
tmp = w0 + (-0.125 * ((pow((D_m * (M_m / d_m)), 2.0) / l) * (h * w0)));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_m_1
real(8) :: tmp
if (d_m_1 <= 950000000.0d0) then
tmp = w0 + ((-0.125d0) * ((((d_m * (m_m / d_m_1)) ** 2.0d0) / l) * (h * w0)))
else
tmp = w0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (d_m <= 950000000.0) {
tmp = w0 + (-0.125 * ((Math.pow((D_m * (M_m / d_m)), 2.0) / l) * (h * w0)));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): tmp = 0 if d_m <= 950000000.0: tmp = w0 + (-0.125 * ((math.pow((D_m * (M_m / d_m)), 2.0) / l) * (h * w0))) else: tmp = w0 return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (d_m <= 950000000.0) tmp = Float64(w0 + Float64(-0.125 * Float64(Float64((Float64(D_m * Float64(M_m / d_m)) ^ 2.0) / l) * Float64(h * w0)))); else tmp = w0; end return tmp end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
tmp = 0.0;
if (d_m <= 950000000.0)
tmp = w0 + (-0.125 * ((((D_m * (M_m / d_m)) ^ 2.0) / l) * (h * w0)));
else
tmp = w0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[d$95$m, 950000000.0], N[(w0 + N[(-0.125 * N[(N[(N[Power[N[(D$95$m * N[(M$95$m / d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(h * w0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d\_m \leq 950000000:\\
\;\;\;\;w0 + -0.125 \cdot \left(\frac{{\left(D\_m \cdot \frac{M\_m}{d\_m}\right)}^{2}}{\ell} \cdot \left(h \cdot w0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if d < 9.5e8Initial program 85.3%
Simplified84.7%
Taylor expanded in M around 0 52.7%
associate-/l*52.1%
times-frac52.6%
Simplified52.6%
unpow252.6%
unpow252.6%
times-frac60.2%
Applied egg-rr60.2%
associate-*r*60.7%
frac-times52.6%
unpow252.6%
associate-*r/57.3%
/-rgt-identity57.3%
associate-*r*57.3%
pow157.3%
associate-*r*57.3%
/-rgt-identity57.3%
associate-*r/52.6%
unpow252.6%
frac-times60.7%
pow260.7%
pow-prod-down72.7%
associate-*r/71.2%
Applied egg-rr71.2%
unpow171.2%
Simplified71.2%
Taylor expanded in D around 0 52.7%
associate-*r*52.6%
times-frac53.5%
associate-/l*52.6%
unpow252.6%
unpow252.6%
unpow252.6%
times-frac60.7%
swap-sqr72.7%
associate-/l*72.7%
associate-/l*72.7%
unpow272.7%
*-lft-identity72.7%
associate-*l/72.7%
associate-*r*75.2%
associate-*r/75.2%
*-rgt-identity75.2%
associate-/l*75.2%
Simplified75.2%
if 9.5e8 < d Initial program 92.4%
Simplified92.4%
Taylor expanded in M around 0 92.7%
Final simplification80.5%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 (let* ((t_0 (/ (* M_m D_m) d_m))) (if (<= M_m 3.2e-138) w0 (+ w0 (* -0.125 (* (* t_0 t_0) (* h (/ w0 l))))))))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = (M_m * D_m) / d_m;
double tmp;
if (M_m <= 3.2e-138) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((t_0 * t_0) * (h * (w0 / l))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_m_1
real(8) :: t_0
real(8) :: tmp
t_0 = (m_m * d_m) / d_m_1
if (m_m <= 3.2d-138) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * ((t_0 * t_0) * (h * (w0 / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = (M_m * D_m) / d_m;
double tmp;
if (M_m <= 3.2e-138) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * ((t_0 * t_0) * (h * (w0 / l))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): t_0 = (M_m * D_m) / d_m tmp = 0 if M_m <= 3.2e-138: tmp = w0 else: tmp = w0 + (-0.125 * ((t_0 * t_0) * (h * (w0 / l)))) return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) t_0 = Float64(Float64(M_m * D_m) / d_m) tmp = 0.0 if (M_m <= 3.2e-138) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(t_0 * t_0) * Float64(h * Float64(w0 / l))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
t_0 = (M_m * D_m) / d_m;
tmp = 0.0;
if (M_m <= 3.2e-138)
tmp = w0;
else
tmp = w0 + (-0.125 * ((t_0 * t_0) * (h * (w0 / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
d_m = N[Abs[d], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * D$95$m), $MachinePrecision] / d$95$m), $MachinePrecision]}, If[LessEqual[M$95$m, 3.2e-138], w0, N[(w0 + N[(-0.125 * N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(h * N[(w0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m \cdot D\_m}{d\_m}\\
\mathbf{if}\;M\_m \leq 3.2 \cdot 10^{-138}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(t\_0 \cdot t\_0\right) \cdot \left(h \cdot \frac{w0}{\ell}\right)\right)\\
\end{array}
\end{array}
if M < 3.2000000000000001e-138Initial program 89.0%
Simplified88.4%
Taylor expanded in M around 0 75.5%
if 3.2000000000000001e-138 < M Initial program 84.8%
Simplified84.8%
Taylor expanded in M around 0 52.4%
associate-/l*52.4%
times-frac53.5%
Simplified53.5%
unpow253.5%
unpow253.5%
times-frac57.9%
Applied egg-rr57.9%
associate-*r*58.9%
frac-times54.6%
unpow254.6%
associate-*r/58.9%
/-rgt-identity58.9%
associate-*r*57.8%
pow157.8%
associate-*r*58.9%
/-rgt-identity58.9%
associate-*r/54.6%
unpow254.6%
frac-times58.9%
pow258.9%
pow-prod-down71.6%
associate-*r/71.7%
Applied egg-rr71.7%
unpow171.7%
Simplified71.7%
unpow271.7%
associate-*r/71.7%
associate-*r/71.7%
Applied egg-rr71.7%
Final simplification74.1%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d_m) :precision binary64 w0)
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_m_1
code = w0
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m;
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) [w0, M_m, D_m, h, l, d_m] = sort([w0, M_m, D_m, h, l, d_m]) def code(w0, M_m, D_m, h, l, d_m): return w0
M_m = abs(M) D_m = abs(D) d_m = abs(d) w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m]) function code(w0, M_m, D_m, h, l, d_m) return w0 end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
w0, M_m, D_m, h, l, d_m = num2cell(sort([w0, M_m, D_m, h, l, d_m])){:}
function tmp = code(w0, M_m, D_m, h, l, d_m)
tmp = w0;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := w0
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
[w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
\\
w0
\end{array}
Initial program 87.4%
Simplified87.1%
Taylor expanded in M around 0 69.1%
Final simplification69.1%
herbie shell --seed 2024076
(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))))))