
(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 9 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)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(let* ((t_0 (* (* (/ M_m d) (* D_m 0.5)) (sqrt h))))
(if (<= h -4e-306)
(*
w0
(sqrt
(-
1.0
(/
(pow
(* (pow (/ 1.0 (cbrt (/ (* 2.0 (/ d D_m)) M_m))) 2.0) (cbrt h))
3.0)
l))))
(* w0 (sqrt (- 1.0 (* t_0 (/ t_0 l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double t_0 = ((M_m / d) * (D_m * 0.5)) * sqrt(h);
double tmp;
if (h <= -4e-306) {
tmp = w0 * sqrt((1.0 - (pow((pow((1.0 / cbrt(((2.0 * (d / D_m)) / M_m))), 2.0) * cbrt(h)), 3.0) / l)));
} else {
tmp = w0 * sqrt((1.0 - (t_0 * (t_0 / l))));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double t_0 = ((M_m / d) * (D_m * 0.5)) * Math.sqrt(h);
double tmp;
if (h <= -4e-306) {
tmp = w0 * Math.sqrt((1.0 - (Math.pow((Math.pow((1.0 / Math.cbrt(((2.0 * (d / D_m)) / M_m))), 2.0) * Math.cbrt(h)), 3.0) / l)));
} else {
tmp = w0 * Math.sqrt((1.0 - (t_0 * (t_0 / l))));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) t_0 = Float64(Float64(Float64(M_m / d) * Float64(D_m * 0.5)) * sqrt(h)) tmp = 0.0 if (h <= -4e-306) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64((Float64((Float64(1.0 / cbrt(Float64(Float64(2.0 * Float64(d / D_m)) / M_m))) ^ 2.0) * cbrt(h)) ^ 3.0) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(t_0 / l))))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(N[(N[(M$95$m / d), $MachinePrecision] * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -4e-306], N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[Power[N[(1.0 / N[Power[N[(N[(2.0 * N[(d / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[Power[h, 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
t_0 := \left(\frac{M_m}{d} \cdot \left(D_m \cdot 0.5\right)\right) \cdot \sqrt{h}\\
\mathbf{if}\;h \leq -4 \cdot 10^{-306}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{{\left({\left(\frac{1}{\sqrt[3]{\frac{2 \cdot \frac{d}{D_m}}{M_m}}}\right)}^{2} \cdot \sqrt[3]{h}\right)}^{3}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t_0 \cdot \frac{t_0}{\ell}}\\
\end{array}
\end{array}
if h < -4.00000000000000011e-306Initial program 84.3%
Simplified84.3%
associate-*r/89.1%
associate-*l/89.1%
div-inv89.1%
associate-*l*88.3%
associate-/r*88.3%
metadata-eval88.3%
Applied egg-rr88.3%
add-cube-cbrt88.3%
pow388.3%
associate-*r/88.3%
Applied egg-rr88.3%
cbrt-prod88.3%
Applied egg-rr89.8%
*-commutative89.8%
associate-*r/89.8%
*-commutative89.8%
associate-*r/90.6%
associate-/l*89.8%
Simplified89.8%
clear-num89.8%
cbrt-div89.9%
metadata-eval89.9%
*-un-lft-identity89.9%
*-commutative89.9%
times-frac89.9%
metadata-eval89.9%
Applied egg-rr89.9%
if -4.00000000000000011e-306 < h Initial program 82.6%
Simplified83.3%
associate-*r/86.5%
associate-*l/85.7%
div-inv85.7%
associate-*l*85.7%
associate-/r*85.7%
metadata-eval85.7%
Applied egg-rr85.7%
add-cube-cbrt85.7%
pow385.7%
associate-*r/85.7%
Applied egg-rr85.7%
cbrt-prod85.6%
Applied egg-rr87.6%
*-commutative87.6%
associate-*r/87.6%
*-commutative87.6%
associate-*r/88.4%
associate-/l*87.7%
Simplified87.7%
add-sqr-sqrt87.7%
*-un-lft-identity87.7%
times-frac87.7%
Applied egg-rr90.7%
Final simplification90.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(let* ((t_0 (* (* (/ M_m d) (* D_m 0.5)) (sqrt h))))
(if (<= h -4e-306)
(*
w0
(sqrt
(-
1.0
(/
(pow (* (cbrt h) (pow (cbrt (/ M_m (/ d (* D_m 0.5)))) 2.0)) 3.0)
l))))
(* w0 (sqrt (- 1.0 (* t_0 (/ t_0 l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double t_0 = ((M_m / d) * (D_m * 0.5)) * sqrt(h);
double tmp;
if (h <= -4e-306) {
tmp = w0 * sqrt((1.0 - (pow((cbrt(h) * pow(cbrt((M_m / (d / (D_m * 0.5)))), 2.0)), 3.0) / l)));
} else {
tmp = w0 * sqrt((1.0 - (t_0 * (t_0 / l))));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double t_0 = ((M_m / d) * (D_m * 0.5)) * Math.sqrt(h);
double tmp;
if (h <= -4e-306) {
tmp = w0 * Math.sqrt((1.0 - (Math.pow((Math.cbrt(h) * Math.pow(Math.cbrt((M_m / (d / (D_m * 0.5)))), 2.0)), 3.0) / l)));
} else {
tmp = w0 * Math.sqrt((1.0 - (t_0 * (t_0 / l))));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) t_0 = Float64(Float64(Float64(M_m / d) * Float64(D_m * 0.5)) * sqrt(h)) tmp = 0.0 if (h <= -4e-306) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(cbrt(h) * (cbrt(Float64(M_m / Float64(d / Float64(D_m * 0.5)))) ^ 2.0)) ^ 3.0) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(t_0 / l))))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(N[(N[(M$95$m / d), $MachinePrecision] * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -4e-306], N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[Power[h, 1/3], $MachinePrecision] * N[Power[N[Power[N[(M$95$m / N[(d / N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
t_0 := \left(\frac{M_m}{d} \cdot \left(D_m \cdot 0.5\right)\right) \cdot \sqrt{h}\\
\mathbf{if}\;h \leq -4 \cdot 10^{-306}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{{\left(\sqrt[3]{h} \cdot {\left(\sqrt[3]{\frac{M_m}{\frac{d}{D_m \cdot 0.5}}}\right)}^{2}\right)}^{3}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t_0 \cdot \frac{t_0}{\ell}}\\
\end{array}
\end{array}
if h < -4.00000000000000011e-306Initial program 84.3%
Simplified84.3%
associate-*r/89.1%
associate-*l/89.1%
div-inv89.1%
associate-*l*88.3%
associate-/r*88.3%
metadata-eval88.3%
Applied egg-rr88.3%
add-cube-cbrt88.3%
pow388.3%
associate-*r/88.3%
Applied egg-rr88.3%
cbrt-prod88.3%
Applied egg-rr89.8%
*-commutative89.8%
associate-*r/89.8%
*-commutative89.8%
associate-*r/90.6%
associate-/l*89.8%
Simplified89.8%
if -4.00000000000000011e-306 < h Initial program 82.6%
Simplified83.3%
associate-*r/86.5%
associate-*l/85.7%
div-inv85.7%
associate-*l*85.7%
associate-/r*85.7%
metadata-eval85.7%
Applied egg-rr85.7%
add-cube-cbrt85.7%
pow385.7%
associate-*r/85.7%
Applied egg-rr85.7%
cbrt-prod85.6%
Applied egg-rr87.6%
*-commutative87.6%
associate-*r/87.6%
*-commutative87.6%
associate-*r/88.4%
associate-/l*87.7%
Simplified87.7%
add-sqr-sqrt87.7%
*-un-lft-identity87.7%
times-frac87.7%
Applied egg-rr90.7%
Final simplification90.3%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d) :precision binary64 (if (<= (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ h l)) 2e-5) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* D_m (/ M_m (* 2.0 d))) 2.0))))) w0))
M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((pow(((D_m * M_m) / (2.0 * d)), 2.0) * (h / l)) <= 2e-5) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow((D_m * (M_m / (2.0 * d))), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
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
real(8) :: tmp
if (((((d_m * m_m) / (2.0d0 * d)) ** 2.0d0) * (h / l)) <= 2d-5) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((d_m * (m_m / (2.0d0 * d))) ** 2.0d0))))
else
tmp = w0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((Math.pow(((D_m * M_m) / (2.0 * d)), 2.0) * (h / l)) <= 2e-5) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((D_m * (M_m / (2.0 * d))), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if (math.pow(((D_m * M_m) / (2.0 * d)), 2.0) * (h / l)) <= 2e-5: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((D_m * (M_m / (2.0 * d))), 2.0)))) else: tmp = w0 return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= 2e-5) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(D_m * Float64(M_m / Float64(2.0 * d))) ^ 2.0))))); else tmp = w0; end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if (((((D_m * M_m) / (2.0 * d)) ^ 2.0) * (h / l)) <= 2e-5)
tmp = w0 * sqrt((1.0 - ((h / l) * ((D_m * (M_m / (2.0 * d))) ^ 2.0))));
else
tmp = w0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], 2e-5], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{D_m \cdot M_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(D_m \cdot \frac{M_m}{2 \cdot d}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < 2.00000000000000016e-5Initial program 88.3%
Simplified88.7%
if 2.00000000000000016e-5 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 0.0%
Simplified0.0%
Taylor expanded in M around 0 60.2%
Final simplification87.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(let* ((t_0 (* (sqrt h) (* M_m (* 0.5 (/ D_m d))))))
(if (<= h -1e-310)
(* w0 (sqrt (- 1.0 (/ (* h (pow (* M_m (/ (/ D_m 2.0) d)) 2.0)) l))))
(* w0 (sqrt (- 1.0 (* t_0 (/ t_0 l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double t_0 = sqrt(h) * (M_m * (0.5 * (D_m / d)));
double tmp;
if (h <= -1e-310) {
tmp = w0 * sqrt((1.0 - ((h * pow((M_m * ((D_m / 2.0) / d)), 2.0)) / l)));
} else {
tmp = w0 * sqrt((1.0 - (t_0 * (t_0 / l))));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
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
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(h) * (m_m * (0.5d0 * (d_m / d)))
if (h <= (-1d-310)) then
tmp = w0 * sqrt((1.0d0 - ((h * ((m_m * ((d_m / 2.0d0) / d)) ** 2.0d0)) / l)))
else
tmp = w0 * sqrt((1.0d0 - (t_0 * (t_0 / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double t_0 = Math.sqrt(h) * (M_m * (0.5 * (D_m / d)));
double tmp;
if (h <= -1e-310) {
tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow((M_m * ((D_m / 2.0) / d)), 2.0)) / l)));
} else {
tmp = w0 * Math.sqrt((1.0 - (t_0 * (t_0 / l))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): t_0 = math.sqrt(h) * (M_m * (0.5 * (D_m / d))) tmp = 0 if h <= -1e-310: tmp = w0 * math.sqrt((1.0 - ((h * math.pow((M_m * ((D_m / 2.0) / d)), 2.0)) / l))) else: tmp = w0 * math.sqrt((1.0 - (t_0 * (t_0 / l)))) return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) t_0 = Float64(sqrt(h) * Float64(M_m * Float64(0.5 * Float64(D_m / d)))) tmp = 0.0 if (h <= -1e-310) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(M_m * Float64(Float64(D_m / 2.0) / d)) ^ 2.0)) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(t_0 / l))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
t_0 = sqrt(h) * (M_m * (0.5 * (D_m / d)));
tmp = 0.0;
if (h <= -1e-310)
tmp = w0 * sqrt((1.0 - ((h * ((M_m * ((D_m / 2.0) / d)) ^ 2.0)) / l)));
else
tmp = w0 * sqrt((1.0 - (t_0 * (t_0 / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(N[Sqrt[h], $MachinePrecision] * N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1e-310], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(M$95$m * N[(N[(D$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
t_0 := \sqrt{h} \cdot \left(M_m \cdot \left(0.5 \cdot \frac{D_m}{d}\right)\right)\\
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(M_m \cdot \frac{\frac{D_m}{2}}{d}\right)}^{2}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t_0 \cdot \frac{t_0}{\ell}}\\
\end{array}
\end{array}
if h < -9.999999999999969e-311Initial program 84.3%
Simplified84.3%
associate-*r/89.1%
associate-*l/89.1%
div-inv89.1%
associate-*l*88.3%
associate-/r*88.3%
metadata-eval88.3%
Applied egg-rr88.3%
Taylor expanded in M around 0 89.1%
*-commutative89.1%
associate-/l*89.1%
metadata-eval89.1%
times-frac89.1%
*-rgt-identity89.1%
associate-/l/89.1%
associate-/r/88.3%
Simplified88.3%
if -9.999999999999969e-311 < h Initial program 82.6%
Simplified83.3%
associate-*r/86.5%
associate-*l/85.7%
div-inv85.7%
associate-*l*85.7%
associate-/r*85.7%
metadata-eval85.7%
Applied egg-rr85.7%
Taylor expanded in M around 0 85.7%
*-commutative85.7%
associate-/l*86.5%
metadata-eval86.5%
times-frac86.5%
*-rgt-identity86.5%
associate-/l/86.5%
associate-/r/85.8%
Simplified85.8%
div-inv85.8%
metadata-eval85.8%
*-commutative85.8%
add-sqr-sqrt85.8%
*-un-lft-identity85.8%
times-frac85.8%
Applied egg-rr89.9%
Final simplification89.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
:precision binary64
(let* ((t_0 (* (* (/ M_m d) (* D_m 0.5)) (sqrt h))))
(if (<= h -1e-310)
(* w0 (sqrt (- 1.0 (/ (* h (pow (* M_m (/ (/ D_m 2.0) d)) 2.0)) l))))
(* w0 (sqrt (- 1.0 (* t_0 (/ t_0 l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double t_0 = ((M_m / d) * (D_m * 0.5)) * sqrt(h);
double tmp;
if (h <= -1e-310) {
tmp = w0 * sqrt((1.0 - ((h * pow((M_m * ((D_m / 2.0) / d)), 2.0)) / l)));
} else {
tmp = w0 * sqrt((1.0 - (t_0 * (t_0 / l))));
}
return tmp;
}
M_m = abs(M)
D_m = abs(D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
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
real(8) :: t_0
real(8) :: tmp
t_0 = ((m_m / d) * (d_m * 0.5d0)) * sqrt(h)
if (h <= (-1d-310)) then
tmp = w0 * sqrt((1.0d0 - ((h * ((m_m * ((d_m / 2.0d0) / d)) ** 2.0d0)) / l)))
else
tmp = w0 * sqrt((1.0d0 - (t_0 * (t_0 / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double t_0 = ((M_m / d) * (D_m * 0.5)) * Math.sqrt(h);
double tmp;
if (h <= -1e-310) {
tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow((M_m * ((D_m / 2.0) / d)), 2.0)) / l)));
} else {
tmp = w0 * Math.sqrt((1.0 - (t_0 * (t_0 / l))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): t_0 = ((M_m / d) * (D_m * 0.5)) * math.sqrt(h) tmp = 0 if h <= -1e-310: tmp = w0 * math.sqrt((1.0 - ((h * math.pow((M_m * ((D_m / 2.0) / d)), 2.0)) / l))) else: tmp = w0 * math.sqrt((1.0 - (t_0 * (t_0 / l)))) return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) t_0 = Float64(Float64(Float64(M_m / d) * Float64(D_m * 0.5)) * sqrt(h)) tmp = 0.0 if (h <= -1e-310) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(M_m * Float64(Float64(D_m / 2.0) / d)) ^ 2.0)) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(t_0 / l))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
t_0 = ((M_m / d) * (D_m * 0.5)) * sqrt(h);
tmp = 0.0;
if (h <= -1e-310)
tmp = w0 * sqrt((1.0 - ((h * ((M_m * ((D_m / 2.0) / d)) ^ 2.0)) / l)));
else
tmp = w0 * sqrt((1.0 - (t_0 * (t_0 / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(N[(N[(M$95$m / d), $MachinePrecision] * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1e-310], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(M$95$m * N[(N[(D$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
t_0 := \left(\frac{M_m}{d} \cdot \left(D_m \cdot 0.5\right)\right) \cdot \sqrt{h}\\
\mathbf{if}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(M_m \cdot \frac{\frac{D_m}{2}}{d}\right)}^{2}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t_0 \cdot \frac{t_0}{\ell}}\\
\end{array}
\end{array}
if h < -9.999999999999969e-311Initial program 84.3%
Simplified84.3%
associate-*r/89.1%
associate-*l/89.1%
div-inv89.1%
associate-*l*88.3%
associate-/r*88.3%
metadata-eval88.3%
Applied egg-rr88.3%
Taylor expanded in M around 0 89.1%
*-commutative89.1%
associate-/l*89.1%
metadata-eval89.1%
times-frac89.1%
*-rgt-identity89.1%
associate-/l/89.1%
associate-/r/88.3%
Simplified88.3%
if -9.999999999999969e-311 < h Initial program 82.6%
Simplified83.3%
associate-*r/86.5%
associate-*l/85.7%
div-inv85.7%
associate-*l*85.7%
associate-/r*85.7%
metadata-eval85.7%
Applied egg-rr85.7%
add-cube-cbrt85.7%
pow385.7%
associate-*r/85.7%
Applied egg-rr85.7%
cbrt-prod85.6%
Applied egg-rr87.6%
*-commutative87.6%
associate-*r/87.6%
*-commutative87.6%
associate-*r/88.4%
associate-/l*87.7%
Simplified87.7%
add-sqr-sqrt87.7%
*-un-lft-identity87.7%
times-frac87.7%
Applied egg-rr90.7%
Final simplification89.6%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* h (pow (* M_m (* D_m (/ 0.5 d))) 2.0)) l)))))
M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
return w0 * sqrt((1.0 - ((h * pow((M_m * (D_m * (0.5 / d))), 2.0)) / l)));
}
M_m = abs(M)
D_m = abs(D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
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
code = w0 * sqrt((1.0d0 - ((h * ((m_m * (d_m * (0.5d0 / d))) ** 2.0d0)) / l)))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - ((h * Math.pow((M_m * (D_m * (0.5 / d))), 2.0)) / l)));
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): return w0 * math.sqrt((1.0 - ((h * math.pow((M_m * (D_m * (0.5 / d))), 2.0)) / l)))
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(M_m * Float64(D_m * Float64(0.5 / d))) ^ 2.0)) / l)))) end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp = code(w0, M_m, D_m, h, l, d)
tmp = w0 * sqrt((1.0 - ((h * ((M_m * (D_m * (0.5 / d))) ^ 2.0)) / l)));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(M$95$m * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
w0 \cdot \sqrt{1 - \frac{h \cdot {\left(M_m \cdot \left(D_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}}
\end{array}
Initial program 83.4%
Simplified83.8%
associate-*r/87.7%
associate-*l/87.4%
div-inv87.3%
associate-*l*87.0%
associate-/r*87.0%
metadata-eval87.0%
Applied egg-rr87.0%
Final simplification87.0%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* h (pow (* M_m (/ (/ D_m 2.0) d)) 2.0)) l)))))
M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
return w0 * sqrt((1.0 - ((h * pow((M_m * ((D_m / 2.0) / d)), 2.0)) / l)));
}
M_m = abs(M)
D_m = abs(D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
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
code = w0 * sqrt((1.0d0 - ((h * ((m_m * ((d_m / 2.0d0) / d)) ** 2.0d0)) / l)))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - ((h * Math.pow((M_m * ((D_m / 2.0) / d)), 2.0)) / l)));
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): return w0 * math.sqrt((1.0 - ((h * math.pow((M_m * ((D_m / 2.0) / d)), 2.0)) / l)))
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(M_m * Float64(Float64(D_m / 2.0) / d)) ^ 2.0)) / l)))) end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp = code(w0, M_m, D_m, h, l, d)
tmp = w0 * sqrt((1.0 - ((h * ((M_m * ((D_m / 2.0) / d)) ^ 2.0)) / l)));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(M$95$m * N[(N[(D$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
w0 \cdot \sqrt{1 - \frac{h \cdot {\left(M_m \cdot \frac{\frac{D_m}{2}}{d}\right)}^{2}}{\ell}}
\end{array}
Initial program 83.4%
Simplified83.8%
associate-*r/87.7%
associate-*l/87.4%
div-inv87.3%
associate-*l*87.0%
associate-/r*87.0%
metadata-eval87.0%
Applied egg-rr87.0%
Taylor expanded in M around 0 87.4%
*-commutative87.4%
associate-/l*87.7%
metadata-eval87.7%
times-frac87.7%
*-rgt-identity87.7%
associate-/l/87.7%
associate-/r/87.0%
Simplified87.0%
Final simplification87.0%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d) :precision binary64 (if (<= D_m 2.15e+198) w0 (log1p (expm1 w0))))
M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (D_m <= 2.15e+198) {
tmp = w0;
} else {
tmp = log1p(expm1(w0));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (D_m <= 2.15e+198) {
tmp = w0;
} else {
tmp = Math.log1p(Math.expm1(w0));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if D_m <= 2.15e+198: tmp = w0 else: tmp = math.log1p(math.expm1(w0)) return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (D_m <= 2.15e+198) tmp = w0; else tmp = log1p(expm1(w0)); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[D$95$m, 2.15e+198], w0, N[Log[1 + N[(Exp[w0] - 1), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;D_m \leq 2.15 \cdot 10^{+198}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(w0\right)\right)\\
\end{array}
\end{array}
if D < 2.14999999999999991e198Initial program 84.3%
Simplified84.7%
Taylor expanded in M around 0 71.3%
if 2.14999999999999991e198 < D Initial program 70.9%
Simplified70.9%
add-sqr-sqrt25.6%
sqrt-unprod20.3%
*-commutative20.3%
*-commutative20.3%
swap-sqr19.7%
Applied egg-rr19.7%
*-commutative19.7%
*-commutative19.7%
associate-*l/19.7%
associate-*r/19.7%
Simplified19.7%
Taylor expanded in h around 0 14.1%
sqrt-pow129.2%
metadata-eval29.2%
pow129.2%
log1p-expm1-u28.4%
Applied egg-rr28.4%
Final simplification68.6%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d) :precision binary64 w0)
M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
return w0;
}
M_m = abs(M)
D_m = abs(D)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
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
code = w0
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
return w0;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): return w0
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) return w0 end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp = code(w0, M_m, D_m, h, l, d)
tmp = w0;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := w0
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
w0
\end{array}
Initial program 83.4%
Simplified83.8%
Taylor expanded in M around 0 68.6%
Final simplification68.6%
herbie shell --seed 2024010
(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))))))