
(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 6 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 (<= (- 1.0 (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l))) 1e+190)
(*
w0
(sqrt
(-
1.0
(* (/ h l) (* D_m (* (/ (* M_m (* D_m 0.5)) d) (* M_m (/ 0.5 d))))))))
(*
w0
(sqrt
(-
1.0
(* h (* (* M_m (* 0.5 (/ D_m d))) (/ (* M_m (/ D_m (* 2.0 d))) l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
double tmp;
if ((1.0 - (pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l))) <= 1e+190) {
tmp = w0 * sqrt((1.0 - ((h / l) * (D_m * (((M_m * (D_m * 0.5)) / d) * (M_m * (0.5 / d)))))));
} else {
tmp = w0 * sqrt((1.0 - (h * ((M_m * (0.5 * (D_m / d))) * ((M_m * (D_m / (2.0 * d))) / 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 ((1.0d0 - ((((m_m * d_m) / (2.0d0 * d)) ** 2.0d0) * (h / l))) <= 1d+190) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (d_m * (((m_m * (d_m * 0.5d0)) / d) * (m_m * (0.5d0 / d)))))))
else
tmp = w0 * sqrt((1.0d0 - (h * ((m_m * (0.5d0 * (d_m / d))) * ((m_m * (d_m / (2.0d0 * d))) / 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 ((1.0 - (Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l))) <= 1e+190) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * (D_m * (((M_m * (D_m * 0.5)) / d) * (M_m * (0.5 / d)))))));
} else {
tmp = w0 * Math.sqrt((1.0 - (h * ((M_m * (0.5 * (D_m / d))) * ((M_m * (D_m / (2.0 * d))) / 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 (1.0 - (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l))) <= 1e+190: tmp = w0 * math.sqrt((1.0 - ((h / l) * (D_m * (((M_m * (D_m * 0.5)) / d) * (M_m * (0.5 / d))))))) else: tmp = w0 * math.sqrt((1.0 - (h * ((M_m * (0.5 * (D_m / d))) * ((M_m * (D_m / (2.0 * d))) / l))))) return tmp
M_m = abs(M) D_m = abs(D) w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d]) function code(w0, M_m, D_m, h, l, d) tmp = 0.0 if (Float64(1.0 - Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))) <= 1e+190) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * Float64(D_m * Float64(Float64(Float64(M_m * Float64(D_m * 0.5)) / d) * Float64(M_m * Float64(0.5 / d)))))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(M_m * Float64(0.5 * Float64(D_m / d))) * Float64(Float64(M_m * Float64(D_m / Float64(2.0 * d))) / 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 ((1.0 - ((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l))) <= 1e+190)
tmp = w0 * sqrt((1.0 - ((h / l) * (D_m * (((M_m * (D_m * 0.5)) / d) * (M_m * (0.5 / d)))))));
else
tmp = w0 * sqrt((1.0 - (h * ((M_m * (0.5 * (D_m / d))) * ((M_m * (D_m / (2.0 * d))) / l)))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(1.0 - N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+190], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(D$95$m * N[(N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m * N[(D$95$m / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;1 - {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 10^{+190}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(D\_m \cdot \left(\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d} \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \left(\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right) \cdot \frac{M\_m \cdot \frac{D\_m}{2 \cdot d}}{\ell}\right)}\\
\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))) < 1.0000000000000001e190Initial program 100.0%
Simplified98.9%
unpow298.9%
*-commutative98.9%
associate-*r*97.8%
*-commutative97.8%
associate-*l/97.8%
associate-*r/96.6%
times-frac97.8%
associate-/l*96.6%
div-inv96.6%
associate-/r*96.6%
metadata-eval96.6%
div-inv96.6%
metadata-eval96.6%
associate-/l*96.6%
Applied egg-rr96.6%
associate-*r*97.8%
associate-/l*97.8%
associate-*l*97.8%
Applied egg-rr97.8%
if 1.0000000000000001e190 < (-.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 47.2%
Simplified50.7%
*-commutative50.7%
associate-*l/47.2%
associate-*r/50.7%
times-frac47.2%
unpow247.2%
associate-/r*47.2%
frac-times43.3%
div-inv43.3%
*-commutative43.3%
metadata-eval43.3%
associate-*r*43.3%
*-commutative43.3%
Applied egg-rr43.3%
associate-*r/55.9%
times-frac62.3%
associate-*r*62.3%
*-commutative62.3%
*-commutative62.3%
*-commutative62.3%
Applied egg-rr62.3%
pow162.3%
*-commutative62.3%
associate-/l*62.3%
associate-*r*60.0%
associate-/l*64.6%
Applied egg-rr64.6%
unpow164.6%
associate-*l*63.5%
associate-*r/63.5%
*-commutative63.5%
associate-*r/63.5%
Simplified63.5%
associate-/l*63.5%
associate-*r*64.6%
associate-*r/64.6%
associate-*r/60.0%
Applied egg-rr60.0%
associate-/l*67.2%
associate-/l*67.2%
associate-/l*73.5%
*-commutative73.5%
Simplified73.5%
Final simplification89.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 (<= (/ h l) -1e-294)
(*
w0
(sqrt
(-
1.0
(* h (* (* M_m (* 0.5 (/ D_m d))) (/ (* M_m (/ D_m (* 2.0 d))) 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) <= -1e-294) {
tmp = w0 * sqrt((1.0 - (h * ((M_m * (0.5 * (D_m / d))) * ((M_m * (D_m / (2.0 * d))) / 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) <= (-1d-294)) then
tmp = w0 * sqrt((1.0d0 - (h * ((m_m * (0.5d0 * (d_m / d))) * ((m_m * (d_m / (2.0d0 * d))) / 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) <= -1e-294) {
tmp = w0 * Math.sqrt((1.0 - (h * ((M_m * (0.5 * (D_m / d))) * ((M_m * (D_m / (2.0 * d))) / 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) <= -1e-294: tmp = w0 * math.sqrt((1.0 - (h * ((M_m * (0.5 * (D_m / d))) * ((M_m * (D_m / (2.0 * d))) / 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) <= -1e-294) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(M_m * Float64(0.5 * Float64(D_m / d))) * Float64(Float64(M_m * Float64(D_m / Float64(2.0 * d))) / 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) <= -1e-294)
tmp = w0 * sqrt((1.0 - (h * ((M_m * (0.5 * (D_m / d))) * ((M_m * (D_m / (2.0 * d))) / 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], -1e-294], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m * N[(D$95$m / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $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}\;\frac{h}{\ell} \leq -1 \cdot 10^{-294}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \left(\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right) \cdot \frac{M\_m \cdot \frac{D\_m}{2 \cdot d}}{\ell}\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -1.00000000000000002e-294Initial program 77.9%
Simplified78.7%
*-commutative78.7%
associate-*l/77.9%
associate-*r/80.0%
times-frac77.9%
unpow277.9%
associate-/r*77.9%
frac-times70.0%
div-inv70.0%
*-commutative70.0%
metadata-eval70.0%
associate-*r*70.0%
*-commutative70.0%
Applied egg-rr70.0%
associate-*r/71.8%
times-frac81.1%
associate-*r*81.1%
*-commutative81.1%
*-commutative81.1%
*-commutative81.1%
Applied egg-rr81.1%
pow181.1%
*-commutative81.1%
associate-/l*81.1%
associate-*r*79.8%
associate-/l*82.5%
Applied egg-rr82.5%
unpow182.5%
associate-*l*81.9%
associate-*r/81.9%
*-commutative81.9%
associate-*r/81.9%
Simplified81.9%
associate-/l*81.8%
associate-*r*82.5%
associate-*r/82.5%
associate-*r/79.8%
Applied egg-rr79.8%
associate-/l*82.6%
associate-/l*82.6%
associate-/l*86.3%
*-commutative86.3%
Simplified86.3%
if -1.00000000000000002e-294 < (/.f64 h l) Initial program 88.8%
Simplified88.8%
Taylor expanded in D around 0 96.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.62e+94)
(*
w0
(sqrt
(+
1.0
(* (/ (* D_m h) l) (* (* M_m (/ (* D_m -0.5) d)) (/ (* M_m 0.5) 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.62e+94) {
tmp = w0 * sqrt((1.0 + (((D_m * h) / l) * ((M_m * ((D_m * -0.5) / d)) * ((M_m * 0.5) / 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.62d+94) then
tmp = w0 * sqrt((1.0d0 + (((d_m * h) / l) * ((m_m * ((d_m * (-0.5d0)) / d)) * ((m_m * 0.5d0) / 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.62e+94) {
tmp = w0 * Math.sqrt((1.0 + (((D_m * h) / l) * ((M_m * ((D_m * -0.5) / d)) * ((M_m * 0.5) / 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.62e+94: tmp = w0 * math.sqrt((1.0 + (((D_m * h) / l) * ((M_m * ((D_m * -0.5) / d)) * ((M_m * 0.5) / 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.62e+94) tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(Float64(D_m * h) / l) * Float64(Float64(M_m * Float64(Float64(D_m * -0.5) / d)) * Float64(Float64(M_m * 0.5) / 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.62e+94)
tmp = w0 * sqrt((1.0 + (((D_m * h) / l) * ((M_m * ((D_m * -0.5) / d)) * ((M_m * 0.5) / 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.62e+94], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(N[(D$95$m * h), $MachinePrecision] / l), $MachinePrecision] * N[(N[(M$95$m * N[(N[(D$95$m * -0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m * 0.5), $MachinePrecision] / 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.62 \cdot 10^{+94}:\\
\;\;\;\;w0 \cdot \sqrt{1 + \frac{D\_m \cdot h}{\ell} \cdot \left(\left(M\_m \cdot \frac{D\_m \cdot -0.5}{d}\right) \cdot \frac{M\_m \cdot 0.5}{d}\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if d < 1.61999999999999997e94Initial program 83.3%
Simplified83.4%
unpow283.4%
*-commutative83.4%
associate-*r*82.4%
*-commutative82.4%
associate-*l/81.5%
associate-*r/81.4%
times-frac81.5%
associate-/l*81.4%
div-inv81.4%
associate-/r*81.4%
metadata-eval81.4%
div-inv81.4%
metadata-eval81.4%
associate-/l*81.4%
Applied egg-rr81.4%
*-un-lft-identity81.4%
associate-*l*80.8%
associate-*l*80.4%
Applied egg-rr80.4%
*-lft-identity80.4%
sub-neg80.4%
*-commutative80.4%
distribute-rgt-neg-in80.4%
associate-*r/79.6%
associate-*r*80.0%
distribute-lft-neg-in80.0%
Simplified80.0%
if 1.61999999999999997e94 < d Initial program 81.1%
Simplified82.8%
Taylor expanded in D around 0 91.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 (<= M_m 4.4e+40) w0 (* -0.125 (* (* (* M_m D_m) (* M_m D_m)) (* w0 (/ (* h (pow 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 <= 4.4e+40) {
tmp = w0;
} else {
tmp = -0.125 * (((M_m * D_m) * (M_m * D_m)) * (w0 * ((h * pow(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 <= 4.4d+40) then
tmp = w0
else
tmp = (-0.125d0) * (((m_m * d_m) * (m_m * d_m)) * (w0 * ((h * (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 <= 4.4e+40) {
tmp = w0;
} else {
tmp = -0.125 * (((M_m * D_m) * (M_m * D_m)) * (w0 * ((h * Math.pow(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 <= 4.4e+40: tmp = w0 else: tmp = -0.125 * (((M_m * D_m) * (M_m * D_m)) * (w0 * ((h * math.pow(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 <= 4.4e+40) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(M_m * D_m) * Float64(M_m * D_m)) * Float64(w0 * Float64(Float64(h * (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 <= 4.4e+40)
tmp = w0;
else
tmp = -0.125 * (((M_m * D_m) * (M_m * D_m)) * (w0 * ((h * (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, 4.4e+40], w0, N[(-0.125 * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(w0 * N[(N[(h * N[Power[d, -2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 4.4 \cdot 10^{+40}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(M\_m \cdot D\_m\right) \cdot \left(M\_m \cdot D\_m\right)\right) \cdot \left(w0 \cdot \frac{h \cdot {d}^{-2}}{\ell}\right)\right)\\
\end{array}
\end{array}
if M < 4.3999999999999998e40Initial program 85.9%
Simplified85.5%
Taylor expanded in D around 0 75.4%
if 4.3999999999999998e40 < M Initial program 69.2%
Simplified73.4%
Taylor expanded in D around 0 30.2%
+-commutative30.2%
fma-define30.2%
associate-*r*32.5%
unpow232.5%
unpow232.5%
swap-sqr46.0%
unpow246.0%
Simplified46.0%
Taylor expanded in D around inf 17.9%
associate-*r*18.1%
*-commutative18.1%
unpow218.1%
unpow218.1%
swap-sqr21.7%
unpow221.7%
*-commutative21.7%
*-commutative21.7%
associate-*r/21.7%
*-commutative21.7%
times-frac19.7%
Simplified19.7%
unpow219.7%
*-commutative19.7%
*-commutative19.7%
Applied egg-rr19.7%
associate-*l/21.9%
div-inv21.9%
pow-flip21.9%
metadata-eval21.9%
Applied egg-rr21.9%
associate-/l*22.0%
Simplified22.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 (<= M_m 4.4e+40) w0 (* -0.125 (* (* (* M_m D_m) (* M_m D_m)) (* (/ w0 l) (/ h (* d d)))))))
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 <= 4.4e+40) {
tmp = w0;
} else {
tmp = -0.125 * (((M_m * D_m) * (M_m * D_m)) * ((w0 / l) * (h / (d * d))));
}
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 <= 4.4d+40) then
tmp = w0
else
tmp = (-0.125d0) * (((m_m * d_m) * (m_m * d_m)) * ((w0 / l) * (h / (d * d))))
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 <= 4.4e+40) {
tmp = w0;
} else {
tmp = -0.125 * (((M_m * D_m) * (M_m * D_m)) * ((w0 / l) * (h / (d * d))));
}
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 <= 4.4e+40: tmp = w0 else: tmp = -0.125 * (((M_m * D_m) * (M_m * D_m)) * ((w0 / l) * (h / (d * d)))) 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 <= 4.4e+40) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(M_m * D_m) * Float64(M_m * D_m)) * Float64(Float64(w0 / l) * Float64(h / Float64(d * d))))); 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 <= 4.4e+40)
tmp = w0;
else
tmp = -0.125 * (((M_m * D_m) * (M_m * D_m)) * ((w0 / l) * (h / (d * d))));
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, 4.4e+40], w0, N[(-0.125 * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(w0 / l), $MachinePrecision] * N[(h / N[(d * d), $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 \leq 4.4 \cdot 10^{+40}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(\left(M\_m \cdot D\_m\right) \cdot \left(M\_m \cdot D\_m\right)\right) \cdot \left(\frac{w0}{\ell} \cdot \frac{h}{d \cdot d}\right)\right)\\
\end{array}
\end{array}
if M < 4.3999999999999998e40Initial program 85.9%
Simplified85.5%
Taylor expanded in D around 0 75.4%
if 4.3999999999999998e40 < M Initial program 69.2%
Simplified73.4%
Taylor expanded in D around 0 30.2%
+-commutative30.2%
fma-define30.2%
associate-*r*32.5%
unpow232.5%
unpow232.5%
swap-sqr46.0%
unpow246.0%
Simplified46.0%
Taylor expanded in D around inf 17.9%
associate-*r*18.1%
*-commutative18.1%
unpow218.1%
unpow218.1%
swap-sqr21.7%
unpow221.7%
*-commutative21.7%
*-commutative21.7%
associate-*r/21.7%
*-commutative21.7%
times-frac19.7%
Simplified19.7%
unpow219.7%
*-commutative19.7%
*-commutative19.7%
Applied egg-rr19.7%
unpow219.7%
Applied egg-rr19.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 82.9%
Simplified83.3%
Taylor expanded in D around 0 70.4%
herbie shell --seed 2024135
(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))))))