
(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 6 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 (* w0 (sqrt (- 1.0 (* h (/ (pow (* D_m (* M (/ 0.5 d))) 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) {
return w0 * sqrt((1.0 - (h * (pow((D_m * (M * (0.5 / d))), 2.0) / l))));
}
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 * sqrt((1.0d0 - (h * (((d_m * (m * (0.5d0 / d))) ** 2.0d0) / l))))
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 * Math.sqrt((1.0 - (h * (Math.pow((D_m * (M * (0.5 / d))), 2.0) / l))));
}
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 * math.sqrt((1.0 - (h * (math.pow((D_m * (M * (0.5 / d))), 2.0) / l))))
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 Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(D_m * Float64(M * Float64(0.5 / d))) ^ 2.0) / l))))) 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 * sqrt((1.0 - (h * (((D_m * (M * (0.5 / d))) ^ 2.0) / l))));
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_] := N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(D$95$m * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $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])\\
\\
w0 \cdot \sqrt{1 - h \cdot \frac{{\left(D_m \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}}
\end{array}
Initial program 80.2%
Simplified80.1%
expm1-log1p-u58.2%
expm1-udef58.2%
log1p-udef58.2%
add-exp-log80.1%
+-commutative80.1%
frac-times80.2%
div-inv80.1%
associate-*l*80.1%
associate-/r*80.1%
metadata-eval80.1%
Applied egg-rr80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
associate-*r/84.3%
associate-*l/85.4%
*-commutative85.4%
associate-*r*85.4%
*-commutative85.4%
associate-*r*85.0%
Simplified85.0%
Final simplification85.0%
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 (let* ((t_0 (/ (* D_m M) d))) (* w0 (fma -0.125 (* h (* t_0 (/ t_0 l))) 1.0))))
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 t_0 = (D_m * M) / d;
return w0 * fma(-0.125, (h * (t_0 * (t_0 / l))), 1.0);
}
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) t_0 = Float64(Float64(D_m * M) / d) return Float64(w0 * fma(-0.125, Float64(h * Float64(t_0 * Float64(t_0 / l))), 1.0)) 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_] := Block[{t$95$0 = N[(N[(D$95$m * M), $MachinePrecision] / d), $MachinePrecision]}, N[(w0 * N[(-0.125 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $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}
t_0 := \frac{D_m \cdot M}{d}\\
w0 \cdot \mathsf{fma}\left(-0.125, h \cdot \left(t_0 \cdot \frac{t_0}{\ell}\right), 1\right)
\end{array}
\end{array}
Initial program 80.2%
Simplified80.1%
expm1-log1p-u58.2%
expm1-udef58.2%
log1p-udef58.2%
add-exp-log80.1%
+-commutative80.1%
frac-times80.2%
div-inv80.1%
associate-*l*80.1%
associate-/r*80.1%
metadata-eval80.1%
Applied egg-rr80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
associate-*r/84.3%
associate-*l/85.4%
*-commutative85.4%
associate-*r*85.4%
*-commutative85.4%
associate-*r*85.0%
Simplified85.0%
Taylor expanded in h around 0 56.4%
*-commutative56.4%
times-frac57.5%
unpow257.5%
unpow257.5%
times-frac68.2%
unpow268.2%
associate-*l/67.4%
*-commutative67.4%
Simplified67.4%
Taylor expanded in D around 0 55.3%
+-commutative55.3%
fma-def55.3%
Simplified78.6%
unpow278.6%
*-un-lft-identity78.6%
times-frac80.2%
associate-*r/79.1%
associate-*r/79.8%
Applied egg-rr79.8%
Final simplification79.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 (if (<= M 29500.0) w0 (* w0 (* (/ h l) (* -0.125 (pow (* D_m (/ M d)) 2.0))))))
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 (M <= 29500.0) {
tmp = w0;
} else {
tmp = w0 * ((h / l) * (-0.125 * pow((D_m * (M / d)), 2.0)));
}
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 <= 29500.0d0) then
tmp = w0
else
tmp = w0 * ((h / l) * ((-0.125d0) * ((d_m * (m / d)) ** 2.0d0)))
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 (M <= 29500.0) {
tmp = w0;
} else {
tmp = w0 * ((h / l) * (-0.125 * Math.pow((D_m * (M / d)), 2.0)));
}
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 M <= 29500.0: tmp = w0 else: tmp = w0 * ((h / l) * (-0.125 * math.pow((D_m * (M / d)), 2.0))) 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 (M <= 29500.0) tmp = w0; else tmp = Float64(w0 * Float64(Float64(h / l) * Float64(-0.125 * (Float64(D_m * Float64(M / d)) ^ 2.0)))); 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 <= 29500.0)
tmp = w0;
else
tmp = w0 * ((h / l) * (-0.125 * ((D_m * (M / d)) ^ 2.0)));
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[M, 29500.0], w0, N[(w0 * N[(N[(h / l), $MachinePrecision] * N[(-0.125 * N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $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}\;M \leq 29500:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(\frac{h}{\ell} \cdot \left(-0.125 \cdot {\left(D_m \cdot \frac{M}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if M < 29500Initial program 82.1%
Simplified81.6%
Taylor expanded in M around 0 73.3%
if 29500 < M Initial program 73.7%
Simplified75.3%
expm1-log1p-u37.3%
expm1-udef37.3%
log1p-udef37.3%
add-exp-log75.3%
+-commutative75.3%
frac-times73.7%
div-inv73.7%
associate-*l*75.2%
associate-/r*75.2%
metadata-eval75.2%
Applied egg-rr75.2%
associate--l+75.2%
metadata-eval75.2%
+-rgt-identity75.2%
associate-*r/75.6%
associate-*l/77.1%
*-commutative77.1%
associate-*r*75.6%
*-commutative75.6%
associate-*r*72.3%
Simplified72.3%
Taylor expanded in h around 0 41.5%
*-commutative41.5%
times-frac39.9%
unpow239.9%
unpow239.9%
times-frac50.5%
unpow250.5%
associate-*l/47.3%
*-commutative47.3%
Simplified47.3%
Taylor expanded in D around 0 41.5%
+-commutative41.5%
fma-def41.5%
Simplified63.0%
Taylor expanded in h around inf 23.4%
Simplified28.9%
Final simplification63.1%
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 (* w0 (* -0.125 (/ (* h (pow (/ (* D_m M) d) 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) {
return w0 + (w0 * (-0.125 * ((h * pow(((D_m * M) / d), 2.0)) / l)));
}
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 + (w0 * ((-0.125d0) * ((h * (((d_m * m) / d) ** 2.0d0)) / l)))
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 + (w0 * (-0.125 * ((h * Math.pow(((D_m * M) / d), 2.0)) / l)));
}
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 + (w0 * (-0.125 * ((h * math.pow(((D_m * M) / d), 2.0)) / l)))
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 Float64(w0 + Float64(w0 * Float64(-0.125 * Float64(Float64(h * (Float64(Float64(D_m * M) / d) ^ 2.0)) / l)))) 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 + (w0 * (-0.125 * ((h * (((D_m * M) / d) ^ 2.0)) / l)));
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_] := N[(w0 + N[(w0 * N[(-0.125 * N[(N[(h * N[Power[N[(N[(D$95$m * M), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $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])\\
\\
w0 + w0 \cdot \left(-0.125 \cdot \frac{h \cdot {\left(\frac{D_m \cdot M}{d}\right)}^{2}}{\ell}\right)
\end{array}
Initial program 80.2%
Simplified80.1%
expm1-log1p-u58.2%
expm1-udef58.2%
log1p-udef58.2%
add-exp-log80.1%
+-commutative80.1%
frac-times80.2%
div-inv80.1%
associate-*l*80.1%
associate-/r*80.1%
metadata-eval80.1%
Applied egg-rr80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
associate-*r/84.3%
associate-*l/85.4%
*-commutative85.4%
associate-*r*85.4%
*-commutative85.4%
associate-*r*85.0%
Simplified85.0%
Taylor expanded in h around 0 56.4%
*-commutative56.4%
times-frac57.5%
unpow257.5%
unpow257.5%
times-frac68.2%
unpow268.2%
associate-*l/67.4%
*-commutative67.4%
Simplified67.4%
Taylor expanded in D around 0 55.3%
+-commutative55.3%
fma-def55.3%
Simplified78.6%
add-sqr-sqrt43.1%
unpow243.1%
fma-udef43.1%
distribute-rgt-in43.1%
associate-*r/43.1%
associate-*r/43.1%
unpow243.1%
add-sqr-sqrt43.1%
unpow243.1%
*-un-lft-identity43.1%
add-sqr-sqrt78.9%
Applied egg-rr78.9%
Final simplification78.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 (<= M 7.1e-6) w0 (sqrt (* w0 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 (M <= 7.1e-6) {
tmp = w0;
} else {
tmp = sqrt((w0 * 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 <= 7.1d-6) then
tmp = w0
else
tmp = sqrt((w0 * 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 (M <= 7.1e-6) {
tmp = w0;
} else {
tmp = Math.sqrt((w0 * 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 M <= 7.1e-6: tmp = w0 else: tmp = math.sqrt((w0 * 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 (M <= 7.1e-6) tmp = w0; else tmp = sqrt(Float64(w0 * 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 <= 7.1e-6)
tmp = w0;
else
tmp = sqrt((w0 * 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[M, 7.1e-6], w0, N[Sqrt[N[(w0 * w0), $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}\;M \leq 7.1 \cdot 10^{-6}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{w0 \cdot w0}\\
\end{array}
\end{array}
if M < 7.0999999999999998e-6Initial program 81.8%
Simplified81.3%
Taylor expanded in M around 0 73.4%
if 7.0999999999999998e-6 < M Initial program 75.0%
Simplified76.5%
add-sqr-sqrt37.3%
sqrt-unprod28.9%
*-commutative28.9%
*-commutative28.9%
swap-sqr25.4%
Applied egg-rr25.4%
*-commutative25.4%
associate-*r/25.4%
*-commutative25.4%
associate-*r/25.4%
associate-/l*25.4%
*-commutative25.4%
Simplified25.4%
Taylor expanded in h around 0 15.4%
unpow215.4%
Applied egg-rr15.4%
Final simplification59.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 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 80.2%
Simplified80.1%
Taylor expanded in M around 0 66.9%
Final simplification66.9%
herbie shell --seed 2023330
(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))))))