
(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 10 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
(if (<= M_m 5e-163)
(*
w0
(cbrt (pow (- 1.0 (/ (* h (pow (* (/ 0.5 d) (* M_m D_m)) 2.0)) l)) 1.5)))
(*
w0
(sqrt
(-
1.0
(/ (* (/ (/ M_m d) (/ 2.0 (* M_m D_m))) (* h (/ (/ D_m 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) {
double tmp;
if (M_m <= 5e-163) {
tmp = w0 * cbrt(pow((1.0 - ((h * pow(((0.5 / d) * (M_m * D_m)), 2.0)) / l)), 1.5));
} else {
tmp = w0 * sqrt((1.0 - ((((M_m / d) / (2.0 / (M_m * D_m))) * (h * ((D_m / d) / 2.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 tmp;
if (M_m <= 5e-163) {
tmp = w0 * Math.cbrt(Math.pow((1.0 - ((h * Math.pow(((0.5 / d) * (M_m * D_m)), 2.0)) / l)), 1.5));
} else {
tmp = w0 * Math.sqrt((1.0 - ((((M_m / d) / (2.0 / (M_m * D_m))) * (h * ((D_m / d) / 2.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) tmp = 0.0 if (M_m <= 5e-163) tmp = Float64(w0 * cbrt((Float64(1.0 - Float64(Float64(h * (Float64(Float64(0.5 / d) * Float64(M_m * D_m)) ^ 2.0)) / l)) ^ 1.5))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(M_m / d) / Float64(2.0 / Float64(M_m * D_m))) * Float64(h * Float64(Float64(D_m / d) / 2.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_] := If[LessEqual[M$95$m, 5e-163], N[(w0 * N[Power[N[Power[N[(1.0 - N[(N[(h * N[Power[N[(N[(0.5 / d), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(M$95$m / d), $MachinePrecision] / N[(2.0 / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 5 \cdot 10^{-163}:\\
\;\;\;\;w0 \cdot \sqrt[3]{{\left(1 - \frac{h \cdot {\left(\frac{0.5}{d} \cdot \left(M\_m \cdot D\_m\right)\right)}^{2}}{\ell}\right)}^{1.5}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{\frac{M\_m}{d}}{\frac{2}{M\_m \cdot D\_m}} \cdot \left(h \cdot \frac{\frac{D\_m}{d}}{2}\right)}{\ell}}\\
\end{array}
\end{array}
if M < 4.99999999999999977e-163Initial program 83.3%
Simplified82.7%
unpow282.7%
unpow282.7%
*-commutative82.7%
associate-*l/83.3%
associate-*r/81.5%
times-frac83.3%
associate-*r/90.3%
*-commutative90.3%
associate-/l*88.5%
div-inv88.5%
associate-/r*88.5%
metadata-eval88.5%
Applied egg-rr88.5%
add-cbrt-cube87.3%
pow1/387.1%
Applied egg-rr88.2%
unpow1/388.5%
associate-*r/89.1%
*-commutative89.1%
Simplified89.1%
if 4.99999999999999977e-163 < M Initial program 71.4%
Simplified70.4%
*-commutative70.4%
associate-*l/71.4%
associate-*r/71.4%
times-frac71.4%
unpow271.4%
clear-num71.4%
frac-times70.4%
*-commutative70.4%
*-un-lft-identity70.4%
*-commutative70.4%
times-frac70.4%
Applied egg-rr70.4%
*-commutative70.4%
times-frac69.5%
Simplified69.5%
associate-*r/75.8%
frac-times76.7%
*-commutative76.7%
frac-times76.7%
*-commutative76.7%
*-commutative76.7%
Applied egg-rr76.7%
times-frac76.9%
times-frac75.8%
Applied egg-rr75.8%
associate-/r*75.8%
Simplified75.8%
pow175.8%
associate-*l*79.7%
frac-times81.7%
associate-/l*81.7%
associate-/l/81.7%
*-commutative81.7%
Applied egg-rr81.7%
unpow181.7%
associate-/r*79.7%
*-commutative79.7%
*-commutative79.7%
associate-/r*79.7%
Simplified79.7%
Final simplification85.5%
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 (- 1.0 (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ h l)))))
(if (<= t_0 5e+201)
(* w0 (sqrt t_0))
(*
w0
(sqrt
(-
1.0
(/
(* (/ (/ M_m d) (/ 2.0 (* M_m D_m))) (* h (/ (/ D_m 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) {
double t_0 = 1.0 - (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (h / l));
double tmp;
if (t_0 <= 5e+201) {
tmp = w0 * sqrt(t_0);
} else {
tmp = w0 * sqrt((1.0 - ((((M_m / d) / (2.0 / (M_m * D_m))) * (h * ((D_m / d) / 2.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 = 1.0d0 - ((((m_m * d_m) / (d * 2.0d0)) ** 2.0d0) * (h / l))
if (t_0 <= 5d+201) then
tmp = w0 * sqrt(t_0)
else
tmp = w0 * sqrt((1.0d0 - ((((m_m / d) / (2.0d0 / (m_m * d_m))) * (h * ((d_m / d) / 2.0d0))) / 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 = 1.0 - (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (h / l));
double tmp;
if (t_0 <= 5e+201) {
tmp = w0 * Math.sqrt(t_0);
} else {
tmp = w0 * Math.sqrt((1.0 - ((((M_m / d) / (2.0 / (M_m * D_m))) * (h * ((D_m / d) / 2.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 = 1.0 - (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (h / l)) tmp = 0 if t_0 <= 5e+201: tmp = w0 * math.sqrt(t_0) else: tmp = w0 * math.sqrt((1.0 - ((((M_m / d) / (2.0 / (M_m * D_m))) * (h * ((D_m / d) / 2.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(1.0 - Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l))) tmp = 0.0 if (t_0 <= 5e+201) tmp = Float64(w0 * sqrt(t_0)); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(M_m / d) / Float64(2.0 / Float64(M_m * D_m))) * Float64(h * Float64(Float64(D_m / d) / 2.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 = 1.0 - ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (h / l));
tmp = 0.0;
if (t_0 <= 5e+201)
tmp = w0 * sqrt(t_0);
else
tmp = w0 * sqrt((1.0 - ((((M_m / d) / (2.0 / (M_m * D_m))) * (h * ((D_m / d) / 2.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[(1.0 - N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+201], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(M$95$m / d), $MachinePrecision] / N[(2.0 / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $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])\\
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+201}:\\
\;\;\;\;w0 \cdot \sqrt{t\_0}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{\frac{M\_m}{d}}{\frac{2}{M\_m \cdot D\_m}} \cdot \left(h \cdot \frac{\frac{D\_m}{d}}{2}\right)}{\ell}}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) < 4.9999999999999995e201Initial program 99.9%
if 4.9999999999999995e201 < (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) Initial program 38.9%
Simplified38.8%
*-commutative38.8%
associate-*l/38.9%
associate-*r/38.9%
times-frac38.9%
unpow238.9%
clear-num38.9%
frac-times38.9%
*-commutative38.9%
*-un-lft-identity38.9%
*-commutative38.9%
times-frac38.8%
Applied egg-rr38.8%
*-commutative38.8%
times-frac38.8%
Simplified38.8%
associate-*r/57.3%
frac-times58.3%
*-commutative58.3%
frac-times58.4%
*-commutative58.4%
*-commutative58.4%
Applied egg-rr58.4%
times-frac57.4%
times-frac57.4%
Applied egg-rr57.4%
associate-/r*57.4%
Simplified57.4%
pow157.4%
associate-*l*62.8%
frac-times63.9%
associate-/l*63.9%
associate-/l/63.9%
*-commutative63.9%
Applied egg-rr63.9%
unpow163.9%
associate-/r*62.7%
*-commutative62.7%
*-commutative62.7%
associate-/r*62.7%
Simplified62.7%
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
(let* ((t_0 (* M_m (* D_m (/ 0.5 d)))))
(if (<= (/ h l) (- INFINITY))
(*
w0
(sqrt
(-
1.0
(* (* M_m (/ h (* d (* 2.0 l)))) (* (/ (/ D_m d) 2.0) (* M_m D_m))))))
(if (<= (/ h l) -2e-310)
(* w0 (sqrt (- 1.0 (* (/ h l) (* t_0 t_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 t_0 = M_m * (D_m * (0.5 / d));
double tmp;
if ((h / l) <= -((double) INFINITY)) {
tmp = w0 * sqrt((1.0 - ((M_m * (h / (d * (2.0 * l)))) * (((D_m / d) / 2.0) * (M_m * D_m)))));
} else if ((h / l) <= -2e-310) {
tmp = w0 * sqrt((1.0 - ((h / l) * (t_0 * t_0))));
} else {
tmp = 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 t_0 = M_m * (D_m * (0.5 / d));
double tmp;
if ((h / l) <= -Double.POSITIVE_INFINITY) {
tmp = w0 * Math.sqrt((1.0 - ((M_m * (h / (d * (2.0 * l)))) * (((D_m / d) / 2.0) * (M_m * D_m)))));
} else if ((h / l) <= -2e-310) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * (t_0 * t_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): t_0 = M_m * (D_m * (0.5 / d)) tmp = 0 if (h / l) <= -math.inf: tmp = w0 * math.sqrt((1.0 - ((M_m * (h / (d * (2.0 * l)))) * (((D_m / d) / 2.0) * (M_m * D_m))))) elif (h / l) <= -2e-310: tmp = w0 * math.sqrt((1.0 - ((h / l) * (t_0 * t_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) t_0 = Float64(M_m * Float64(D_m * Float64(0.5 / d))) tmp = 0.0 if (Float64(h / l) <= Float64(-Inf)) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * Float64(h / Float64(d * Float64(2.0 * l)))) * Float64(Float64(Float64(D_m / d) / 2.0) * Float64(M_m * D_m)))))); elseif (Float64(h / l) <= -2e-310) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(t_0 * t_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)
t_0 = M_m * (D_m * (0.5 / d));
tmp = 0.0;
if ((h / l) <= -Inf)
tmp = w0 * sqrt((1.0 - ((M_m * (h / (d * (2.0 * l)))) * (((D_m / d) / 2.0) * (M_m * D_m)))));
elseif ((h / l) <= -2e-310)
tmp = w0 * sqrt((1.0 - ((h / l) * (t_0 * t_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_] := Block[{t$95$0 = N[(M$95$m * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h / l), $MachinePrecision], (-Infinity)], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * N[(h / N[(d * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -2e-310], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(t$95$0 * t$95$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}
t_0 := M\_m \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\\
\mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \frac{h}{d \cdot \left(2 \cdot \ell\right)}\right) \cdot \left(\frac{\frac{D\_m}{d}}{2} \cdot \left(M\_m \cdot D\_m\right)\right)}\\
\mathbf{elif}\;\frac{h}{\ell} \leq -2 \cdot 10^{-310}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(t\_0 \cdot t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -inf.0Initial program 28.8%
Simplified28.7%
*-commutative28.7%
associate-*l/28.8%
associate-*r/28.8%
times-frac28.8%
unpow228.8%
clear-num28.8%
frac-times28.8%
*-commutative28.8%
*-un-lft-identity28.8%
*-commutative28.8%
times-frac28.8%
Applied egg-rr28.8%
*-commutative28.8%
times-frac28.7%
Simplified28.7%
pow1/228.7%
associate-*l*28.7%
frac-times28.9%
*-commutative28.9%
*-commutative28.9%
Applied egg-rr28.9%
*-un-lft-identity28.9%
unpow1/228.9%
associate-/r/28.9%
*-commutative28.9%
Applied egg-rr28.9%
*-lft-identity28.9%
*-commutative28.9%
*-commutative28.9%
associate-/r*28.9%
*-commutative28.9%
times-frac73.0%
associate-/l*67.4%
associate-*l*67.4%
Simplified67.4%
if -inf.0 < (/.f64 h l) < -1.999999999999994e-310Initial program 81.0%
Simplified80.2%
metadata-eval80.2%
*-commutative80.2%
associate-*l/81.0%
associate-*r/79.6%
times-frac81.0%
pow-prod-up81.0%
associate-/l*79.6%
pow179.6%
div-inv79.6%
associate-/r*79.6%
metadata-eval79.6%
associate-/l*79.6%
pow179.6%
div-inv79.6%
associate-/r*79.6%
metadata-eval79.6%
Applied egg-rr79.6%
if -1.999999999999994e-310 < (/.f64 h l) Initial program 84.3%
Simplified83.3%
Taylor expanded in D around 0 93.6%
Final simplification84.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
(if (<= (* M_m D_m) 2e-132)
w0
(*
w0
(sqrt
(-
1.0
(* (* M_m (/ h (* d (* 2.0 l)))) (* (/ (/ D_m d) 2.0) (* M_m D_m))))))))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) <= 2e-132) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - ((M_m * (h / (d * (2.0 * l)))) * (((D_m / d) / 2.0) * (M_m * D_m)))));
}
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) <= 2d-132) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - ((m_m * (h / (d * (2.0d0 * l)))) * (((d_m / d) / 2.0d0) * (m_m * d_m)))))
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) <= 2e-132) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - ((M_m * (h / (d * (2.0 * l)))) * (((D_m / d) / 2.0) * (M_m * D_m)))));
}
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) <= 2e-132: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - ((M_m * (h / (d * (2.0 * l)))) * (((D_m / d) / 2.0) * (M_m * D_m))))) 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) <= 2e-132) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * Float64(h / Float64(d * Float64(2.0 * l)))) * Float64(Float64(Float64(D_m / d) / 2.0) * Float64(M_m * D_m)))))); 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) <= 2e-132)
tmp = w0;
else
tmp = w0 * sqrt((1.0 - ((M_m * (h / (d * (2.0 * l)))) * (((D_m / d) / 2.0) * (M_m * D_m)))));
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], 2e-132], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * N[(h / N[(d * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision] * N[(M$95$m * D$95$m), $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 2 \cdot 10^{-132}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \frac{h}{d \cdot \left(2 \cdot \ell\right)}\right) \cdot \left(\frac{\frac{D\_m}{d}}{2} \cdot \left(M\_m \cdot D\_m\right)\right)}\\
\end{array}
\end{array}
if (*.f64 M D) < 2e-132Initial program 83.2%
Simplified82.1%
Taylor expanded in D around 0 72.5%
if 2e-132 < (*.f64 M D) Initial program 67.1%
Simplified67.1%
*-commutative67.1%
associate-*l/67.1%
associate-*r/65.8%
times-frac67.1%
unpow267.1%
clear-num67.1%
frac-times67.1%
*-commutative67.1%
*-un-lft-identity67.1%
*-commutative67.1%
times-frac65.8%
Applied egg-rr65.8%
*-commutative65.8%
times-frac63.1%
Simplified63.1%
pow1/263.2%
associate-*l*64.3%
frac-times64.4%
*-commutative64.4%
*-commutative64.4%
Applied egg-rr64.4%
*-un-lft-identity64.4%
unpow1/264.4%
associate-/r/64.4%
*-commutative64.4%
Applied egg-rr64.4%
*-lft-identity64.4%
*-commutative64.4%
*-commutative64.4%
associate-/r*64.4%
*-commutative64.4%
times-frac72.7%
associate-/l*71.2%
associate-*l*71.2%
Simplified71.2%
Final simplification72.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 2e+72)
(*
w0
(sqrt
(-
1.0
(/ (* (/ (/ M_m d) (/ 2.0 (* M_m D_m))) (* h (/ (/ D_m d) 2.0))) l))))
(*
w0
(pow
(-
1.0
(* D_m (/ (* M_m (/ h (* d (* 2.0 l)))) (* 2.0 (/ d (* M_m D_m))))))
0.5))))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 <= 2e+72) {
tmp = w0 * sqrt((1.0 - ((((M_m / d) / (2.0 / (M_m * D_m))) * (h * ((D_m / d) / 2.0))) / l)));
} else {
tmp = w0 * pow((1.0 - (D_m * ((M_m * (h / (d * (2.0 * l)))) / (2.0 * (d / (M_m * D_m)))))), 0.5);
}
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 <= 2d+72) then
tmp = w0 * sqrt((1.0d0 - ((((m_m / d) / (2.0d0 / (m_m * d_m))) * (h * ((d_m / d) / 2.0d0))) / l)))
else
tmp = w0 * ((1.0d0 - (d_m * ((m_m * (h / (d * (2.0d0 * l)))) / (2.0d0 * (d / (m_m * d_m)))))) ** 0.5d0)
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 <= 2e+72) {
tmp = w0 * Math.sqrt((1.0 - ((((M_m / d) / (2.0 / (M_m * D_m))) * (h * ((D_m / d) / 2.0))) / l)));
} else {
tmp = w0 * Math.pow((1.0 - (D_m * ((M_m * (h / (d * (2.0 * l)))) / (2.0 * (d / (M_m * D_m)))))), 0.5);
}
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 <= 2e+72: tmp = w0 * math.sqrt((1.0 - ((((M_m / d) / (2.0 / (M_m * D_m))) * (h * ((D_m / d) / 2.0))) / l))) else: tmp = w0 * math.pow((1.0 - (D_m * ((M_m * (h / (d * (2.0 * l)))) / (2.0 * (d / (M_m * D_m)))))), 0.5) 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 <= 2e+72) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(M_m / d) / Float64(2.0 / Float64(M_m * D_m))) * Float64(h * Float64(Float64(D_m / d) / 2.0))) / l)))); else tmp = Float64(w0 * (Float64(1.0 - Float64(D_m * Float64(Float64(M_m * Float64(h / Float64(d * Float64(2.0 * l)))) / Float64(2.0 * Float64(d / Float64(M_m * D_m)))))) ^ 0.5)); 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 <= 2e+72)
tmp = w0 * sqrt((1.0 - ((((M_m / d) / (2.0 / (M_m * D_m))) * (h * ((D_m / d) / 2.0))) / l)));
else
tmp = w0 * ((1.0 - (D_m * ((M_m * (h / (d * (2.0 * l)))) / (2.0 * (d / (M_m * D_m)))))) ^ 0.5);
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, 2e+72], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(M$95$m / d), $MachinePrecision] / N[(2.0 / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Power[N[(1.0 - N[(D$95$m * N[(N[(M$95$m * N[(h / N[(d * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * N[(d / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $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 \cdot 10^{+72}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{\frac{M\_m}{d}}{\frac{2}{M\_m \cdot D\_m}} \cdot \left(h \cdot \frac{\frac{D\_m}{d}}{2}\right)}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot {\left(1 - D\_m \cdot \frac{M\_m \cdot \frac{h}{d \cdot \left(2 \cdot \ell\right)}}{2 \cdot \frac{d}{M\_m \cdot D\_m}}\right)}^{0.5}\\
\end{array}
\end{array}
if D < 1.99999999999999989e72Initial program 82.2%
Simplified81.2%
*-commutative81.2%
associate-*l/82.2%
associate-*r/81.3%
times-frac82.2%
unpow282.2%
clear-num82.2%
frac-times81.1%
*-commutative81.1%
*-un-lft-identity81.1%
*-commutative81.1%
times-frac80.1%
Applied egg-rr80.1%
*-commutative80.1%
times-frac80.3%
Simplified80.3%
associate-*r/87.3%
frac-times87.1%
*-commutative87.1%
frac-times88.0%
*-commutative88.0%
*-commutative88.0%
Applied egg-rr88.0%
times-frac87.4%
times-frac86.4%
Applied egg-rr86.4%
associate-/r*86.4%
Simplified86.4%
pow186.4%
associate-*l*87.3%
frac-times88.7%
associate-/l*88.7%
associate-/l/88.7%
*-commutative88.7%
Applied egg-rr88.7%
unpow188.7%
associate-/r*87.3%
*-commutative87.3%
*-commutative87.3%
associate-/r*87.3%
Simplified87.3%
if 1.99999999999999989e72 < D Initial program 64.8%
Simplified64.8%
*-commutative64.8%
associate-*l/64.8%
associate-*r/63.0%
times-frac64.8%
unpow264.8%
clear-num64.9%
frac-times63.0%
*-commutative63.0%
*-un-lft-identity63.0%
*-commutative63.0%
times-frac63.0%
Applied egg-rr63.0%
*-commutative63.0%
times-frac59.1%
Simplified59.1%
pow1/259.3%
associate-*l*60.9%
frac-times62.8%
*-commutative62.8%
*-commutative62.8%
Applied egg-rr62.8%
frac-times62.8%
associate-*l/69.9%
*-commutative69.9%
frac-times68.6%
associate-/l*68.6%
Applied egg-rr68.6%
associate-/l*68.6%
*-commutative68.6%
times-frac74.4%
associate-/l*74.1%
associate-*l*74.1%
associate-*r/74.1%
*-commutative74.1%
*-commutative74.1%
associate-*r/74.1%
Simplified74.1%
Final simplification84.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
(if (<= M_m 4e-163)
(*
w0
(sqrt
(-
1.0
(/ (* h (/ (* M_m D_m) (* (* d 2.0) (/ (* d 2.0) (* M_m D_m))))) l))))
(*
w0
(sqrt
(-
1.0
(/ (* (/ (/ M_m d) (/ 2.0 (* M_m D_m))) (* h (/ (/ D_m 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) {
double tmp;
if (M_m <= 4e-163) {
tmp = w0 * sqrt((1.0 - ((h * ((M_m * D_m) / ((d * 2.0) * ((d * 2.0) / (M_m * D_m))))) / l)));
} else {
tmp = w0 * sqrt((1.0 - ((((M_m / d) / (2.0 / (M_m * D_m))) * (h * ((D_m / d) / 2.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) :: tmp
if (m_m <= 4d-163) then
tmp = w0 * sqrt((1.0d0 - ((h * ((m_m * d_m) / ((d * 2.0d0) * ((d * 2.0d0) / (m_m * d_m))))) / l)))
else
tmp = w0 * sqrt((1.0d0 - ((((m_m / d) / (2.0d0 / (m_m * d_m))) * (h * ((d_m / d) / 2.0d0))) / 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 <= 4e-163) {
tmp = w0 * Math.sqrt((1.0 - ((h * ((M_m * D_m) / ((d * 2.0) * ((d * 2.0) / (M_m * D_m))))) / l)));
} else {
tmp = w0 * Math.sqrt((1.0 - ((((M_m / d) / (2.0 / (M_m * D_m))) * (h * ((D_m / d) / 2.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): tmp = 0 if M_m <= 4e-163: tmp = w0 * math.sqrt((1.0 - ((h * ((M_m * D_m) / ((d * 2.0) * ((d * 2.0) / (M_m * D_m))))) / l))) else: tmp = w0 * math.sqrt((1.0 - ((((M_m / d) / (2.0 / (M_m * D_m))) * (h * ((D_m / d) / 2.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) tmp = 0.0 if (M_m <= 4e-163) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * Float64(Float64(M_m * D_m) / Float64(Float64(d * 2.0) * Float64(Float64(d * 2.0) / Float64(M_m * D_m))))) / l)))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(M_m / d) / Float64(2.0 / Float64(M_m * D_m))) * Float64(h * Float64(Float64(D_m / d) / 2.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)
tmp = 0.0;
if (M_m <= 4e-163)
tmp = w0 * sqrt((1.0 - ((h * ((M_m * D_m) / ((d * 2.0) * ((d * 2.0) / (M_m * D_m))))) / l)));
else
tmp = w0 * sqrt((1.0 - ((((M_m / d) / (2.0 / (M_m * D_m))) * (h * ((D_m / d) / 2.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_] := If[LessEqual[M$95$m, 4e-163], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(N[(d * 2.0), $MachinePrecision] * N[(N[(d * 2.0), $MachinePrecision] / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(M$95$m / d), $MachinePrecision] / N[(2.0 / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 4 \cdot 10^{-163}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot \frac{M\_m \cdot D\_m}{\left(d \cdot 2\right) \cdot \frac{d \cdot 2}{M\_m \cdot D\_m}}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\frac{\frac{M\_m}{d}}{\frac{2}{M\_m \cdot D\_m}} \cdot \left(h \cdot \frac{\frac{D\_m}{d}}{2}\right)}{\ell}}\\
\end{array}
\end{array}
if M < 3.99999999999999969e-163Initial program 83.3%
Simplified82.7%
*-commutative82.7%
associate-*l/83.3%
associate-*r/81.5%
times-frac83.3%
unpow283.3%
clear-num83.3%
frac-times81.8%
*-commutative81.8%
*-un-lft-identity81.8%
*-commutative81.8%
times-frac80.6%
Applied egg-rr80.6%
*-commutative80.6%
times-frac80.2%
Simplified80.2%
associate-*r/86.7%
frac-times87.6%
*-commutative87.6%
frac-times88.8%
*-commutative88.8%
*-commutative88.8%
Applied egg-rr88.8%
if 3.99999999999999969e-163 < M Initial program 71.4%
Simplified70.4%
*-commutative70.4%
associate-*l/71.4%
associate-*r/71.4%
times-frac71.4%
unpow271.4%
clear-num71.4%
frac-times70.4%
*-commutative70.4%
*-un-lft-identity70.4%
*-commutative70.4%
times-frac70.4%
Applied egg-rr70.4%
*-commutative70.4%
times-frac69.5%
Simplified69.5%
associate-*r/75.8%
frac-times76.7%
*-commutative76.7%
frac-times76.7%
*-commutative76.7%
*-commutative76.7%
Applied egg-rr76.7%
times-frac76.9%
times-frac75.8%
Applied egg-rr75.8%
associate-/r*75.8%
Simplified75.8%
pow175.8%
associate-*l*79.7%
frac-times81.7%
associate-/l*81.7%
associate-/l/81.7%
*-commutative81.7%
Applied egg-rr81.7%
unpow181.7%
associate-/r*79.7%
*-commutative79.7%
*-commutative79.7%
associate-/r*79.7%
Simplified79.7%
Final simplification85.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 (<= l -4e+223)
w0
(*
w0
(sqrt
(-
1.0
(/ (* h (/ (* M_m D_m) (* (* d 2.0) (/ (* d 2.0) (* M_m D_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 (l <= -4e+223) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - ((h * ((M_m * D_m) / ((d * 2.0) * ((d * 2.0) / (M_m * D_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 (l <= (-4d+223)) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - ((h * ((m_m * d_m) / ((d * 2.0d0) * ((d * 2.0d0) / (m_m * d_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 (l <= -4e+223) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - ((h * ((M_m * D_m) / ((d * 2.0) * ((d * 2.0) / (M_m * D_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 l <= -4e+223: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - ((h * ((M_m * D_m) / ((d * 2.0) * ((d * 2.0) / (M_m * D_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 (l <= -4e+223) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * Float64(Float64(M_m * D_m) / Float64(Float64(d * 2.0) * Float64(Float64(d * 2.0) / Float64(M_m * D_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 (l <= -4e+223)
tmp = w0;
else
tmp = w0 * sqrt((1.0 - ((h * ((M_m * D_m) / ((d * 2.0) * ((d * 2.0) / (M_m * D_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[l, -4e+223], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(N[(d * 2.0), $MachinePrecision] * N[(N[(d * 2.0), $MachinePrecision] / 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|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4 \cdot 10^{+223}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot \frac{M\_m \cdot D\_m}{\left(d \cdot 2\right) \cdot \frac{d \cdot 2}{M\_m \cdot D\_m}}}{\ell}}\\
\end{array}
\end{array}
if l < -4.00000000000000019e223Initial program 74.1%
Simplified70.4%
Taylor expanded in D around 0 88.2%
if -4.00000000000000019e223 < l Initial program 79.2%
Simplified78.8%
*-commutative78.8%
associate-*l/79.2%
associate-*r/78.0%
times-frac79.2%
unpow279.2%
clear-num79.3%
frac-times78.2%
*-commutative78.2%
*-un-lft-identity78.2%
*-commutative78.2%
times-frac77.4%
Applied egg-rr77.4%
*-commutative77.4%
times-frac76.7%
Simplified76.7%
associate-*r/83.8%
frac-times84.9%
*-commutative84.9%
frac-times85.7%
*-commutative85.7%
*-commutative85.7%
Applied egg-rr85.7%
Final simplification86.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 (<= l -3.2e+232)
w0
(*
w0
(sqrt
(-
1.0
(/ (* h (* (/ (/ D_m d) 2.0) (/ M_m (* (/ d M_m) (/ 2.0 D_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 (l <= -3.2e+232) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 - ((h * (((D_m / d) / 2.0) * (M_m / ((d / M_m) * (2.0 / D_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 (l <= (-3.2d+232)) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 - ((h * (((d_m / d) / 2.0d0) * (m_m / ((d / m_m) * (2.0d0 / d_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 (l <= -3.2e+232) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 - ((h * (((D_m / d) / 2.0) * (M_m / ((d / M_m) * (2.0 / D_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 l <= -3.2e+232: tmp = w0 else: tmp = w0 * math.sqrt((1.0 - ((h * (((D_m / d) / 2.0) * (M_m / ((d / M_m) * (2.0 / D_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 (l <= -3.2e+232) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * Float64(Float64(Float64(D_m / d) / 2.0) * Float64(M_m / Float64(Float64(d / M_m) * Float64(2.0 / D_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 (l <= -3.2e+232)
tmp = w0;
else
tmp = w0 * sqrt((1.0 - ((h * (((D_m / d) / 2.0) * (M_m / ((d / M_m) * (2.0 / D_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[l, -3.2e+232], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[(N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision] * N[(M$95$m / N[(N[(d / M$95$m), $MachinePrecision] * N[(2.0 / 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|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{+232}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot \left(\frac{\frac{D\_m}{d}}{2} \cdot \frac{M\_m}{\frac{d}{M\_m} \cdot \frac{2}{D\_m}}\right)}{\ell}}\\
\end{array}
\end{array}
if l < -3.2000000000000002e232Initial program 74.1%
Simplified70.4%
Taylor expanded in D around 0 88.2%
if -3.2000000000000002e232 < l Initial program 79.2%
Simplified78.8%
*-commutative78.8%
associate-*l/79.2%
associate-*r/78.0%
times-frac79.2%
unpow279.2%
clear-num79.3%
frac-times78.2%
*-commutative78.2%
*-un-lft-identity78.2%
*-commutative78.2%
times-frac77.4%
Applied egg-rr77.4%
*-commutative77.4%
times-frac76.7%
Simplified76.7%
associate-*r/83.8%
frac-times84.9%
*-commutative84.9%
frac-times85.7%
*-commutative85.7%
*-commutative85.7%
Applied egg-rr85.7%
times-frac84.3%
times-frac83.9%
Applied egg-rr83.9%
associate-/r*83.9%
Simplified83.9%
Final simplification84.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 (<= (* M_m D_m) 5e+279) w0 (* -0.125 (/ (* (* (* M_m D_m) (* M_m D_m)) (* w0 h)) (* l (pow d 2.0))))))
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+279) {
tmp = w0;
} else {
tmp = -0.125 * ((((M_m * D_m) * (M_m * D_m)) * (w0 * h)) / (l * pow(d, 2.0)));
}
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+279) then
tmp = w0
else
tmp = (-0.125d0) * ((((m_m * d_m) * (m_m * d_m)) * (w0 * h)) / (l * (d ** 2.0d0)))
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+279) {
tmp = w0;
} else {
tmp = -0.125 * ((((M_m * D_m) * (M_m * D_m)) * (w0 * h)) / (l * Math.pow(d, 2.0)));
}
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+279: tmp = w0 else: tmp = -0.125 * ((((M_m * D_m) * (M_m * D_m)) * (w0 * h)) / (l * math.pow(d, 2.0))) 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+279) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(M_m * D_m) * Float64(M_m * D_m)) * Float64(w0 * h)) / Float64(l * (d ^ 2.0)))); 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+279)
tmp = w0;
else
tmp = -0.125 * ((((M_m * D_m) * (M_m * D_m)) * (w0 * h)) / (l * (d ^ 2.0)));
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+279], w0, N[(-0.125 * N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(w0 * h), $MachinePrecision]), $MachinePrecision] / N[(l * N[Power[d, 2.0], $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^{+279}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \frac{\left(\left(M\_m \cdot D\_m\right) \cdot \left(M\_m \cdot D\_m\right)\right) \cdot \left(w0 \cdot h\right)}{\ell \cdot {d}^{2}}\\
\end{array}
\end{array}
if (*.f64 M D) < 5.0000000000000002e279Initial program 80.2%
Simplified79.4%
Taylor expanded in D around 0 72.2%
if 5.0000000000000002e279 < (*.f64 M D) Initial program 54.5%
Simplified54.5%
Taylor expanded in D around 0 67.2%
+-commutative67.2%
fma-define67.2%
associate-*r*67.2%
unpow267.2%
unpow267.2%
swap-sqr67.2%
unpow267.2%
Simplified67.2%
Taylor expanded in D around inf 67.2%
associate-*r*67.2%
*-commutative67.2%
unpow267.2%
unpow267.2%
swap-sqr67.2%
unpow267.2%
*-commutative67.2%
*-commutative67.2%
Simplified67.2%
unpow267.2%
*-commutative67.2%
*-commutative67.2%
Applied egg-rr67.2%
Final simplification71.9%
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 78.7%
Simplified77.9%
Taylor expanded in D around 0 68.5%
herbie shell --seed 2024136
(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))))))