
(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 (* D_m (/ M_m d)))) (* w0 (sqrt (- 1.0 (/ (* h (/ (* t_0 t_0) 4.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 = D_m * (M_m / d);
return w0 * sqrt((1.0 - ((h * ((t_0 * t_0) / 4.0)) / l)));
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: t_0
t_0 = d_m * (m_m / d)
code = w0 * sqrt((1.0d0 - ((h * ((t_0 * t_0) / 4.0d0)) / l)))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double t_0 = D_m * (M_m / d);
return w0 * Math.sqrt((1.0 - ((h * ((t_0 * t_0) / 4.0)) / l)));
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): t_0 = D_m * (M_m / d) return w0 * math.sqrt((1.0 - ((h * ((t_0 * t_0) / 4.0)) / l)))
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) t_0 = Float64(D_m * Float64(M_m / d)) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * Float64(Float64(t_0 * t_0) / 4.0)) / l)))) end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp = code(w0, M_m, D_m, h, l, d)
t_0 = D_m * (M_m / d);
tmp = w0 * sqrt((1.0 - ((h * ((t_0 * t_0) / 4.0)) / l)));
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[(N[(t$95$0 * t$95$0), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M\_m}{d}\\
w0 \cdot \sqrt{1 - \frac{h \cdot \frac{t\_0 \cdot t\_0}{4}}{\ell}}
\end{array}
\end{array}
Initial program 81.0%
Simplified81.7%
*-commutative81.7%
unpow281.7%
associate-*r*83.3%
*-commutative83.3%
associate-/r*83.3%
associate-*l/81.4%
associate-*r/83.3%
*-commutative83.3%
associate-/r*83.3%
associate-*l/82.5%
associate-*r/84.5%
associate-*r*82.5%
unpow282.5%
associate-*l/88.1%
Applied egg-rr87.3%
associate-*r/87.0%
frac-times87.3%
unpow287.3%
associate-*l/87.3%
associate-*l/87.3%
frac-times87.3%
metadata-eval87.3%
Applied egg-rr87.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 (<= (/ h l) -5e-293) (+ w0 (* -0.125 (* (pow (* D_m (/ M_m d)) 2.0) (* h (/ w0 l))))) w0))
M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -5e-293) {
tmp = w0 + (-0.125 * (pow((D_m * (M_m / d)), 2.0) * (h * (w0 / l))));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: tmp
if ((h / l) <= (-5d-293)) then
tmp = w0 + ((-0.125d0) * (((d_m * (m_m / d)) ** 2.0d0) * (h * (w0 / l))))
else
tmp = w0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -5e-293) {
tmp = w0 + (-0.125 * (Math.pow((D_m * (M_m / d)), 2.0) * (h * (w0 / l))));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if (h / l) <= -5e-293: tmp = w0 + (-0.125 * (math.pow((D_m * (M_m / d)), 2.0) * (h * (w0 / l)))) else: tmp = w0 return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64(h / l) <= -5e-293) tmp = Float64(w0 + Float64(-0.125 * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) * Float64(h * Float64(w0 / l))))); else tmp = w0; end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if ((h / l) <= -5e-293)
tmp = w0 + (-0.125 * (((D_m * (M_m / d)) ^ 2.0) * (h * (w0 / l))));
else
tmp = w0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -5e-293], 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], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-293}:\\
\;\;\;\;w0 + -0.125 \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \left(h \cdot \frac{w0}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -5.0000000000000003e-293Initial program 79.1%
Simplified80.3%
Taylor expanded in D around 0 42.8%
associate-/l*43.5%
times-frac44.1%
*-commutative44.1%
Simplified44.1%
associate-*r/47.0%
unpow247.0%
unpow247.0%
frac-times55.4%
pow255.4%
*-commutative55.4%
Applied egg-rr55.4%
Taylor expanded in D around 0 42.8%
associate-*r*44.2%
times-frac44.8%
associate-/l*44.1%
unpow244.1%
unpow244.1%
unpow244.1%
times-frac53.3%
swap-sqr62.1%
unpow262.1%
associate-*r/64.9%
Simplified64.9%
if -5.0000000000000003e-293 < (/.f64 h l) Initial program 83.6%
Simplified83.6%
Taylor expanded in D around 0 94.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 (<= (/ h l) -5e-293) (+ w0 (* -0.125 (* (* h (/ w0 l)) (pow (* M_m (/ D_m d)) 2.0)))) w0))
M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -5e-293) {
tmp = w0 + (-0.125 * ((h * (w0 / l)) * pow((M_m * (D_m / d)), 2.0)));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: tmp
if ((h / l) <= (-5d-293)) then
tmp = w0 + ((-0.125d0) * ((h * (w0 / l)) * ((m_m * (d_m / d)) ** 2.0d0)))
else
tmp = w0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((h / l) <= -5e-293) {
tmp = w0 + (-0.125 * ((h * (w0 / l)) * Math.pow((M_m * (D_m / d)), 2.0)));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if (h / l) <= -5e-293: tmp = w0 + (-0.125 * ((h * (w0 / l)) * math.pow((M_m * (D_m / d)), 2.0))) else: tmp = w0 return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64(h / l) <= -5e-293) tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h * Float64(w0 / l)) * (Float64(M_m * Float64(D_m / d)) ^ 2.0)))); else tmp = w0; end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if ((h / l) <= -5e-293)
tmp = w0 + (-0.125 * ((h * (w0 / l)) * ((M_m * (D_m / d)) ^ 2.0)));
else
tmp = w0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -5e-293], N[(w0 + N[(-0.125 * N[(N[(h * N[(w0 / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(M$95$m * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-293}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(h \cdot \frac{w0}{\ell}\right) \cdot {\left(M\_m \cdot \frac{D\_m}{d}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -5.0000000000000003e-293Initial program 79.1%
Simplified80.3%
Taylor expanded in D around 0 42.8%
associate-/l*43.5%
times-frac44.1%
*-commutative44.1%
Simplified44.1%
unpow244.1%
unpow244.1%
frac-times53.3%
Applied egg-rr53.3%
unpow253.3%
Applied egg-rr53.3%
Taylor expanded in D around 0 42.8%
associate-*r*44.2%
*-commutative44.2%
times-frac44.8%
associate-/l*44.1%
unpow244.1%
unpow244.1%
unpow244.1%
times-frac53.3%
swap-sqr62.1%
associate-/l*62.1%
associate-/l*62.1%
unpow262.1%
associate-*r/64.9%
*-commutative64.9%
associate-*r/62.1%
*-commutative62.1%
associate-/l*64.9%
*-commutative64.9%
associate-/l*64.9%
Simplified64.9%
if -5.0000000000000003e-293 < (/.f64 h l) Initial program 83.6%
Simplified83.6%
Taylor expanded in D around 0 94.6%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d) :precision binary64 (* w0 (sqrt (- 1.0 (/ (* h (/ (* M_m (* D_m (/ M_m d))) (/ (* d 4.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) {
return w0 * sqrt((1.0 - ((h * ((M_m * (D_m * (M_m / d))) / ((d * 4.0) / D_m))) / l)));
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
code = w0 * sqrt((1.0d0 - ((h * ((m_m * (d_m * (m_m / d))) / ((d * 4.0d0) / d_m))) / l)))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - ((h * ((M_m * (D_m * (M_m / d))) / ((d * 4.0) / D_m))) / l)));
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): return w0 * math.sqrt((1.0 - ((h * ((M_m * (D_m * (M_m / d))) / ((d * 4.0) / D_m))) / l)))
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * Float64(Float64(M_m * Float64(D_m * Float64(M_m / d))) / Float64(Float64(d * 4.0) / D_m))) / l)))) end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp = code(w0, M_m, D_m, h, l, d)
tmp = w0 * sqrt((1.0 - ((h * ((M_m * (D_m * (M_m / d))) / ((d * 4.0) / D_m))) / l)));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[(N[(M$95$m * N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(d * 4.0), $MachinePrecision] / D$95$m), $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])\\
\\
w0 \cdot \sqrt{1 - \frac{h \cdot \frac{M\_m \cdot \left(D\_m \cdot \frac{M\_m}{d}\right)}{\frac{d \cdot 4}{D\_m}}}{\ell}}
\end{array}
Initial program 81.0%
Simplified81.7%
*-commutative81.7%
unpow281.7%
associate-*r*83.3%
*-commutative83.3%
associate-/r*83.3%
associate-*l/81.4%
associate-*r/83.3%
*-commutative83.3%
associate-/r*83.3%
associate-*l/82.5%
associate-*r/84.5%
associate-*r*82.5%
unpow282.5%
associate-*l/88.1%
Applied egg-rr87.3%
unpow287.3%
associate-*r/86.2%
*-commutative86.2%
associate-/r/87.0%
frac-times87.3%
associate-*l/87.3%
frac-times86.6%
associate-/l*86.6%
Applied egg-rr86.6%
Taylor expanded in d around 0 86.6%
associate-*r/86.6%
Simplified86.6%
Final simplification86.6%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M_m D_m h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* h (/ (* (* D_m (/ M_m d)) (/ M_m (* 4.0 (/ d 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) {
return w0 * sqrt((1.0 - (h * (((D_m * (M_m / d)) * (M_m / (4.0 * (d / D_m)))) / l))));
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
code = w0 * sqrt((1.0d0 - (h * (((d_m * (m_m / d)) * (m_m / (4.0d0 * (d / d_m)))) / l))))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (h * (((D_m * (M_m / d)) * (M_m / (4.0 * (d / D_m)))) / l))));
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): return w0 * math.sqrt((1.0 - (h * (((D_m * (M_m / d)) * (M_m / (4.0 * (d / D_m)))) / 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(h * Float64(Float64(Float64(D_m * Float64(M_m / d)) * Float64(M_m / Float64(4.0 * Float64(d / D_m)))) / l))))) end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp = code(w0, M_m, D_m, h, l, d)
tmp = w0 * sqrt((1.0 - (h * (((D_m * (M_m / d)) * (M_m / (4.0 * (d / D_m)))) / 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[(h * N[(N[(N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / N[(4.0 * N[(d / D$95$m), $MachinePrecision]), $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 - h \cdot \frac{\left(D\_m \cdot \frac{M\_m}{d}\right) \cdot \frac{M\_m}{4 \cdot \frac{d}{D\_m}}}{\ell}}
\end{array}
Initial program 81.0%
Simplified81.7%
*-commutative81.7%
unpow281.7%
associate-*r*83.3%
*-commutative83.3%
associate-/r*83.3%
associate-*l/81.4%
associate-*r/83.3%
*-commutative83.3%
associate-/r*83.3%
associate-*l/82.5%
associate-*r/84.5%
associate-*r*82.5%
unpow282.5%
associate-*l/88.1%
Applied egg-rr87.3%
unpow287.3%
associate-*r/86.2%
*-commutative86.2%
associate-/r/87.0%
frac-times87.3%
associate-*l/87.3%
frac-times86.6%
associate-/l*86.6%
Applied egg-rr86.6%
associate-/l*86.2%
associate-/l*86.9%
associate-*r*86.9%
metadata-eval86.9%
Applied egg-rr86.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 (if (<= d 1.2e-22) (+ w0 (* -0.125 (* (* D_m D_m) (* (* h (/ w0 l)) (* (/ M_m d) (/ M_m d)))))) w0))
M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (d <= 1.2e-22) {
tmp = w0 + (-0.125 * ((D_m * D_m) * ((h * (w0 / l)) * ((M_m / d) * (M_m / d)))));
} else {
tmp = w0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d_m, h, l, d)
real(8), intent (in) :: w0
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d
real(8) :: tmp
if (d <= 1.2d-22) then
tmp = w0 + ((-0.125d0) * ((d_m * d_m) * ((h * (w0 / l)) * ((m_m / d) * (m_m / d)))))
else
tmp = w0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if (d <= 1.2e-22) {
tmp = w0 + (-0.125 * ((D_m * D_m) * ((h * (w0 / l)) * ((M_m / d) * (M_m / d)))));
} else {
tmp = w0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d]) def code(w0, M_m, D_m, h, l, d): tmp = 0 if d <= 1.2e-22: tmp = w0 + (-0.125 * ((D_m * D_m) * ((h * (w0 / l)) * ((M_m / d) * (M_m / d))))) else: tmp = w0 return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (d <= 1.2e-22) tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(D_m * D_m) * Float64(Float64(h * Float64(w0 / l)) * Float64(Float64(M_m / d) * Float64(M_m / d)))))); else tmp = w0; end return tmp end
M_m = abs(M);
D_m = abs(D);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
tmp = 0.0;
if (d <= 1.2e-22)
tmp = w0 + (-0.125 * ((D_m * D_m) * ((h * (w0 / l)) * ((M_m / d) * (M_m / d)))));
else
tmp = w0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[d, 1.2e-22], N[(w0 + N[(-0.125 * N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(h * N[(w0 / l), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.2 \cdot 10^{-22}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(D\_m \cdot D\_m\right) \cdot \left(\left(h \cdot \frac{w0}{\ell}\right) \cdot \left(\frac{M\_m}{d} \cdot \frac{M\_m}{d}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if d < 1.20000000000000001e-22Initial program 77.9%
Simplified78.9%
Taylor expanded in D around 0 46.4%
associate-/l*46.3%
times-frac45.7%
*-commutative45.7%
Simplified45.7%
unpow245.7%
unpow245.7%
frac-times58.6%
Applied egg-rr58.6%
unpow258.6%
Applied egg-rr58.6%
Taylor expanded in w0 around 0 58.6%
associate-/l*59.7%
Simplified59.7%
if 1.20000000000000001e-22 < d Initial program 88.5%
Simplified88.4%
Taylor expanded in D around 0 80.0%
Final simplification65.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.0%
Simplified81.7%
Taylor expanded in D around 0 66.4%
herbie shell --seed 2024152
(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))))))