
(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}
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e-195) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* D (* M (/ 0.5 d))) 2.0))))) (* w0 (sqrt (- 1.0 (/ (* h (pow (* M (* D (/ 0.5 d))) 2.0)) l))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-195) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow((D * (M * (0.5 / d))), 2.0))));
} else {
tmp = w0 * sqrt((1.0 - ((h * pow((M * (D * (0.5 / d))), 2.0)) / l)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-2d-195)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((d * (m * (0.5d0 / d_1))) ** 2.0d0))))
else
tmp = w0 * sqrt((1.0d0 - ((h * ((m * (d * (0.5d0 / d_1))) ** 2.0d0)) / l)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-195) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((D * (M * (0.5 / d))), 2.0))));
} else {
tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow((M * (D * (0.5 / d))), 2.0)) / l)));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-195: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((D * (M * (0.5 / d))), 2.0)))) else: tmp = w0 * math.sqrt((1.0 - ((h * math.pow((M * (D * (0.5 / d))), 2.0)) / l))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e-195) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(D * Float64(M * Float64(0.5 / d))) ^ 2.0))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0)) / l)))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -2e-195)
tmp = w0 * sqrt((1.0 - ((h / l) * ((D * (M * (0.5 / d))) ^ 2.0))));
else
tmp = w0 * sqrt((1.0 - ((h * ((M * (D * (0.5 / d))) ^ 2.0)) / l)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e-195], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-195}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}}\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -2.0000000000000002e-195Initial program 74.9%
div-inv74.8%
*-commutative74.8%
associate-*l*70.6%
associate-/r*70.6%
metadata-eval70.6%
Applied egg-rr70.6%
if -2.0000000000000002e-195 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 88.3%
*-commutative88.3%
times-frac88.3%
Simplified88.3%
*-commutative88.3%
frac-times88.3%
*-commutative88.3%
associate-*l/96.0%
div-inv96.0%
associate-*l*96.6%
associate-/r*96.6%
metadata-eval96.6%
Applied egg-rr96.6%
Final simplification87.1%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -4e-11) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* D (* M (/ 0.5 d))) 2.0))))) w0))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -4e-11) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow((D * (M * (0.5 / d))), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-4d-11)) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * ((d * (m * (0.5d0 / d_1))) ** 2.0d0))))
else
tmp = w0
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -4e-11) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((D * (M * (0.5 / d))), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -4e-11: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((D * (M * (0.5 / d))), 2.0)))) else: tmp = w0 return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -4e-11) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(D * Float64(M * Float64(0.5 / d))) ^ 2.0))))); else tmp = w0; end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -4e-11)
tmp = w0 * sqrt((1.0 - ((h / l) * ((D * (M * (0.5 / d))) ^ 2.0))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -4e-11], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{-11}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) < -3.99999999999999976e-11Initial program 69.7%
div-inv69.7%
*-commutative69.7%
associate-*l*68.2%
associate-/r*68.2%
metadata-eval68.2%
Applied egg-rr68.2%
if -3.99999999999999976e-11 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)) Initial program 89.3%
*-commutative89.3%
times-frac87.8%
Simplified87.8%
Taylor expanded in M around 0 96.9%
Final simplification88.1%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= M 2.05e-107) w0 (* w0 (+ 1.0 (* (* D (/ h (/ (pow (/ d M) 2.0) (/ D l)))) -0.125)))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 2.05e-107) {
tmp = w0;
} else {
tmp = w0 * (1.0 + ((D * (h / (pow((d / M), 2.0) / (D / l)))) * -0.125));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (m <= 2.05d-107) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((d * (h / (((d_1 / m) ** 2.0d0) / (d / l)))) * (-0.125d0)))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 2.05e-107) {
tmp = w0;
} else {
tmp = w0 * (1.0 + ((D * (h / (Math.pow((d / M), 2.0) / (D / l)))) * -0.125));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= 2.05e-107: tmp = w0 else: tmp = w0 * (1.0 + ((D * (h / (math.pow((d / M), 2.0) / (D / l)))) * -0.125)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 2.05e-107) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(Float64(D * Float64(h / Float64((Float64(d / M) ^ 2.0) / Float64(D / l)))) * -0.125))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (M <= 2.05e-107)
tmp = w0;
else
tmp = w0 * (1.0 + ((D * (h / (((d / M) ^ 2.0) / (D / l)))) * -0.125));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 2.05e-107], w0, N[(w0 * N[(1.0 + N[(N[(D * N[(h / N[(N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision] / N[(D / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.05 \cdot 10^{-107}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + \left(D \cdot \frac{h}{\frac{{\left(\frac{d}{M}\right)}^{2}}{\frac{D}{\ell}}}\right) \cdot -0.125\right)\\
\end{array}
\end{array}
if M < 2.05e-107Initial program 84.8%
*-commutative84.8%
times-frac83.6%
Simplified83.6%
Taylor expanded in M around 0 71.1%
if 2.05e-107 < M Initial program 80.4%
*-commutative80.4%
times-frac78.2%
Simplified78.2%
Taylor expanded in M around 0 56.5%
*-commutative56.5%
*-commutative56.5%
times-frac57.8%
*-commutative57.8%
unpow257.8%
unpow257.8%
*-commutative57.8%
unpow257.8%
Simplified57.8%
associate-*r/59.0%
times-frac62.7%
*-commutative62.7%
Applied egg-rr62.7%
associate-/l*62.7%
Simplified62.7%
Taylor expanded in D around 0 56.5%
*-commutative56.5%
*-commutative56.5%
unpow256.5%
times-frac56.7%
associate-/l*57.9%
unpow257.9%
times-frac70.0%
unpow270.0%
unpow270.0%
associate-*l/72.2%
associate-*l*73.6%
*-commutative73.6%
associate-*l/75.7%
associate-/l*77.1%
Simplified77.1%
Final simplification73.1%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= (/ h l) -5e-151) (* w0 (+ 1.0 (* -0.125 (/ (* (/ D d) (/ D d)) (/ l (* h (* M M))))))) w0))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -5e-151) {
tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) / (l / (h * (M * M))))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if ((h / l) <= (-5d-151)) then
tmp = w0 * (1.0d0 + ((-0.125d0) * (((d / d_1) * (d / d_1)) / (l / (h * (m * m))))))
else
tmp = w0
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -5e-151) {
tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) / (l / (h * (M * M))))));
} else {
tmp = w0;
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (h / l) <= -5e-151: tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) / (l / (h * (M * M)))))) else: tmp = w0 return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(h / l) <= -5e-151) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) / Float64(l / Float64(h * Float64(M * M))))))); else tmp = w0; end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((h / l) <= -5e-151)
tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) / (l / (h * (M * M))))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -5e-151], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] / N[(l / N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-151}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \frac{\frac{D}{d} \cdot \frac{D}{d}}{\frac{\ell}{h \cdot \left(M \cdot M\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -5.00000000000000003e-151Initial program 75.7%
*-commutative75.7%
times-frac74.7%
Simplified74.7%
Taylor expanded in M around 0 45.6%
*-commutative45.6%
*-commutative45.6%
times-frac46.3%
*-commutative46.3%
unpow246.3%
unpow246.3%
*-commutative46.3%
unpow246.3%
Simplified46.3%
associate-*r/47.2%
times-frac59.2%
*-commutative59.2%
Applied egg-rr59.2%
associate-/l*58.4%
Simplified58.4%
if -5.00000000000000003e-151 < (/.f64 h l) Initial program 90.8%
*-commutative90.8%
times-frac88.7%
Simplified88.7%
Taylor expanded in M around 0 96.4%
Final simplification77.7%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= M 2.2e-68) w0 (* w0 (+ 1.0 (* -0.125 (* (/ (* D D) (* d d)) (/ (* h (* M M)) l)))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 2.2e-68) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / l))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (m <= 2.2d-68) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((-0.125d0) * (((d * d) / (d_1 * d_1)) * ((h * (m * m)) / l))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 2.2e-68) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / l))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= 2.2e-68: tmp = w0 else: tmp = w0 * (1.0 + (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / l)))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 2.2e-68) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(D * D) / Float64(d * d)) * Float64(Float64(h * Float64(M * M)) / l))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (M <= 2.2e-68)
tmp = w0;
else
tmp = w0 * (1.0 + (-0.125 * (((D * D) / (d * d)) * ((h * (M * M)) / l))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 2.2e-68], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.2 \cdot 10^{-68}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right)\right)\\
\end{array}
\end{array}
if M < 2.20000000000000002e-68Initial program 84.2%
*-commutative84.2%
times-frac83.0%
Simplified83.0%
Taylor expanded in M around 0 71.3%
if 2.20000000000000002e-68 < M Initial program 81.2%
*-commutative81.2%
times-frac78.8%
Simplified78.8%
Taylor expanded in M around 0 55.1%
*-commutative55.1%
*-commutative55.1%
times-frac58.1%
*-commutative58.1%
unpow258.1%
unpow258.1%
*-commutative58.1%
unpow258.1%
Simplified58.1%
Final simplification67.5%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= M 1.55e-13) w0 (* -0.125 (* (* (/ D d) (/ D d)) (/ (* (* M M) (* h w0)) l)))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 1.55e-13) {
tmp = w0;
} else {
tmp = -0.125 * (((D / d) * (D / d)) * (((M * M) * (h * w0)) / l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
real(8) :: tmp
if (m <= 1.55d-13) then
tmp = w0
else
tmp = (-0.125d0) * (((d / d_1) * (d / d_1)) * (((m * m) * (h * w0)) / l))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 1.55e-13) {
tmp = w0;
} else {
tmp = -0.125 * (((D / d) * (D / d)) * (((M * M) * (h * w0)) / l));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= 1.55e-13: tmp = w0 else: tmp = -0.125 * (((D / d) * (D / d)) * (((M * M) * (h * w0)) / l)) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 1.55e-13) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(Float64(M * M) * Float64(h * w0)) / l))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (M <= 1.55e-13)
tmp = w0;
else
tmp = -0.125 * (((D / d) * (D / d)) * (((M * M) * (h * w0)) / l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 1.55e-13], w0, N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] * N[(h * w0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.55 \cdot 10^{-13}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{\left(M \cdot M\right) \cdot \left(h \cdot w0\right)}{\ell}\right)\\
\end{array}
\end{array}
if M < 1.55e-13Initial program 83.1%
*-commutative83.1%
times-frac82.0%
Simplified82.0%
Taylor expanded in M around 0 72.8%
if 1.55e-13 < M Initial program 84.2%
*-commutative84.2%
times-frac81.0%
Simplified81.0%
Taylor expanded in M around 0 51.9%
*-commutative51.9%
*-commutative51.9%
times-frac54.0%
*-commutative54.0%
unpow254.0%
unpow254.0%
*-commutative54.0%
unpow254.0%
Simplified54.0%
associate-*l/54.0%
associate-/l*51.9%
Applied egg-rr51.9%
Taylor expanded in D around inf 32.9%
associate-*r/32.9%
unpow232.9%
*-commutative32.9%
unpow232.9%
associate-*r/32.9%
times-frac33.3%
unpow233.3%
unpow233.3%
unpow233.3%
*-commutative33.3%
associate-*r*33.4%
*-commutative33.4%
Simplified33.4%
*-un-lft-identity33.4%
times-frac35.5%
Applied egg-rr35.5%
*-lft-identity35.5%
Simplified35.5%
Final simplification64.6%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 w0)
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) return w0 end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0
\end{array}
Initial program 83.4%
*-commutative83.4%
times-frac81.8%
Simplified81.8%
Taylor expanded in M around 0 69.3%
Final simplification69.3%
herbie shell --seed 2023229
(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))))))