
(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 8 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)
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(if (<= (/ (* M_m D_m) (* 2.0 d_m)) 1e+151)
(*
w0
(sqrt (+ 1.0 (/ -1.0 (/ l (* (pow (* M_m (* 0.5 (/ D_m d_m))) 2.0) h))))))
(* w0 (/ (sqrt (/ (* h (* -0.25 (pow (* M_m D_m) 2.0))) l)) d_m))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (((M_m * D_m) / (2.0 * d_m)) <= 1e+151) {
tmp = w0 * sqrt((1.0 + (-1.0 / (l / (pow((M_m * (0.5 * (D_m / d_m))), 2.0) * h)))));
} else {
tmp = w0 * (sqrt(((h * (-0.25 * pow((M_m * D_m), 2.0))) / l)) / d_m);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
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 (((m_m * d_m) / (2.0d0 * d_m_1)) <= 1d+151) then
tmp = w0 * sqrt((1.0d0 + ((-1.0d0) / (l / (((m_m * (0.5d0 * (d_m / d_m_1))) ** 2.0d0) * h)))))
else
tmp = w0 * (sqrt(((h * ((-0.25d0) * ((m_m * d_m) ** 2.0d0))) / l)) / d_m_1)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if (((M_m * D_m) / (2.0 * d_m)) <= 1e+151) {
tmp = w0 * Math.sqrt((1.0 + (-1.0 / (l / (Math.pow((M_m * (0.5 * (D_m / d_m))), 2.0) * h)))));
} else {
tmp = w0 * (Math.sqrt(((h * (-0.25 * Math.pow((M_m * D_m), 2.0))) / l)) / d_m);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) def code(w0, M_m, D_m, h, l, d_m): tmp = 0 if ((M_m * D_m) / (2.0 * d_m)) <= 1e+151: tmp = w0 * math.sqrt((1.0 + (-1.0 / (l / (math.pow((M_m * (0.5 * (D_m / d_m))), 2.0) * h))))) else: tmp = w0 * (math.sqrt(((h * (-0.25 * math.pow((M_m * D_m), 2.0))) / l)) / d_m) return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) <= 1e+151) tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(-1.0 / Float64(l / Float64((Float64(M_m * Float64(0.5 * Float64(D_m / d_m))) ^ 2.0) * h)))))); else tmp = Float64(w0 * Float64(sqrt(Float64(Float64(h * Float64(-0.25 * (Float64(M_m * D_m) ^ 2.0))) / l)) / d_m)); end return tmp end
M_m = abs(M); D_m = abs(D); d_m = abs(d); function tmp_2 = code(w0, M_m, D_m, h, l, d_m) tmp = 0.0; if (((M_m * D_m) / (2.0 * d_m)) <= 1e+151) tmp = w0 * sqrt((1.0 + (-1.0 / (l / (((M_m * (0.5 * (D_m / d_m))) ^ 2.0) * h))))); else tmp = w0 * (sqrt(((h * (-0.25 * ((M_m * D_m) ^ 2.0))) / l)) / d_m); end tmp_2 = tmp; end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 1e+151], N[(w0 * N[Sqrt[N[(1.0 + N[(-1.0 / N[(l / N[(N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[(N[Sqrt[N[(N[(h * N[(-0.25 * N[Power[N[(M$95$m * D$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 10^{+151}:\\
\;\;\;\;w0 \cdot \sqrt{1 + \frac{-1}{\frac{\ell}{{\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d\_m}\right)\right)}^{2} \cdot h}}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \frac{\sqrt{\frac{h \cdot \left(-0.25 \cdot {\left(M\_m \cdot D\_m\right)}^{2}\right)}{\ell}}}{d\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 1.00000000000000002e151Initial program 84.4%
Simplified85.2%
associate-*r/90.5%
clear-num90.5%
add-sqr-sqrt90.5%
pow290.5%
sqrt-pow190.5%
metadata-eval90.5%
pow190.5%
*-un-lft-identity90.5%
times-frac90.5%
metadata-eval90.5%
Applied egg-rr90.5%
if 1.00000000000000002e151 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) Initial program 58.8%
Simplified58.8%
associate-*r/59.1%
clear-num59.1%
add-sqr-sqrt59.1%
pow259.1%
sqrt-pow159.1%
metadata-eval59.1%
pow159.1%
*-un-lft-identity59.1%
times-frac59.1%
metadata-eval59.1%
Applied egg-rr59.1%
Taylor expanded in l around 0 48.2%
associate-*r/48.2%
associate-*r*48.2%
*-commutative48.2%
unpow248.2%
unpow248.2%
swap-sqr57.9%
unpow257.9%
*-commutative57.9%
*-commutative57.9%
Simplified57.9%
unpow257.9%
*-commutative57.9%
*-commutative57.9%
Applied egg-rr57.9%
associate-/r*58.3%
sqrt-div61.4%
associate-*r*61.4%
pow261.4%
sqrt-pow144.7%
metadata-eval44.7%
pow144.7%
Applied egg-rr44.7%
Final simplification85.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(let* ((t_0 (* (/ D_m d_m) (* M_m 0.5))))
(if (<= (/ (* M_m D_m) (* 2.0 d_m)) 1e+151)
(* w0 (sqrt (- 1.0 (/ (* h (* t_0 t_0)) l))))
(* w0 (/ (sqrt (/ (* h (* -0.25 (pow (* M_m D_m) 2.0))) l)) d_m)))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = (D_m / d_m) * (M_m * 0.5);
double tmp;
if (((M_m * D_m) / (2.0 * d_m)) <= 1e+151) {
tmp = w0 * sqrt((1.0 - ((h * (t_0 * t_0)) / l)));
} else {
tmp = w0 * (sqrt(((h * (-0.25 * pow((M_m * D_m), 2.0))) / l)) / d_m);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
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 = (d_m / d_m_1) * (m_m * 0.5d0)
if (((m_m * d_m) / (2.0d0 * d_m_1)) <= 1d+151) then
tmp = w0 * sqrt((1.0d0 - ((h * (t_0 * t_0)) / l)))
else
tmp = w0 * (sqrt(((h * ((-0.25d0) * ((m_m * d_m) ** 2.0d0))) / l)) / d_m_1)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = (D_m / d_m) * (M_m * 0.5);
double tmp;
if (((M_m * D_m) / (2.0 * d_m)) <= 1e+151) {
tmp = w0 * Math.sqrt((1.0 - ((h * (t_0 * t_0)) / l)));
} else {
tmp = w0 * (Math.sqrt(((h * (-0.25 * Math.pow((M_m * D_m), 2.0))) / l)) / d_m);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) def code(w0, M_m, D_m, h, l, d_m): t_0 = (D_m / d_m) * (M_m * 0.5) tmp = 0 if ((M_m * D_m) / (2.0 * d_m)) <= 1e+151: tmp = w0 * math.sqrt((1.0 - ((h * (t_0 * t_0)) / l))) else: tmp = w0 * (math.sqrt(((h * (-0.25 * math.pow((M_m * D_m), 2.0))) / l)) / d_m) return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) function code(w0, M_m, D_m, h, l, d_m) t_0 = Float64(Float64(D_m / d_m) * Float64(M_m * 0.5)) tmp = 0.0 if (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) <= 1e+151) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * Float64(t_0 * t_0)) / l)))); else tmp = Float64(w0 * Float64(sqrt(Float64(Float64(h * Float64(-0.25 * (Float64(M_m * D_m) ^ 2.0))) / l)) / d_m)); end return tmp end
M_m = abs(M); D_m = abs(D); d_m = abs(d); function tmp_2 = code(w0, M_m, D_m, h, l, d_m) t_0 = (D_m / d_m) * (M_m * 0.5); tmp = 0.0; if (((M_m * D_m) / (2.0 * d_m)) <= 1e+151) tmp = w0 * sqrt((1.0 - ((h * (t_0 * t_0)) / l))); else tmp = w0 * (sqrt(((h * (-0.25 * ((M_m * D_m) ^ 2.0))) / l)) / d_m); end tmp_2 = tmp; end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(N[(D$95$m / d$95$m), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 1e+151], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[(N[Sqrt[N[(N[(h * N[(-0.25 * N[Power[N[(M$95$m * D$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \frac{D\_m}{d\_m} \cdot \left(M\_m \cdot 0.5\right)\\
\mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 10^{+151}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot \left(t\_0 \cdot t\_0\right)}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \frac{\sqrt{\frac{h \cdot \left(-0.25 \cdot {\left(M\_m \cdot D\_m\right)}^{2}\right)}{\ell}}}{d\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 1.00000000000000002e151Initial program 84.4%
Simplified85.2%
unpow285.2%
*-commutative85.2%
associate-*r*84.0%
*-un-lft-identity84.0%
times-frac84.0%
metadata-eval84.0%
*-un-lft-identity84.0%
times-frac84.0%
metadata-eval84.0%
Applied egg-rr84.0%
associate-*r/89.2%
associate-*l*90.5%
*-commutative90.5%
unpow290.5%
associate-*r/90.5%
Applied egg-rr90.5%
associate-*r/90.5%
pow290.5%
associate-*r*90.5%
associate-*r*90.5%
Applied egg-rr90.5%
if 1.00000000000000002e151 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) Initial program 58.8%
Simplified58.8%
associate-*r/59.1%
clear-num59.1%
add-sqr-sqrt59.1%
pow259.1%
sqrt-pow159.1%
metadata-eval59.1%
pow159.1%
*-un-lft-identity59.1%
times-frac59.1%
metadata-eval59.1%
Applied egg-rr59.1%
Taylor expanded in l around 0 48.2%
associate-*r/48.2%
associate-*r*48.2%
*-commutative48.2%
unpow248.2%
unpow248.2%
swap-sqr57.9%
unpow257.9%
*-commutative57.9%
*-commutative57.9%
Simplified57.9%
unpow257.9%
*-commutative57.9%
*-commutative57.9%
Applied egg-rr57.9%
associate-/r*58.3%
sqrt-div61.4%
associate-*r*61.4%
pow261.4%
sqrt-pow144.7%
metadata-eval44.7%
pow144.7%
Applied egg-rr44.7%
Final simplification85.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(let* ((t_0 (* 0.5 (/ D_m d_m))))
(if (<= (/ h l) -2e-254)
(* w0 (sqrt (- 1.0 (* (/ h l) (* M_m (* t_0 (* M_m t_0)))))))
w0)))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = 0.5 * (D_m / d_m);
double tmp;
if ((h / l) <= -2e-254) {
tmp = w0 * sqrt((1.0 - ((h / l) * (M_m * (t_0 * (M_m * t_0))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
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 = 0.5d0 * (d_m / d_m_1)
if ((h / l) <= (-2d-254)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (m_m * (t_0 * (m_m * t_0))))))
else
tmp = w0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = 0.5 * (D_m / d_m);
double tmp;
if ((h / l) <= -2e-254) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * (M_m * (t_0 * (M_m * t_0))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) def code(w0, M_m, D_m, h, l, d_m): t_0 = 0.5 * (D_m / d_m) tmp = 0 if (h / l) <= -2e-254: tmp = w0 * math.sqrt((1.0 - ((h / l) * (M_m * (t_0 * (M_m * t_0)))))) else: tmp = w0 return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) function code(w0, M_m, D_m, h, l, d_m) t_0 = Float64(0.5 * Float64(D_m / d_m)) tmp = 0.0 if (Float64(h / l) <= -2e-254) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(M_m * Float64(t_0 * Float64(M_m * t_0))))))); else tmp = w0; end return tmp end
M_m = abs(M); D_m = abs(D); d_m = abs(d); function tmp_2 = code(w0, M_m, D_m, h, l, d_m) t_0 = 0.5 * (D_m / d_m); tmp = 0.0; if ((h / l) <= -2e-254) tmp = w0 * sqrt((1.0 - ((h / l) * (M_m * (t_0 * (M_m * t_0)))))); 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]
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(0.5 * N[(D$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h / l), $MachinePrecision], -2e-254], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(M$95$m * N[(t$95$0 * N[(M$95$m * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{D\_m}{d\_m}\\
\mathbf{if}\;\frac{h}{\ell} \leq -2 \cdot 10^{-254}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(M\_m \cdot \left(t\_0 \cdot \left(M\_m \cdot t\_0\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -1.9999999999999998e-254Initial program 78.1%
Simplified79.5%
unpow279.5%
*-commutative79.5%
associate-*r*78.2%
*-un-lft-identity78.2%
times-frac78.2%
metadata-eval78.2%
*-un-lft-identity78.2%
times-frac78.2%
metadata-eval78.2%
Applied egg-rr78.2%
if -1.9999999999999998e-254 < (/.f64 h l) Initial program 85.1%
Simplified85.1%
Taylor expanded in M around 0 92.3%
Final simplification84.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(if (<= (/ h l) -1e-229)
(*
w0
(sqrt
(-
1.0
(*
(/ h l)
(* (* M_m D_m) (* (* M_m (* 0.5 (/ D_m d_m))) (/ 0.5 d_m)))))))
w0))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((h / l) <= -1e-229) {
tmp = w0 * sqrt((1.0 - ((h / l) * ((M_m * D_m) * ((M_m * (0.5 * (D_m / d_m))) * (0.5 / d_m))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
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 ((h / l) <= (-1d-229)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((m_m * d_m) * ((m_m * (0.5d0 * (d_m / d_m_1))) * (0.5d0 / d_m_1))))))
else
tmp = w0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((h / l) <= -1e-229) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * ((M_m * D_m) * ((M_m * (0.5 * (D_m / d_m))) * (0.5 / d_m))))));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) def code(w0, M_m, D_m, h, l, d_m): tmp = 0 if (h / l) <= -1e-229: tmp = w0 * math.sqrt((1.0 - ((h / l) * ((M_m * D_m) * ((M_m * (0.5 * (D_m / d_m))) * (0.5 / d_m)))))) else: tmp = w0 return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (Float64(h / l) <= -1e-229) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(Float64(M_m * D_m) * Float64(Float64(M_m * Float64(0.5 * Float64(D_m / d_m))) * Float64(0.5 / d_m))))))); else tmp = w0; end return tmp end
M_m = abs(M); D_m = abs(D); d_m = abs(d); function tmp_2 = code(w0, M_m, D_m, h, l, d_m) tmp = 0.0; if ((h / l) <= -1e-229) tmp = w0 * sqrt((1.0 - ((h / l) * ((M_m * D_m) * ((M_m * (0.5 * (D_m / d_m))) * (0.5 / d_m)))))); 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] code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(h / l), $MachinePrecision], -1e-229], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(N[(M$95$m * N[(0.5 * N[(D$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{-229}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(\left(M\_m \cdot D\_m\right) \cdot \left(\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d\_m}\right)\right) \cdot \frac{0.5}{d\_m}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -1.00000000000000007e-229Initial program 78.5%
Simplified79.9%
unpow279.9%
associate-*r/78.5%
div-inv78.5%
associate-*l*78.5%
associate-/r*78.5%
metadata-eval78.5%
*-un-lft-identity78.5%
times-frac78.5%
metadata-eval78.5%
Applied egg-rr78.5%
if -1.00000000000000007e-229 < (/.f64 h l) Initial program 84.6%
Simplified84.6%
Taylor expanded in M around 0 91.6%
Final simplification84.7%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(if (<= (* M_m D_m) 5.3e-102)
w0
(*
w0
(+
1.0
(/ (* -0.125 (* h (* (* M_m D_m) (* M_m D_m)))) (* l (pow d_m 2.0)))))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((M_m * D_m) <= 5.3e-102) {
tmp = w0;
} else {
tmp = w0 * (1.0 + ((-0.125 * (h * ((M_m * D_m) * (M_m * D_m)))) / (l * pow(d_m, 2.0))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
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 ((m_m * d_m) <= 5.3d-102) then
tmp = w0
else
tmp = w0 * (1.0d0 + (((-0.125d0) * (h * ((m_m * d_m) * (m_m * d_m)))) / (l * (d_m_1 ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double tmp;
if ((M_m * D_m) <= 5.3e-102) {
tmp = w0;
} else {
tmp = w0 * (1.0 + ((-0.125 * (h * ((M_m * D_m) * (M_m * D_m)))) / (l * Math.pow(d_m, 2.0))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) def code(w0, M_m, D_m, h, l, d_m): tmp = 0 if (M_m * D_m) <= 5.3e-102: tmp = w0 else: tmp = w0 * (1.0 + ((-0.125 * (h * ((M_m * D_m) * (M_m * D_m)))) / (l * math.pow(d_m, 2.0)))) return tmp
M_m = abs(M) D_m = abs(D) d_m = abs(d) function code(w0, M_m, D_m, h, l, d_m) tmp = 0.0 if (Float64(M_m * D_m) <= 5.3e-102) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(Float64(-0.125 * Float64(h * Float64(Float64(M_m * D_m) * Float64(M_m * D_m)))) / Float64(l * (d_m ^ 2.0))))); end return tmp end
M_m = abs(M); D_m = abs(D); d_m = abs(d); function tmp_2 = code(w0, M_m, D_m, h, l, d_m) tmp = 0.0; if ((M_m * D_m) <= 5.3e-102) tmp = w0; else tmp = w0 * (1.0 + ((-0.125 * (h * ((M_m * D_m) * (M_m * D_m)))) / (l * (d_m ^ 2.0)))); end tmp_2 = tmp; end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 5.3e-102], w0, N[(w0 * N[(1.0 + N[(N[(-0.125 * N[(h * N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[Power[d$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;M\_m \cdot D\_m \leq 5.3 \cdot 10^{-102}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + \frac{-0.125 \cdot \left(h \cdot \left(\left(M\_m \cdot D\_m\right) \cdot \left(M\_m \cdot D\_m\right)\right)\right)}{\ell \cdot {d\_m}^{2}}\right)\\
\end{array}
\end{array}
if (*.f64 M D) < 5.3000000000000003e-102Initial program 85.1%
Simplified86.1%
Taylor expanded in M around 0 78.9%
if 5.3000000000000003e-102 < (*.f64 M D) Initial program 71.9%
Simplified71.9%
Taylor expanded in M around 0 41.3%
+-commutative41.3%
fma-define41.3%
associate-*r*41.3%
*-commutative41.3%
unpow241.3%
unpow241.3%
swap-sqr55.2%
unpow255.2%
*-commutative55.2%
Simplified55.2%
Taylor expanded in w0 around 0 42.8%
*-commutative42.8%
associate-*r/42.8%
associate-*r*42.9%
*-commutative42.9%
unpow242.9%
unpow242.9%
swap-sqr58.2%
unpow258.2%
*-commutative58.2%
*-commutative58.2%
Simplified58.2%
unpow236.2%
*-commutative36.2%
*-commutative36.2%
Applied egg-rr58.2%
Final simplification73.1%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) (FPCore (w0 M_m D_m h l d_m) :precision binary64 (let* ((t_0 (* (/ D_m d_m) (* M_m 0.5)))) (* w0 (sqrt (- 1.0 (/ (* h (* t_0 t_0)) l))))))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = (D_m / d_m) * (M_m * 0.5);
return w0 * sqrt((1.0 - ((h * (t_0 * t_0)) / l)));
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
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
t_0 = (d_m / d_m_1) * (m_m * 0.5d0)
code = w0 * sqrt((1.0d0 - ((h * (t_0 * t_0)) / l)))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
double t_0 = (D_m / d_m) * (M_m * 0.5);
return w0 * Math.sqrt((1.0 - ((h * (t_0 * t_0)) / l)));
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) def code(w0, M_m, D_m, h, l, d_m): t_0 = (D_m / d_m) * (M_m * 0.5) return w0 * math.sqrt((1.0 - ((h * (t_0 * t_0)) / l)))
M_m = abs(M) D_m = abs(D) d_m = abs(d) function code(w0, M_m, D_m, h, l, d_m) t_0 = Float64(Float64(D_m / d_m) * Float64(M_m * 0.5)) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * Float64(t_0 * t_0)) / l)))) end
M_m = abs(M); D_m = abs(D); d_m = abs(d); function tmp = code(w0, M_m, D_m, h, l, d_m) t_0 = (D_m / d_m) * (M_m * 0.5); tmp = w0 * sqrt((1.0 - ((h * (t_0 * t_0)) / l))); end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(N[(D$95$m / d$95$m), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision]}, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \frac{D\_m}{d\_m} \cdot \left(M\_m \cdot 0.5\right)\\
w0 \cdot \sqrt{1 - \frac{h \cdot \left(t\_0 \cdot t\_0\right)}{\ell}}
\end{array}
\end{array}
Initial program 81.4%
Simplified82.1%
unpow282.1%
*-commutative82.1%
associate-*r*81.0%
*-un-lft-identity81.0%
times-frac81.0%
metadata-eval81.0%
*-un-lft-identity81.0%
times-frac81.0%
metadata-eval81.0%
Applied egg-rr81.0%
associate-*r/85.7%
associate-*l*86.8%
*-commutative86.8%
unpow286.8%
associate-*r/86.8%
Applied egg-rr86.8%
associate-*r/86.8%
pow286.8%
associate-*r*86.8%
associate-*r*86.8%
Applied egg-rr86.8%
Final simplification86.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
(FPCore (w0 M_m D_m h l d_m)
:precision binary64
(*
w0
(sqrt
(-
1.0
(/ (* h (* (* (/ D_m d_m) (* M_m 0.5)) (* 0.5 (* D_m (/ M_m d_m))))) l)))))M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0 * sqrt((1.0 - ((h * (((D_m / d_m) * (M_m * 0.5)) * (0.5 * (D_m * (M_m / d_m))))) / l)));
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
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 * sqrt((1.0d0 - ((h * (((d_m / d_m_1) * (m_m * 0.5d0)) * (0.5d0 * (d_m * (m_m / d_m_1))))) / l)))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
return w0 * Math.sqrt((1.0 - ((h * (((D_m / d_m) * (M_m * 0.5)) * (0.5 * (D_m * (M_m / d_m))))) / l)));
}
M_m = math.fabs(M) D_m = math.fabs(D) d_m = math.fabs(d) def code(w0, M_m, D_m, h, l, d_m): return w0 * math.sqrt((1.0 - ((h * (((D_m / d_m) * (M_m * 0.5)) * (0.5 * (D_m * (M_m / d_m))))) / l)))
M_m = abs(M) D_m = abs(D) d_m = abs(d) function code(w0, M_m, D_m, h, l, d_m) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * Float64(Float64(Float64(D_m / d_m) * Float64(M_m * 0.5)) * Float64(0.5 * Float64(D_m * Float64(M_m / d_m))))) / l)))) end
M_m = abs(M); D_m = abs(D); d_m = abs(d); function tmp = code(w0, M_m, D_m, h, l, d_m) tmp = w0 * sqrt((1.0 - ((h * (((D_m / d_m) * (M_m * 0.5)) * (0.5 * (D_m * (M_m / d_m))))) / l))); end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] d_m = N[Abs[d], $MachinePrecision] code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[(N[(N[(D$95$m / d$95$m), $MachinePrecision] * N[(M$95$m * 0.5), $MachinePrecision]), $MachinePrecision] * N[(0.5 * N[(D$95$m * N[(M$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|
\\
w0 \cdot \sqrt{1 - \frac{h \cdot \left(\left(\frac{D\_m}{d\_m} \cdot \left(M\_m \cdot 0.5\right)\right) \cdot \left(0.5 \cdot \left(D\_m \cdot \frac{M\_m}{d\_m}\right)\right)\right)}{\ell}}
\end{array}
Initial program 81.4%
Simplified82.1%
unpow282.1%
*-commutative82.1%
associate-*r*81.0%
*-un-lft-identity81.0%
times-frac81.0%
metadata-eval81.0%
*-un-lft-identity81.0%
times-frac81.0%
metadata-eval81.0%
Applied egg-rr81.0%
associate-*r/85.7%
associate-*l*86.8%
*-commutative86.8%
unpow286.8%
associate-*r/86.8%
Applied egg-rr86.8%
associate-*r/86.8%
pow286.8%
associate-*r*86.8%
associate-*r*86.8%
Applied egg-rr86.8%
Taylor expanded in M around 0 86.1%
associate-/l*86.0%
Simplified86.0%
Final simplification86.0%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) d_m = (fabs.f64 d) (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);
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)
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);
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) 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) 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); 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] 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
\end{array}
Initial program 81.4%
Simplified82.1%
Taylor expanded in M around 0 67.1%
herbie shell --seed 2024113
(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))))))