
(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 9 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 (<= (- 1.0 (* (pow (/ (* D M) (* d 2.0)) 2.0) (/ h l))) 5e+183) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ M d) (/ D 2.0)) 2.0))))) (* w0 (sqrt (- 1.0 (/ (* h (pow (* 0.5 (* M (/ D 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 ((1.0 - (pow(((D * M) / (d * 2.0)), 2.0) * (h / l))) <= 5e+183) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = w0 * sqrt((1.0 - ((h * pow((0.5 * (M * (D / 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 ((1.0d0 - ((((d * m) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l))) <= 5d+183) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (((m / d_1) * (d / 2.0d0)) ** 2.0d0))))
else
tmp = w0 * sqrt((1.0d0 - ((h * ((0.5d0 * (m * (d / 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 ((1.0 - (Math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l))) <= 5e+183) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow((0.5 * (M * (D / 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 (1.0 - (math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l))) <= 5e+183: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M / d) * (D / 2.0)), 2.0)))) else: tmp = w0 * math.sqrt((1.0 - ((h * math.pow((0.5 * (M * (D / 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(1.0 - Float64((Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l))) <= 5e+183) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(0.5 * Float64(M * Float64(D / 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 ((1.0 - ((((D * M) / (d * 2.0)) ^ 2.0) * (h / l))) <= 5e+183)
tmp = w0 * sqrt((1.0 - ((h / l) * (((M / d) * (D / 2.0)) ^ 2.0))));
else
tmp = w0 * sqrt((1.0 - ((h * ((0.5 * (M * (D / 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[(1.0 - N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+183], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(0.5 * N[(M * N[(D / 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}\;1 - {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq 5 \cdot 10^{+183}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}}\\
\end{array}
\end{array}
if (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) < 5.00000000000000009e183Initial program 99.9%
*-commutative99.9%
times-frac99.3%
Simplified99.3%
if 5.00000000000000009e183 < (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) Initial program 56.0%
*-commutative56.0%
times-frac57.0%
Simplified57.0%
*-commutative57.0%
frac-times56.0%
*-commutative56.0%
associate-*l/76.2%
div-inv76.2%
associate-*l*76.2%
associate-/r*76.2%
metadata-eval76.2%
Applied egg-rr76.2%
Taylor expanded in M around 0 76.2%
div-inv76.2%
Applied egg-rr76.2%
associate-*r/76.2%
*-rgt-identity76.2%
associate-*l/76.2%
*-commutative76.2%
Simplified76.2%
Final simplification91.3%
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 (<= (- 1.0 (* (pow (/ (* D M) (* d 2.0)) 2.0) (/ h l))) INFINITY) (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ M d) (/ D 2.0)) 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 ((1.0 - (pow(((D * M) / (d * 2.0)), 2.0) * (h / l))) <= ((double) INFINITY)) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
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 ((1.0 - (Math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l))) <= Double.POSITIVE_INFINITY) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M / d) * (D / 2.0)), 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 (1.0 - (math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l))) <= math.inf: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M / d) * (D / 2.0)), 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(1.0 - Float64((Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l))) <= Inf) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M / d) * Float64(D / 2.0)) ^ 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 ((1.0 - ((((D * M) / (d * 2.0)) ^ 2.0) * (h / l))) <= Inf)
tmp = w0 * sqrt((1.0 - ((h / l) * (((M / d) * (D / 2.0)) ^ 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[(1.0 - N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D / 2.0), $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}\;1 - {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq \infty:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) < +inf.0Initial program 92.2%
*-commutative92.2%
times-frac92.2%
Simplified92.2%
if +inf.0 < (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) Initial program 0.0%
*-commutative0.0%
times-frac0.0%
Simplified0.0%
Taylor expanded in M around 0 75.1%
Final simplification90.8%
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 (sqrt (- 1.0 (/ (* h (pow (* 0.5 (/ (* D M) 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) {
return w0 * sqrt((1.0 - ((h * pow((0.5 * ((D * M) / d)), 2.0)) / l)));
}
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 * sqrt((1.0d0 - ((h * ((0.5d0 * ((d * m) / d_1)) ** 2.0d0)) / l)))
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 * Math.sqrt((1.0 - ((h * Math.pow((0.5 * ((D * M) / d)), 2.0)) / l)));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - ((h * math.pow((0.5 * ((D * M) / d)), 2.0)) / l)))
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(0.5 * Float64(Float64(D * M) / d)) ^ 2.0)) / l)))) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 - ((h * ((0.5 * ((D * M) / d)) ^ 2.0)) / l)));
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_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(0.5 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 - \frac{h \cdot {\left(0.5 \cdot \frac{D \cdot M}{d}\right)}^{2}}{\ell}}
\end{array}
Initial program 84.6%
*-commutative84.6%
times-frac84.6%
Simplified84.6%
*-commutative84.6%
frac-times84.6%
*-commutative84.6%
associate-*l/90.9%
div-inv90.9%
associate-*l*90.2%
associate-/r*90.2%
metadata-eval90.2%
Applied egg-rr90.2%
Taylor expanded in M around 0 90.9%
Final simplification90.9%
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 (<= d 5e-73) (* w0 (sqrt (- 1.0 (/ (* 0.25 (/ (/ (* M (* M (* D (* h D)))) d) d)) l)))) (* w0 (+ 1.0 (* (* h (/ (pow (* M (/ D d)) 2.0) 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 (d <= 5e-73) {
tmp = w0 * sqrt((1.0 - ((0.25 * (((M * (M * (D * (h * D)))) / d) / d)) / l)));
} else {
tmp = w0 * (1.0 + ((h * (pow((M * (D / d)), 2.0) / 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 (d_1 <= 5d-73) then
tmp = w0 * sqrt((1.0d0 - ((0.25d0 * (((m * (m * (d * (h * d)))) / d_1) / d_1)) / l)))
else
tmp = w0 * (1.0d0 + ((h * (((m * (d / d_1)) ** 2.0d0) / 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 (d <= 5e-73) {
tmp = w0 * Math.sqrt((1.0 - ((0.25 * (((M * (M * (D * (h * D)))) / d) / d)) / l)));
} else {
tmp = w0 * (1.0 + ((h * (Math.pow((M * (D / d)), 2.0) / 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 d <= 5e-73: tmp = w0 * math.sqrt((1.0 - ((0.25 * (((M * (M * (D * (h * D)))) / d) / d)) / l))) else: tmp = w0 * (1.0 + ((h * (math.pow((M * (D / d)), 2.0) / 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 (d <= 5e-73) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.25 * Float64(Float64(Float64(M * Float64(M * Float64(D * Float64(h * D)))) / d) / d)) / l)))); else tmp = Float64(w0 * Float64(1.0 + Float64(Float64(h * Float64((Float64(M * Float64(D / d)) ^ 2.0) / 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 (d <= 5e-73)
tmp = w0 * sqrt((1.0 - ((0.25 * (((M * (M * (D * (h * D)))) / d) / d)) / l)));
else
tmp = w0 * (1.0 + ((h * (((M * (D / d)) ^ 2.0) / 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[d, 5e-73], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.25 * N[(N[(N[(M * N[(M * N[(D * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[(1.0 + N[(N[(h * N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $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}\;d \leq 5 \cdot 10^{-73}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25 \cdot \frac{\frac{M \cdot \left(M \cdot \left(D \cdot \left(h \cdot D\right)\right)\right)}{d}}{d}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + \left(h \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot -0.125\right)\\
\end{array}
\end{array}
if d < 4.9999999999999998e-73Initial program 83.3%
*-commutative83.3%
times-frac82.7%
Simplified82.7%
Taylor expanded in M around 0 59.1%
associate-*r/59.1%
*-commutative59.1%
times-frac64.0%
*-commutative64.0%
*-commutative64.0%
associate-*l*62.8%
unpow262.8%
unpow262.8%
unpow262.8%
Simplified62.8%
associate-*l/62.8%
associate-/r*72.0%
associate-*l*78.9%
associate-*r*80.6%
Applied egg-rr80.6%
if 4.9999999999999998e-73 < d Initial program 87.0%
*-commutative87.0%
times-frac88.1%
Simplified88.1%
Taylor expanded in M around 0 64.1%
*-commutative64.1%
*-commutative64.1%
times-frac61.9%
*-commutative61.9%
unpow261.9%
unpow261.9%
*-commutative61.9%
unpow261.9%
Simplified61.9%
expm1-log1p-u61.9%
expm1-udef61.5%
times-frac69.3%
Applied egg-rr69.3%
expm1-def69.8%
expm1-log1p69.8%
Simplified69.8%
Taylor expanded in D around 0 64.1%
*-commutative64.1%
times-frac61.9%
unpow261.9%
unpow261.9%
times-frac69.8%
unpow269.8%
associate-/l*67.4%
associate-*r/68.5%
unpow268.5%
unpow268.5%
swap-sqr87.3%
associate-/r/87.3%
associate-/r/87.4%
unpow287.4%
associate-/r/91.9%
associate-/r/91.9%
*-commutative91.9%
Simplified91.9%
Final simplification84.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 (+ 1.0 (* (* h (/ (pow (* M (/ D d)) 2.0) 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) {
return w0 * (1.0 + ((h * (pow((M * (D / d)), 2.0) / l)) * -0.125));
}
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 * (1.0d0 + ((h * (((m * (d / d_1)) ** 2.0d0) / l)) * (-0.125d0)))
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 * (1.0 + ((h * (Math.pow((M * (D / d)), 2.0) / l)) * -0.125));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * (1.0 + ((h * (math.pow((M * (D / d)), 2.0) / l)) * -0.125))
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 * Float64(1.0 + Float64(Float64(h * Float64((Float64(M * Float64(D / d)) ^ 2.0) / l)) * -0.125))) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * (1.0 + ((h * (((M * (D / d)) ^ 2.0) / l)) * -0.125));
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_] := N[(w0 * N[(1.0 + N[(N[(h * N[(N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \left(1 + \left(h \cdot \frac{{\left(M \cdot \frac{D}{d}\right)}^{2}}{\ell}\right) \cdot -0.125\right)
\end{array}
Initial program 84.6%
*-commutative84.6%
times-frac84.6%
Simplified84.6%
Taylor expanded in M around 0 60.2%
*-commutative60.2%
*-commutative60.2%
times-frac60.6%
*-commutative60.6%
unpow260.6%
unpow260.6%
*-commutative60.6%
unpow260.6%
Simplified60.6%
expm1-log1p-u60.6%
expm1-udef60.0%
times-frac68.5%
Applied egg-rr68.5%
expm1-def69.9%
expm1-log1p69.9%
Simplified69.9%
Taylor expanded in D around 0 60.2%
*-commutative60.2%
times-frac60.6%
unpow260.6%
unpow260.6%
times-frac69.9%
unpow269.9%
associate-/l*67.9%
associate-*r/69.5%
unpow269.5%
unpow269.5%
swap-sqr80.5%
associate-/r/80.1%
associate-/r/80.6%
unpow280.6%
associate-/r/85.7%
associate-/r/85.7%
*-commutative85.7%
Simplified85.7%
Final simplification85.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.15e-118) 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.15e-118) {
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.15d-118) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((-0.125d0) * (((d / d_1) * (d / 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.15e-118) {
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.15e-118: 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.15e-118) 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.15e-118)
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.15e-118], 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.15 \cdot 10^{-118}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right)\right)\\
\end{array}
\end{array}
if M < 2.15000000000000009e-118Initial program 86.0%
*-commutative86.0%
times-frac86.0%
Simplified86.0%
Taylor expanded in M around 0 75.9%
if 2.15000000000000009e-118 < M Initial program 82.3%
*-commutative82.3%
times-frac82.2%
Simplified82.2%
Taylor expanded in M around 0 53.7%
*-commutative53.7%
*-commutative53.7%
times-frac52.7%
*-commutative52.7%
unpow252.7%
unpow252.7%
*-commutative52.7%
unpow252.7%
Simplified52.7%
expm1-log1p-u52.7%
expm1-udef51.5%
times-frac59.3%
Applied egg-rr59.3%
expm1-def61.6%
expm1-log1p61.6%
Simplified61.6%
Final simplification70.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 (if (<= M 3.2e+63) w0 (* (/ -0.125 (* d d)) (/ (* (* w0 (* 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 <= 3.2e+63) {
tmp = w0;
} else {
tmp = (-0.125 / (d * d)) * (((w0 * (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 <= 3.2d+63) then
tmp = w0
else
tmp = ((-0.125d0) / (d_1 * d_1)) * (((w0 * (d * d)) * (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 <= 3.2e+63) {
tmp = w0;
} else {
tmp = (-0.125 / (d * d)) * (((w0 * (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 <= 3.2e+63: tmp = w0 else: tmp = (-0.125 / (d * d)) * (((w0 * (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 <= 3.2e+63) tmp = w0; else tmp = Float64(Float64(-0.125 / Float64(d * d)) * Float64(Float64(Float64(w0 * Float64(D * D)) * 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 <= 3.2e+63)
tmp = w0;
else
tmp = (-0.125 / (d * d)) * (((w0 * (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, 3.2e+63], w0, N[(N[(-0.125 / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w0 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 3.2 \cdot 10^{+63}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.125}{d \cdot d} \cdot \frac{\left(w0 \cdot \left(D \cdot D\right)\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)}{\ell}\\
\end{array}
\end{array}
if M < 3.20000000000000011e63Initial program 84.6%
*-commutative84.6%
times-frac84.6%
Simplified84.6%
Taylor expanded in M around 0 74.3%
if 3.20000000000000011e63 < M Initial program 84.7%
*-commutative84.7%
times-frac84.6%
Simplified84.6%
Taylor expanded in M around 0 43.3%
*-commutative43.3%
*-commutative43.3%
times-frac45.4%
*-commutative45.4%
unpow245.4%
unpow245.4%
*-commutative45.4%
unpow245.4%
Simplified45.4%
expm1-log1p-u45.4%
expm1-udef43.2%
times-frac49.3%
Applied egg-rr49.3%
expm1-def53.6%
expm1-log1p53.6%
Simplified53.6%
Taylor expanded in D around inf 35.8%
associate-*r/35.8%
associate-*r*35.7%
unpow235.7%
associate-*l*35.7%
unpow235.7%
*-commutative35.7%
unpow235.7%
Simplified35.7%
times-frac38.0%
associate-*r*37.9%
Applied egg-rr37.9%
Final simplification67.0%
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 (+ 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) {
return w0 * (1.0 + (-0.125 * ((D / d) * ((D / d) * (h * ((M * M) / l))))));
}
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 * (1.0d0 + ((-0.125d0) * ((d / d_1) * ((d / d_1) * (h * ((m * m) / l))))))
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 * (1.0 + (-0.125 * ((D / d) * ((D / d) * (h * ((M * M) / l))))));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * (1.0 + (-0.125 * ((D / d) * ((D / d) * (h * ((M * M) / l))))))
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(D / d) * Float64(Float64(D / d) * Float64(h * Float64(Float64(M * M) / l))))))) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * (1.0 + (-0.125 * ((D / d) * ((D / d) * (h * ((M * M) / l))))));
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_] := N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(D / d), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(h * N[(N[(M * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \left(1 + -0.125 \cdot \left(\frac{D}{d} \cdot \left(\frac{D}{d} \cdot \left(h \cdot \frac{M \cdot M}{\ell}\right)\right)\right)\right)
\end{array}
Initial program 84.6%
*-commutative84.6%
times-frac84.6%
Simplified84.6%
Taylor expanded in M around 0 60.2%
*-commutative60.2%
*-commutative60.2%
times-frac60.6%
*-commutative60.6%
unpow260.6%
unpow260.6%
*-commutative60.6%
unpow260.6%
Simplified60.6%
expm1-log1p-u44.2%
expm1-udef44.2%
times-frac51.3%
associate-/l*49.3%
Applied egg-rr49.3%
expm1-def49.3%
expm1-log1p67.9%
associate-*l*70.2%
associate-/r/73.1%
Simplified73.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 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 84.6%
*-commutative84.6%
times-frac84.6%
Simplified84.6%
Taylor expanded in M around 0 68.4%
Final simplification68.4%
herbie shell --seed 2023192
(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))))))