
(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 7 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 (* 0.5 (/ D_m d))))
(if (<= M_m 1.5e-149)
(*
w0
(sqrt
(-
1.0
(/ (* (* 0.5 (/ (* M_m D_m) d)) (* (* 0.5 (* D_m (/ M_m d))) h)) l))))
(* w0 (sqrt (- 1.0 (* (* M_m t_0) (* M_m (/ (* h 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 = 0.5 * (D_m / d);
double tmp;
if (M_m <= 1.5e-149) {
tmp = w0 * sqrt((1.0 - (((0.5 * ((M_m * D_m) / d)) * ((0.5 * (D_m * (M_m / d))) * h)) / l)));
} else {
tmp = w0 * sqrt((1.0 - ((M_m * t_0) * (M_m * ((h * 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 = 0.5d0 * (d_m / d)
if (m_m <= 1.5d-149) then
tmp = w0 * sqrt((1.0d0 - (((0.5d0 * ((m_m * d_m) / d)) * ((0.5d0 * (d_m * (m_m / d))) * h)) / l)))
else
tmp = w0 * sqrt((1.0d0 - ((m_m * t_0) * (m_m * ((h * 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 = 0.5 * (D_m / d);
double tmp;
if (M_m <= 1.5e-149) {
tmp = w0 * Math.sqrt((1.0 - (((0.5 * ((M_m * D_m) / d)) * ((0.5 * (D_m * (M_m / d))) * h)) / l)));
} else {
tmp = w0 * Math.sqrt((1.0 - ((M_m * t_0) * (M_m * ((h * 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 = 0.5 * (D_m / d) tmp = 0 if M_m <= 1.5e-149: tmp = w0 * math.sqrt((1.0 - (((0.5 * ((M_m * D_m) / d)) * ((0.5 * (D_m * (M_m / d))) * h)) / l))) else: tmp = w0 * math.sqrt((1.0 - ((M_m * t_0) * (M_m * ((h * 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(0.5 * Float64(D_m / d)) tmp = 0.0 if (M_m <= 1.5e-149) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(0.5 * Float64(Float64(M_m * D_m) / d)) * Float64(Float64(0.5 * Float64(D_m * Float64(M_m / d))) * h)) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * t_0) * Float64(M_m * Float64(Float64(h * 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 = 0.5 * (D_m / d);
tmp = 0.0;
if (M_m <= 1.5e-149)
tmp = w0 * sqrt((1.0 - (((0.5 * ((M_m * D_m) / d)) * ((0.5 * (D_m * (M_m / d))) * h)) / l)));
else
tmp = w0 * sqrt((1.0 - ((M_m * t_0) * (M_m * ((h * 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[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M$95$m, 1.5e-149], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(0.5 * N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * t$95$0), $MachinePrecision] * N[(M$95$m * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $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 := 0.5 \cdot \frac{D\_m}{d}\\
\mathbf{if}\;M\_m \leq 1.5 \cdot 10^{-149}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(0.5 \cdot \frac{M\_m \cdot D\_m}{d}\right) \cdot \left(\left(0.5 \cdot \left(D\_m \cdot \frac{M\_m}{d}\right)\right) \cdot h\right)}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot t\_0\right) \cdot \left(M\_m \cdot \frac{h \cdot t\_0}{\ell}\right)}\\
\end{array}
\end{array}
if M < 1.5000000000000001e-149Initial program 84.1%
Simplified84.1%
unpow284.1%
associate-*r/83.4%
div-inv83.5%
associate-*r*82.2%
*-un-lft-identity82.2%
times-frac82.2%
metadata-eval82.2%
associate-/r*82.2%
metadata-eval82.2%
Applied egg-rr82.2%
associate-*r/86.2%
associate-*l*87.4%
associate-*r*87.4%
*-commutative87.4%
Applied egg-rr87.4%
pow187.4%
associate-*l*89.3%
associate-*r*89.3%
associate-*l/89.3%
*-commutative89.3%
associate-*r/89.3%
associate-/l*89.2%
Applied egg-rr89.2%
Taylor expanded in M around 0 89.2%
if 1.5000000000000001e-149 < M Initial program 78.5%
Simplified78.5%
associate-*r/78.5%
associate-*r/79.7%
associate-*r/79.7%
unpow279.7%
unpow279.7%
add-sqr-sqrt79.7%
pow279.7%
sqrt-pow179.7%
metadata-eval79.7%
pow179.7%
*-un-lft-identity79.7%
times-frac79.7%
metadata-eval79.7%
Applied egg-rr79.7%
add-sqr-sqrt57.2%
pow257.2%
sqrt-prod38.1%
sqrt-pow142.0%
metadata-eval42.0%
pow142.0%
associate-*r*42.0%
Applied egg-rr42.0%
unpow-prod-down38.0%
associate-*r*38.0%
pow238.0%
pow238.0%
add-sqr-sqrt79.7%
associate-*r/78.5%
associate-*r*78.5%
associate-*r*78.5%
associate-*l*82.7%
associate-*r*82.7%
associate-*r*82.7%
Applied egg-rr82.7%
associate-*r/86.6%
associate-*r/86.6%
Applied egg-rr86.6%
associate-*l*86.6%
associate-*r/86.3%
associate-*r/86.3%
Simplified86.3%
Final simplification88.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 (* M_m (* 0.5 (/ D_m d)))))
(if (<= (* M_m D_m) 1e-227)
w0
(* w0 (sqrt (- 1.0 (* t_0 (* t_0 (/ h 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 * (0.5 * (D_m / d));
double tmp;
if ((M_m * D_m) <= 1e-227) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - (t_0 * (t_0 * (h / 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 * (0.5d0 * (d_m / d))
if ((m_m * d_m) <= 1d-227) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - (t_0 * (t_0 * (h / 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 * (0.5 * (D_m / d));
double tmp;
if ((M_m * D_m) <= 1e-227) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - (t_0 * (t_0 * (h / 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 * (0.5 * (D_m / d)) tmp = 0 if (M_m * D_m) <= 1e-227: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - (t_0 * (t_0 * (h / 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(M_m * Float64(0.5 * Float64(D_m / d))) tmp = 0.0 if (Float64(M_m * D_m) <= 1e-227) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(t_0 * Float64(h / 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 * (0.5 * (D_m / d));
tmp = 0.0;
if ((M_m * D_m) <= 1e-227)
tmp = w0;
else
tmp = w0 * sqrt((1.0 - (t_0 * (t_0 * (h / 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[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 1e-227], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(t$95$0 * N[(h / l), $MachinePrecision]), $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 := M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\\
\mathbf{if}\;M\_m \cdot D\_m \leq 10^{-227}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_0 \cdot \left(t\_0 \cdot \frac{h}{\ell}\right)}\\
\end{array}
\end{array}
if (*.f64 M D) < 9.99999999999999945e-228Initial program 85.7%
Simplified85.2%
Taylor expanded in M around 0 77.6%
if 9.99999999999999945e-228 < (*.f64 M D) Initial program 73.1%
Simplified74.5%
associate-*r/73.1%
associate-*r/70.9%
associate-*r/70.9%
unpow270.9%
unpow270.9%
add-sqr-sqrt70.9%
pow270.9%
sqrt-pow170.9%
metadata-eval70.9%
pow170.9%
*-un-lft-identity70.9%
times-frac70.9%
metadata-eval70.9%
Applied egg-rr70.9%
add-sqr-sqrt49.5%
pow249.5%
sqrt-prod31.5%
sqrt-pow134.0%
metadata-eval34.0%
pow134.0%
associate-*r*34.0%
Applied egg-rr34.0%
unpow-prod-down31.5%
associate-*r*31.5%
pow231.5%
pow231.5%
add-sqr-sqrt70.9%
associate-*r/74.5%
associate-*r*74.5%
associate-*r*74.5%
associate-*l*79.8%
associate-*r*79.8%
associate-*r*79.8%
Applied egg-rr79.8%
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 (<= (* M_m D_m) 5e-268)
w0
(*
w0
(sqrt
(-
1.0
(* (* M_m (* 0.5 (/ D_m d))) (* 0.5 (* D_m (* (/ h d) (/ M_m 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 tmp;
if ((M_m * D_m) <= 5e-268) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - ((M_m * (0.5 * (D_m / d))) * (0.5 * (D_m * ((h / d) * (M_m / 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) :: tmp
if ((m_m * d_m) <= 5d-268) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - ((m_m * (0.5d0 * (d_m / d))) * (0.5d0 * (d_m * ((h / d) * (m_m / 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 tmp;
if ((M_m * D_m) <= 5e-268) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - ((M_m * (0.5 * (D_m / d))) * (0.5 * (D_m * ((h / d) * (M_m / 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): tmp = 0 if (M_m * D_m) <= 5e-268: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - ((M_m * (0.5 * (D_m / d))) * (0.5 * (D_m * ((h / d) * (M_m / 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) tmp = 0.0 if (Float64(M_m * D_m) <= 5e-268) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * Float64(0.5 * Float64(D_m / d))) * Float64(0.5 * Float64(D_m * Float64(Float64(h / d) * Float64(M_m / 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)
tmp = 0.0;
if ((M_m * D_m) <= 5e-268)
tmp = w0;
else
tmp = w0 * sqrt((1.0 - ((M_m * (0.5 * (D_m / d))) * (0.5 * (D_m * ((h / d) * (M_m / 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_] := If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 5e-268], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 * N[(D$95$m * N[(N[(h / d), $MachinePrecision] * N[(M$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;M\_m \cdot D\_m \leq 5 \cdot 10^{-268}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right) \cdot \left(0.5 \cdot \left(D\_m \cdot \left(\frac{h}{d} \cdot \frac{M\_m}{\ell}\right)\right)\right)}\\
\end{array}
\end{array}
if (*.f64 M D) < 4.9999999999999999e-268Initial program 86.4%
Simplified85.8%
Taylor expanded in M around 0 77.3%
if 4.9999999999999999e-268 < (*.f64 M D) Initial program 72.7%
Simplified73.9%
associate-*r/72.7%
associate-*r/71.9%
associate-*r/71.9%
unpow271.9%
unpow271.9%
add-sqr-sqrt71.9%
pow271.9%
sqrt-pow171.9%
metadata-eval71.9%
pow171.9%
*-un-lft-identity71.9%
times-frac71.9%
metadata-eval71.9%
Applied egg-rr71.9%
add-sqr-sqrt50.8%
pow250.8%
sqrt-prod31.6%
sqrt-pow134.0%
metadata-eval34.0%
pow134.0%
associate-*r*34.0%
Applied egg-rr34.0%
unpow-prod-down31.6%
associate-*r*31.6%
pow231.6%
pow231.6%
add-sqr-sqrt71.9%
associate-*r/73.9%
associate-*r*73.9%
associate-*r*73.9%
associate-*l*78.8%
associate-*r*78.8%
associate-*r*78.8%
Applied egg-rr78.8%
Taylor expanded in M around 0 69.8%
associate-/l*69.4%
*-commutative69.4%
times-frac71.4%
Simplified71.4%
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 (* 0.5 (/ D_m d))))
(if (<= M_m 1.75e-185)
w0
(* w0 (sqrt (- 1.0 (* (* M_m t_0) (* M_m (/ (* h 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 = 0.5 * (D_m / d);
double tmp;
if (M_m <= 1.75e-185) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - ((M_m * t_0) * (M_m * ((h * 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 = 0.5d0 * (d_m / d)
if (m_m <= 1.75d-185) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - ((m_m * t_0) * (m_m * ((h * 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 = 0.5 * (D_m / d);
double tmp;
if (M_m <= 1.75e-185) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - ((M_m * t_0) * (M_m * ((h * 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 = 0.5 * (D_m / d) tmp = 0 if M_m <= 1.75e-185: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - ((M_m * t_0) * (M_m * ((h * 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(0.5 * Float64(D_m / d)) tmp = 0.0 if (M_m <= 1.75e-185) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * t_0) * Float64(M_m * Float64(Float64(h * 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 = 0.5 * (D_m / d);
tmp = 0.0;
if (M_m <= 1.75e-185)
tmp = w0;
else
tmp = w0 * sqrt((1.0 - ((M_m * t_0) * (M_m * ((h * 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[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M$95$m, 1.75e-185], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * t$95$0), $MachinePrecision] * N[(M$95$m * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $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 := 0.5 \cdot \frac{D\_m}{d}\\
\mathbf{if}\;M\_m \leq 1.75 \cdot 10^{-185}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot t\_0\right) \cdot \left(M\_m \cdot \frac{h \cdot t\_0}{\ell}\right)}\\
\end{array}
\end{array}
if M < 1.7499999999999999e-185Initial program 84.8%
Simplified84.8%
Taylor expanded in M around 0 75.2%
if 1.7499999999999999e-185 < M Initial program 77.6%
Simplified77.7%
associate-*r/77.6%
associate-*r/79.7%
associate-*r/79.8%
unpow279.8%
unpow279.8%
add-sqr-sqrt79.8%
pow279.8%
sqrt-pow179.8%
metadata-eval79.8%
pow179.8%
*-un-lft-identity79.8%
times-frac79.8%
metadata-eval79.8%
Applied egg-rr79.8%
add-sqr-sqrt58.4%
pow258.4%
sqrt-prod39.1%
sqrt-pow142.9%
metadata-eval42.9%
pow142.9%
associate-*r*42.9%
Applied egg-rr42.9%
unpow-prod-down39.1%
associate-*r*39.1%
pow239.1%
pow239.1%
add-sqr-sqrt79.8%
associate-*r/77.7%
associate-*r*77.7%
associate-*r*77.7%
associate-*l*81.7%
associate-*r*81.7%
associate-*r*81.7%
Applied egg-rr81.7%
associate-*r/86.3%
associate-*r/86.3%
Applied egg-rr86.3%
associate-*l*86.3%
associate-*r/86.0%
associate-*r/86.0%
Simplified86.0%
Final simplification79.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
(* (* M_m (* 0.5 (/ D_m d))) (/ (* h (* M_m (/ (* 0.5 D_m) d))) 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 - ((M_m * (0.5 * (D_m / d))) * ((h * (M_m * ((0.5 * D_m) / d))) / 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 - ((m_m * (0.5d0 * (d_m / d))) * ((h * (m_m * ((0.5d0 * d_m) / d))) / 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 - ((M_m * (0.5 * (D_m / d))) * ((h * (M_m * ((0.5 * D_m) / d))) / 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 - ((M_m * (0.5 * (D_m / d))) * ((h * (M_m * ((0.5 * D_m) / d))) / 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(M_m * Float64(0.5 * Float64(D_m / d))) * Float64(Float64(h * Float64(M_m * Float64(Float64(0.5 * D_m) / d))) / 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 - ((M_m * (0.5 * (D_m / d))) * ((h * (M_m * ((0.5 * D_m) / d))) / 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[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M$95$m * N[(N[(0.5 * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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])\\
\\
w0 \cdot \sqrt{1 - \left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right) \cdot \frac{h \cdot \left(M\_m \cdot \frac{0.5 \cdot D\_m}{d}\right)}{\ell}}
\end{array}
Initial program 81.9%
Simplified81.9%
associate-*r/81.9%
associate-*r/84.4%
associate-*r/84.8%
unpow284.8%
unpow284.8%
add-sqr-sqrt84.8%
pow284.8%
sqrt-pow184.8%
metadata-eval84.8%
pow184.8%
*-un-lft-identity84.8%
times-frac84.8%
metadata-eval84.8%
Applied egg-rr84.8%
add-sqr-sqrt64.9%
pow264.9%
sqrt-prod37.9%
sqrt-pow139.4%
metadata-eval39.4%
pow139.4%
associate-*r*39.4%
Applied egg-rr39.4%
unpow-prod-down37.9%
associate-*r*37.9%
pow237.9%
pow237.9%
add-sqr-sqrt84.8%
associate-*r/81.9%
associate-*r*81.9%
associate-*r*81.9%
associate-*l*84.6%
associate-*r*84.6%
associate-*r*84.6%
Applied egg-rr84.6%
associate-*r/90.1%
associate-*r/90.1%
Applied egg-rr90.1%
Final simplification90.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 (if (<= D_m 9e+139) w0 (+ w0 (* -0.125 (* (pow (* D_m (/ M_m d)) 2.0) (* h (/ w0 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 tmp;
if (D_m <= 9e+139) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (pow((D_m * (M_m / d)), 2.0) * (h * (w0 / 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) :: tmp
if (d_m <= 9d+139) then
tmp = w0
else
tmp = w0 + ((-0.125d0) * (((d_m * (m_m / d)) ** 2.0d0) * (h * (w0 / 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 tmp;
if (D_m <= 9e+139) {
tmp = w0;
} else {
tmp = w0 + (-0.125 * (Math.pow((D_m * (M_m / d)), 2.0) * (h * (w0 / 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): tmp = 0 if D_m <= 9e+139: tmp = w0 else: tmp = w0 + (-0.125 * (math.pow((D_m * (M_m / d)), 2.0) * (h * (w0 / 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) tmp = 0.0 if (D_m <= 9e+139) tmp = w0; else tmp = Float64(w0 + Float64(-0.125 * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) * Float64(h * Float64(w0 / 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)
tmp = 0.0;
if (D_m <= 9e+139)
tmp = w0;
else
tmp = w0 + (-0.125 * (((D_m * (M_m / d)) ^ 2.0) * (h * (w0 / 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_] := If[LessEqual[D$95$m, 9e+139], w0, N[(w0 + N[(-0.125 * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.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|
\\
[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 9 \cdot 10^{+139}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \left(h \cdot \frac{w0}{\ell}\right)\right)\\
\end{array}
\end{array}
if D < 8.9999999999999999e139Initial program 83.5%
Simplified83.6%
Taylor expanded in M around 0 74.6%
if 8.9999999999999999e139 < D Initial program 70.6%
Simplified70.6%
Taylor expanded in M around 0 25.5%
+-commutative25.5%
fma-define25.5%
associate-*r*25.5%
*-commutative25.5%
unpow225.5%
unpow225.5%
swap-sqr48.8%
unpow248.8%
*-commutative48.8%
Simplified48.8%
fma-undefine48.8%
associate-/l*48.7%
*-commutative48.7%
*-commutative48.7%
*-commutative48.7%
Applied egg-rr48.7%
unpow248.7%
Applied egg-rr48.7%
Taylor expanded in M around 0 25.5%
associate-*r*25.5%
times-frac28.6%
unpow228.6%
unpow228.6%
swap-sqr51.8%
unpow251.8%
unpow251.8%
unpow251.8%
times-frac61.5%
unpow161.5%
pow-plus61.5%
associate-/l*61.5%
metadata-eval61.5%
associate-/l*67.5%
Simplified67.5%
Final simplification73.7%
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 81.9%
Simplified81.9%
Taylor expanded in M around 0 69.2%
herbie shell --seed 2024157
(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))))))