
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)))))
(if (<= t_0 5e+236)
(* w0 (sqrt t_0))
(*
w0
(sqrt (- 1.0 (/ (* 0.25 (* M (* (/ M d) (/ (* D (* D h)) d)))) l)))))))assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = 1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l));
double tmp;
if (t_0 <= 5e+236) {
tmp = w0 * sqrt(t_0);
} else {
tmp = w0 * sqrt((1.0 - ((0.25 * (M * ((M / d) * ((D * (D * h)) / d)))) / l)));
}
return tmp;
}
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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))
if (t_0 <= 5d+236) then
tmp = w0 * sqrt(t_0)
else
tmp = w0 * sqrt((1.0d0 - ((0.25d0 * (m * ((m / d_1) * ((d * (d * h)) / d_1)))) / l)))
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = 1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l));
double tmp;
if (t_0 <= 5e+236) {
tmp = w0 * Math.sqrt(t_0);
} else {
tmp = w0 * Math.sqrt((1.0 - ((0.25 * (M * ((M / d) * ((D * (D * h)) / d)))) / l)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): t_0 = 1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) tmp = 0 if t_0 <= 5e+236: tmp = w0 * math.sqrt(t_0) else: tmp = w0 * math.sqrt((1.0 - ((0.25 * (M * ((M / d) * ((D * (D * h)) / d)))) / l))) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) t_0 = Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))) tmp = 0.0 if (t_0 <= 5e+236) tmp = Float64(w0 * sqrt(t_0)); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.25 * Float64(M * Float64(Float64(M / d) * Float64(Float64(D * Float64(D * h)) / d)))) / l)))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
t_0 = 1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l));
tmp = 0.0;
if (t_0 <= 5e+236)
tmp = w0 * sqrt(t_0);
else
tmp = w0 * sqrt((1.0 - ((0.25 * (M * ((M / d) * ((D * (D * h)) / d)))) / l)));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, 5e+236], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.25 * N[(M * N[(N[(M / d), $MachinePrecision] * N[(N[(D * N[(D * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{+236}:\\
\;\;\;\;w0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25 \cdot \left(M \cdot \left(\frac{M}{d} \cdot \frac{D \cdot \left(D \cdot h\right)}{d}\right)\right)}{\ell}}\\
\end{array}
\end{array}
if (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) < 4.9999999999999997e236Initial program 99.9%
if 4.9999999999999997e236 < (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) Initial program 40.9%
*-commutative40.9%
times-frac42.1%
Simplified42.1%
Taylor expanded in M around 0 46.3%
associate-*r/46.3%
*-commutative46.3%
times-frac50.0%
*-commutative50.0%
*-commutative50.0%
associate-*l*49.0%
unpow249.0%
unpow249.0%
unpow249.0%
Simplified49.0%
div-inv49.0%
associate-*l*49.2%
Applied egg-rr49.2%
Taylor expanded in M around 0 50.0%
associate-*r*49.0%
*-commutative49.0%
unpow249.0%
*-commutative49.0%
unpow249.0%
times-frac50.7%
unpow250.7%
associate-*r/53.3%
associate-*r*56.8%
*-commutative56.8%
*-commutative56.8%
Simplified56.8%
associate-*l/56.8%
associate-*l*57.9%
*-commutative57.9%
Applied egg-rr57.9%
Final simplification86.5%
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) (- INFINITY))
(* w0 (sqrt (- 1.0 (/ (* 0.25 (* M (* (/ M d) (/ (* D (* D h)) d)))) l))))
(if (<= (/ h l) -2e-285)
(* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ M d) (/ D 2.0)) 2.0)))))
w0)))assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -((double) INFINITY)) {
tmp = w0 * sqrt((1.0 - ((0.25 * (M * ((M / d) * ((D * (D * h)) / d)))) / l)));
} else if ((h / l) <= -2e-285) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -Double.POSITIVE_INFINITY) {
tmp = w0 * Math.sqrt((1.0 - ((0.25 * (M * ((M / d) * ((D * (D * h)) / d)))) / l)));
} else if ((h / l) <= -2e-285) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (h / l) <= -math.inf: tmp = w0 * math.sqrt((1.0 - ((0.25 * (M * ((M / d) * ((D * (D * h)) / d)))) / l))) elif (h / l) <= -2e-285: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M / d) * (D / 2.0)), 2.0)))) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(h / l) <= Float64(-Inf)) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.25 * Float64(M * Float64(Float64(M / d) * Float64(Float64(D * Float64(D * h)) / d)))) / l)))); elseif (Float64(h / l) <= -2e-285) 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, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((h / l) <= -Inf)
tmp = w0 * sqrt((1.0 - ((0.25 * (M * ((M / d) * ((D * (D * h)) / d)))) / l)));
elseif ((h / l) <= -2e-285)
tmp = w0 * sqrt((1.0 - ((h / l) * (((M / d) * (D / 2.0)) ^ 2.0))));
else
tmp = w0;
end
tmp_2 = tmp;
end
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], (-Infinity)], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.25 * N[(M * N[(N[(M / d), $MachinePrecision] * N[(N[(D * N[(D * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -2e-285], 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, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25 \cdot \left(M \cdot \left(\frac{M}{d} \cdot \frac{D \cdot \left(D \cdot h\right)}{d}\right)\right)}{\ell}}\\
\mathbf{elif}\;\frac{h}{\ell} \leq -2 \cdot 10^{-285}:\\
\;\;\;\;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 h l) < -inf.0Initial program 40.8%
*-commutative40.8%
times-frac40.8%
Simplified40.8%
Taylor expanded in M around 0 56.9%
associate-*r/56.9%
*-commutative56.9%
times-frac56.8%
*-commutative56.8%
*-commutative56.8%
associate-*l*52.2%
unpow252.2%
unpow252.2%
unpow252.2%
Simplified52.2%
div-inv52.2%
associate-*l*52.2%
Applied egg-rr52.2%
Taylor expanded in M around 0 56.8%
associate-*r*52.2%
*-commutative52.2%
unpow252.2%
*-commutative52.2%
unpow252.2%
times-frac53.2%
unpow253.2%
associate-*r/53.2%
associate-*r*63.5%
*-commutative63.5%
*-commutative63.5%
Simplified63.5%
associate-*l/63.5%
associate-*l*63.5%
*-commutative63.5%
Applied egg-rr63.5%
if -inf.0 < (/.f64 h l) < -2.00000000000000015e-285Initial program 80.9%
*-commutative80.9%
times-frac80.9%
Simplified80.9%
if -2.00000000000000015e-285 < (/.f64 h l) Initial program 87.6%
*-commutative87.6%
times-frac87.6%
Simplified87.6%
Taylor expanded in M around 0 95.2%
Final simplification86.0%
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) -2e-137) (* w0 (sqrt (- 1.0 (* (/ 0.25 l) (* (* M (/ M d)) (* h (* D (/ D d)))))))) w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -2e-137) {
tmp = w0 * sqrt((1.0 - ((0.25 / l) * ((M * (M / d)) * (h * (D * (D / d)))))));
} else {
tmp = w0;
}
return tmp;
}
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) <= (-2d-137)) then
tmp = w0 * sqrt((1.0d0 - ((0.25d0 / l) * ((m * (m / d_1)) * (h * (d * (d / d_1)))))))
else
tmp = w0
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -2e-137) {
tmp = w0 * Math.sqrt((1.0 - ((0.25 / l) * ((M * (M / d)) * (h * (D * (D / d)))))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (h / l) <= -2e-137: tmp = w0 * math.sqrt((1.0 - ((0.25 / l) * ((M * (M / d)) * (h * (D * (D / d))))))) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(h / l) <= -2e-137) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.25 / l) * Float64(Float64(M * Float64(M / d)) * Float64(h * Float64(D * Float64(D / d)))))))); else tmp = w0; end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((h / l) <= -2e-137)
tmp = w0 * sqrt((1.0 - ((0.25 / l) * ((M * (M / d)) * (h * (D * (D / d)))))));
else
tmp = w0;
end
tmp_2 = tmp;
end
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], -2e-137], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.25 / l), $MachinePrecision] * N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(D * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -2 \cdot 10^{-137}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25}{\ell} \cdot \left(\left(M \cdot \frac{M}{d}\right) \cdot \left(h \cdot \left(D \cdot \frac{D}{d}\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (/.f64 h l) < -1.99999999999999996e-137Initial program 73.5%
*-commutative73.5%
times-frac73.5%
Simplified73.5%
Taylor expanded in M around 0 50.7%
associate-*r/50.7%
*-commutative50.7%
times-frac52.5%
*-commutative52.5%
*-commutative52.5%
associate-*l*53.8%
unpow253.8%
unpow253.8%
unpow253.8%
Simplified53.8%
div-inv52.9%
associate-*l*57.4%
Applied egg-rr57.4%
Taylor expanded in M around 0 52.5%
associate-*r*53.8%
*-commutative53.8%
unpow253.8%
*-commutative53.8%
unpow253.8%
times-frac59.1%
unpow259.1%
associate-*r/62.6%
associate-*r*66.8%
*-commutative66.8%
*-commutative66.8%
Simplified66.8%
Taylor expanded in D around 0 62.6%
associate-/l*60.7%
associate-/r/64.3%
unpow264.3%
associate-*l/66.1%
*-commutative66.1%
Simplified66.1%
if -1.99999999999999996e-137 < (/.f64 h l) Initial program 87.3%
*-commutative87.3%
times-frac87.3%
Simplified87.3%
Taylor expanded in M around 0 91.5%
Final simplification80.0%
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-12) (* w0 (sqrt (- 1.0 (/ (* 0.25 (* M (* (/ M d) (/ (* D (* D h)) d)))) l)))) (+ w0 (* D (* w0 (* (/ M (* l (* (/ d M) (/ d h)))) (* D -0.125)))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 5e-12) {
tmp = w0 * sqrt((1.0 - ((0.25 * (M * ((M / d) * ((D * (D * h)) / d)))) / l)));
} else {
tmp = w0 + (D * (w0 * ((M / (l * ((d / M) * (d / h)))) * (D * -0.125))));
}
return tmp;
}
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 <= 5d-12) then
tmp = w0 * sqrt((1.0d0 - ((0.25d0 * (m * ((m / d_1) * ((d * (d * h)) / d_1)))) / l)))
else
tmp = w0 + (d * (w0 * ((m / (l * ((d_1 / m) * (d_1 / h)))) * (d * (-0.125d0)))))
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (D <= 5e-12) {
tmp = w0 * Math.sqrt((1.0 - ((0.25 * (M * ((M / d) * ((D * (D * h)) / d)))) / l)));
} else {
tmp = w0 + (D * (w0 * ((M / (l * ((d / M) * (d / h)))) * (D * -0.125))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if D <= 5e-12: tmp = w0 * math.sqrt((1.0 - ((0.25 * (M * ((M / d) * ((D * (D * h)) / d)))) / l))) else: tmp = w0 + (D * (w0 * ((M / (l * ((d / M) * (d / h)))) * (D * -0.125)))) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (D <= 5e-12) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.25 * Float64(M * Float64(Float64(M / d) * Float64(Float64(D * Float64(D * h)) / d)))) / l)))); else tmp = Float64(w0 + Float64(D * Float64(w0 * Float64(Float64(M / Float64(l * Float64(Float64(d / M) * Float64(d / h)))) * Float64(D * -0.125))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (D <= 5e-12)
tmp = w0 * sqrt((1.0 - ((0.25 * (M * ((M / d) * ((D * (D * h)) / d)))) / l)));
else
tmp = w0 + (D * (w0 * ((M / (l * ((d / M) * (d / h)))) * (D * -0.125))));
end
tmp_2 = tmp;
end
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-12], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.25 * N[(M * N[(N[(M / d), $MachinePrecision] * N[(N[(D * N[(D * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 + N[(D * N[(w0 * N[(N[(M / N[(l * N[(N[(d / M), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 5 \cdot 10^{-12}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25 \cdot \left(M \cdot \left(\frac{M}{d} \cdot \frac{D \cdot \left(D \cdot h\right)}{d}\right)\right)}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 + D \cdot \left(w0 \cdot \left(\frac{M}{\ell \cdot \left(\frac{d}{M} \cdot \frac{d}{h}\right)} \cdot \left(D \cdot -0.125\right)\right)\right)\\
\end{array}
\end{array}
if D < 4.9999999999999997e-12Initial program 80.2%
*-commutative80.2%
times-frac79.7%
Simplified79.7%
Taylor expanded in M around 0 52.8%
associate-*r/52.8%
*-commutative52.8%
times-frac55.3%
*-commutative55.3%
*-commutative55.3%
associate-*l*56.0%
unpow256.0%
unpow256.0%
unpow256.0%
Simplified56.0%
div-inv55.0%
associate-*l*62.9%
Applied egg-rr62.9%
Taylor expanded in M around 0 55.3%
associate-*r*56.0%
*-commutative56.0%
unpow256.0%
*-commutative56.0%
unpow256.0%
times-frac64.3%
unpow264.3%
associate-*r/68.7%
associate-*r*73.9%
*-commutative73.9%
*-commutative73.9%
Simplified73.9%
associate-*l/73.9%
associate-*l*79.3%
*-commutative79.3%
Applied egg-rr79.3%
if 4.9999999999999997e-12 < D Initial program 84.7%
*-commutative84.7%
times-frac86.7%
Simplified86.7%
Taylor expanded in M around 0 52.6%
*-commutative52.6%
unpow252.6%
unpow252.6%
unpow252.6%
Simplified52.6%
Taylor expanded in D around 0 52.6%
unpow252.6%
*-commutative52.6%
times-frac56.6%
unpow256.6%
times-frac58.6%
associate-*l/62.8%
associate-/r/62.8%
*-commutative62.8%
unpow262.8%
associate-/l*68.8%
associate-*l/72.8%
associate-/r/82.9%
*-commutative82.9%
*-commutative82.9%
associate-/l*72.8%
Simplified66.5%
distribute-rgt-in66.6%
*-un-lft-identity66.6%
associate-*l*66.6%
associate-/r/74.9%
associate-/l*79.3%
div-inv79.3%
clear-num79.3%
Applied egg-rr79.3%
pow179.3%
associate-*l*79.3%
associate-*l*79.3%
associate-/l/79.3%
associate-/l*81.3%
Applied egg-rr81.3%
unpow181.3%
*-commutative81.3%
associate-/r/81.3%
*-commutative81.3%
Simplified81.3%
Final simplification79.7%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (or (<= M -4.8e+269) (not (<= M 5.9e+62))) (* -0.125 (* D (* (* (/ M d) (* w0 (/ M d))) (* h (/ D l))))) w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((M <= -4.8e+269) || !(M <= 5.9e+62)) {
tmp = -0.125 * (D * (((M / d) * (w0 * (M / d))) * (h * (D / l))));
} else {
tmp = w0;
}
return tmp;
}
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 <= (-4.8d+269)) .or. (.not. (m <= 5.9d+62))) then
tmp = (-0.125d0) * (d * (((m / d_1) * (w0 * (m / d_1))) * (h * (d / l))))
else
tmp = w0
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((M <= -4.8e+269) || !(M <= 5.9e+62)) {
tmp = -0.125 * (D * (((M / d) * (w0 * (M / d))) * (h * (D / l))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (M <= -4.8e+269) or not (M <= 5.9e+62): tmp = -0.125 * (D * (((M / d) * (w0 * (M / d))) * (h * (D / l)))) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if ((M <= -4.8e+269) || !(M <= 5.9e+62)) tmp = Float64(-0.125 * Float64(D * Float64(Float64(Float64(M / d) * Float64(w0 * Float64(M / d))) * Float64(h * Float64(D / l))))); else tmp = w0; end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((M <= -4.8e+269) || ~((M <= 5.9e+62)))
tmp = -0.125 * (D * (((M / d) * (w0 * (M / d))) * (h * (D / l))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[Or[LessEqual[M, -4.8e+269], N[Not[LessEqual[M, 5.9e+62]], $MachinePrecision]], N[(-0.125 * N[(D * N[(N[(N[(M / d), $MachinePrecision] * N[(w0 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(D / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -4.8 \cdot 10^{+269} \lor \neg \left(M \leq 5.9 \cdot 10^{+62}\right):\\
\;\;\;\;-0.125 \cdot \left(D \cdot \left(\left(\frac{M}{d} \cdot \left(w0 \cdot \frac{M}{d}\right)\right) \cdot \left(h \cdot \frac{D}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if M < -4.79999999999999987e269 or 5.9000000000000003e62 < M Initial program 71.8%
*-commutative71.8%
times-frac70.2%
Simplified70.2%
Taylor expanded in M around 0 40.5%
*-commutative40.5%
unpow240.5%
unpow240.5%
unpow240.5%
Simplified40.5%
Taylor expanded in D around 0 40.5%
unpow240.5%
*-commutative40.5%
times-frac42.2%
unpow242.2%
times-frac44.2%
associate-*l/54.1%
associate-/r/54.1%
*-commutative54.1%
unpow254.1%
associate-/l*54.3%
associate-*l/54.5%
associate-/r/54.6%
*-commutative54.6%
*-commutative54.6%
associate-/l*54.5%
Simplified44.3%
Taylor expanded in D around inf 29.4%
*-commutative29.4%
times-frac32.8%
associate-*r*31.3%
unpow231.3%
times-frac31.3%
associate-*l/32.9%
unpow232.9%
associate-*l/33.4%
unpow233.4%
associate-/l*33.8%
associate-*l/33.9%
associate-/r/34.0%
*-commutative34.0%
associate-/l*33.9%
associate-/r/33.9%
Simplified34.6%
Taylor expanded in D around 0 29.9%
*-commutative29.9%
times-frac33.1%
associate-/l*33.2%
*-commutative33.2%
associate-/l*33.1%
*-commutative33.1%
unpow233.1%
associate-*r*31.5%
times-frac31.8%
unpow231.8%
associate-/l*32.2%
times-frac32.7%
associate-*r*34.2%
*-commutative34.2%
associate-*r*34.4%
*-commutative34.4%
*-commutative34.4%
Simplified32.9%
if -4.79999999999999987e269 < M < 5.9000000000000003e62Initial program 83.9%
*-commutative83.9%
times-frac84.5%
Simplified84.5%
Taylor expanded in M around 0 78.7%
Final simplification67.8%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (or (<= M -2.9e+269) (not (<= M 5.9e+62))) (* -0.125 (* D (* (/ D l) (* h (* (/ M d) (* w0 (/ M d))))))) w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((M <= -2.9e+269) || !(M <= 5.9e+62)) {
tmp = -0.125 * (D * ((D / l) * (h * ((M / d) * (w0 * (M / d))))));
} else {
tmp = w0;
}
return tmp;
}
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.9d+269)) .or. (.not. (m <= 5.9d+62))) then
tmp = (-0.125d0) * (d * ((d / l) * (h * ((m / d_1) * (w0 * (m / d_1))))))
else
tmp = w0
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((M <= -2.9e+269) || !(M <= 5.9e+62)) {
tmp = -0.125 * (D * ((D / l) * (h * ((M / d) * (w0 * (M / d))))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (M <= -2.9e+269) or not (M <= 5.9e+62): tmp = -0.125 * (D * ((D / l) * (h * ((M / d) * (w0 * (M / d)))))) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if ((M <= -2.9e+269) || !(M <= 5.9e+62)) tmp = Float64(-0.125 * Float64(D * Float64(Float64(D / l) * Float64(h * Float64(Float64(M / d) * Float64(w0 * Float64(M / d))))))); else tmp = w0; end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((M <= -2.9e+269) || ~((M <= 5.9e+62)))
tmp = -0.125 * (D * ((D / l) * (h * ((M / d) * (w0 * (M / d))))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[Or[LessEqual[M, -2.9e+269], N[Not[LessEqual[M, 5.9e+62]], $MachinePrecision]], N[(-0.125 * N[(D * N[(N[(D / l), $MachinePrecision] * N[(h * N[(N[(M / d), $MachinePrecision] * N[(w0 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -2.9 \cdot 10^{+269} \lor \neg \left(M \leq 5.9 \cdot 10^{+62}\right):\\
\;\;\;\;-0.125 \cdot \left(D \cdot \left(\frac{D}{\ell} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \left(w0 \cdot \frac{M}{d}\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if M < -2.90000000000000025e269 or 5.9000000000000003e62 < M Initial program 71.8%
*-commutative71.8%
times-frac70.2%
Simplified70.2%
Taylor expanded in M around 0 40.5%
*-commutative40.5%
unpow240.5%
unpow240.5%
unpow240.5%
Simplified40.5%
Taylor expanded in D around 0 40.5%
unpow240.5%
*-commutative40.5%
times-frac42.2%
unpow242.2%
times-frac44.2%
associate-*l/54.1%
associate-/r/54.1%
*-commutative54.1%
unpow254.1%
associate-/l*54.3%
associate-*l/54.5%
associate-/r/54.6%
*-commutative54.6%
*-commutative54.6%
associate-/l*54.5%
Simplified44.3%
Taylor expanded in D around inf 29.4%
*-commutative29.4%
times-frac32.8%
associate-*r*31.3%
unpow231.3%
times-frac31.3%
associate-*l/32.9%
unpow232.9%
associate-*l/33.4%
unpow233.4%
associate-/l*33.8%
associate-*l/33.9%
associate-/r/34.0%
*-commutative34.0%
associate-/l*33.9%
associate-/r/33.9%
Simplified34.6%
Taylor expanded in h around 0 33.1%
*-commutative33.1%
unpow233.1%
associate-*r*31.5%
times-frac31.8%
unpow231.8%
associate-/l*32.2%
times-frac32.7%
associate-*r*34.2%
*-commutative34.2%
associate-*r*34.4%
*-commutative34.4%
*-commutative34.4%
associate-*r/34.5%
times-frac34.6%
associate-/l*34.6%
associate-*r/34.6%
Simplified34.6%
if -2.90000000000000025e269 < M < 5.9000000000000003e62Initial program 83.9%
*-commutative83.9%
times-frac84.5%
Simplified84.5%
Taylor expanded in M around 0 78.7%
Final simplification68.2%
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.35e+269)
(* -0.125 (* D (* (/ D l) (* h (* (/ M d) (* w0 (/ M d)))))))
(if (<= M 5.9e+62)
w0
(* -0.125 (* D (* (/ D l) (/ (* h (* (/ M d) (* M w0))) d)))))))assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= -1.35e+269) {
tmp = -0.125 * (D * ((D / l) * (h * ((M / d) * (w0 * (M / d))))));
} else if (M <= 5.9e+62) {
tmp = w0;
} else {
tmp = -0.125 * (D * ((D / l) * ((h * ((M / d) * (M * w0))) / d)));
}
return tmp;
}
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.35d+269)) then
tmp = (-0.125d0) * (d * ((d / l) * (h * ((m / d_1) * (w0 * (m / d_1))))))
else if (m <= 5.9d+62) then
tmp = w0
else
tmp = (-0.125d0) * (d * ((d / l) * ((h * ((m / d_1) * (m * w0))) / d_1)))
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= -1.35e+269) {
tmp = -0.125 * (D * ((D / l) * (h * ((M / d) * (w0 * (M / d))))));
} else if (M <= 5.9e+62) {
tmp = w0;
} else {
tmp = -0.125 * (D * ((D / l) * ((h * ((M / d) * (M * w0))) / d)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= -1.35e+269: tmp = -0.125 * (D * ((D / l) * (h * ((M / d) * (w0 * (M / d)))))) elif M <= 5.9e+62: tmp = w0 else: tmp = -0.125 * (D * ((D / l) * ((h * ((M / d) * (M * w0))) / d))) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= -1.35e+269) tmp = Float64(-0.125 * Float64(D * Float64(Float64(D / l) * Float64(h * Float64(Float64(M / d) * Float64(w0 * Float64(M / d))))))); elseif (M <= 5.9e+62) tmp = w0; else tmp = Float64(-0.125 * Float64(D * Float64(Float64(D / l) * Float64(Float64(h * Float64(Float64(M / d) * Float64(M * w0))) / d)))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (M <= -1.35e+269)
tmp = -0.125 * (D * ((D / l) * (h * ((M / d) * (w0 * (M / d))))));
elseif (M <= 5.9e+62)
tmp = w0;
else
tmp = -0.125 * (D * ((D / l) * ((h * ((M / d) * (M * w0))) / d)));
end
tmp_2 = tmp;
end
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.35e+269], N[(-0.125 * N[(D * N[(N[(D / l), $MachinePrecision] * N[(h * N[(N[(M / d), $MachinePrecision] * N[(w0 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 5.9e+62], w0, N[(-0.125 * N[(D * N[(N[(D / l), $MachinePrecision] * N[(N[(h * N[(N[(M / d), $MachinePrecision] * N[(M * w0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -1.35 \cdot 10^{+269}:\\
\;\;\;\;-0.125 \cdot \left(D \cdot \left(\frac{D}{\ell} \cdot \left(h \cdot \left(\frac{M}{d} \cdot \left(w0 \cdot \frac{M}{d}\right)\right)\right)\right)\right)\\
\mathbf{elif}\;M \leq 5.9 \cdot 10^{+62}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(D \cdot \left(\frac{D}{\ell} \cdot \frac{h \cdot \left(\frac{M}{d} \cdot \left(M \cdot w0\right)\right)}{d}\right)\right)\\
\end{array}
\end{array}
if M < -1.3499999999999999e269Initial program 75.9%
*-commutative75.9%
times-frac75.9%
Simplified75.9%
Taylor expanded in M around 0 25.2%
*-commutative25.2%
unpow225.2%
unpow225.2%
unpow225.2%
Simplified25.2%
Taylor expanded in D around 0 25.2%
unpow225.2%
*-commutative25.2%
times-frac38.2%
unpow238.2%
times-frac38.2%
associate-*l/38.2%
associate-/r/38.2%
*-commutative38.2%
unpow238.2%
associate-/l*39.1%
associate-*l/39.9%
associate-/r/39.9%
*-commutative39.9%
*-commutative39.9%
associate-/l*39.9%
Simplified38.8%
Taylor expanded in D around inf 25.2%
*-commutative25.2%
times-frac38.2%
associate-*r*38.2%
unpow238.2%
times-frac38.2%
associate-*l/38.2%
unpow238.2%
associate-*l/38.2%
unpow238.2%
associate-/l*39.1%
associate-*l/39.6%
associate-/r/39.6%
*-commutative39.6%
associate-/l*39.6%
associate-/r/39.6%
Simplified40.8%
Taylor expanded in h around 0 38.8%
*-commutative38.8%
unpow238.8%
associate-*r*38.3%
times-frac39.1%
unpow239.1%
associate-/l*39.1%
times-frac40.4%
associate-*r*40.3%
*-commutative40.3%
associate-*r*40.8%
*-commutative40.8%
*-commutative40.8%
associate-*r/40.8%
times-frac40.8%
associate-/l*40.8%
associate-*r/40.8%
Simplified40.8%
if -1.3499999999999999e269 < M < 5.9000000000000003e62Initial program 83.9%
*-commutative83.9%
times-frac84.5%
Simplified84.5%
Taylor expanded in M around 0 78.7%
if 5.9000000000000003e62 < M Initial program 71.2%
*-commutative71.2%
times-frac69.3%
Simplified69.3%
Taylor expanded in M around 0 42.8%
*-commutative42.8%
unpow242.8%
unpow242.8%
unpow242.8%
Simplified42.8%
Taylor expanded in D around 0 42.8%
unpow242.8%
*-commutative42.8%
times-frac42.8%
unpow242.8%
times-frac45.1%
associate-*l/56.5%
associate-/r/56.5%
*-commutative56.5%
unpow256.5%
associate-/l*56.7%
associate-*l/56.7%
associate-/r/56.9%
*-commutative56.9%
*-commutative56.9%
associate-/l*56.7%
Simplified45.2%
Taylor expanded in D around inf 30.1%
*-commutative30.1%
times-frac32.0%
associate-*r*30.2%
unpow230.2%
times-frac30.3%
associate-*l/32.2%
unpow232.2%
associate-*l/32.6%
unpow232.6%
associate-/l*33.0%
associate-*l/33.1%
associate-/r/33.2%
*-commutative33.2%
associate-/l*33.0%
associate-/r/33.1%
Simplified33.7%
associate-*r/33.5%
div-inv33.5%
clear-num33.5%
Applied egg-rr33.5%
Final simplification68.2%
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 -1e+14) (* w0 (+ 1.0 (* -0.125 (* D (* (/ (* M (/ D l)) d) (/ M (/ d h))))))) (* w0 (+ 1.0 (* -0.125 (* D (* (* h (/ M d)) (/ (* M D) (* d l)))))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= -1e+14) {
tmp = w0 * (1.0 + (-0.125 * (D * (((M * (D / l)) / d) * (M / (d / h))))));
} else {
tmp = w0 * (1.0 + (-0.125 * (D * ((h * (M / d)) * ((M * D) / (d * l))))));
}
return tmp;
}
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 <= (-1d+14)) then
tmp = w0 * (1.0d0 + ((-0.125d0) * (d * (((m * (d / l)) / d_1) * (m / (d_1 / h))))))
else
tmp = w0 * (1.0d0 + ((-0.125d0) * (d * ((h * (m / d_1)) * ((m * d) / (d_1 * l))))))
end if
code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= -1e+14) {
tmp = w0 * (1.0 + (-0.125 * (D * (((M * (D / l)) / d) * (M / (d / h))))));
} else {
tmp = w0 * (1.0 + (-0.125 * (D * ((h * (M / d)) * ((M * D) / (d * l))))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= -1e+14: tmp = w0 * (1.0 + (-0.125 * (D * (((M * (D / l)) / d) * (M / (d / h)))))) else: tmp = w0 * (1.0 + (-0.125 * (D * ((h * (M / d)) * ((M * D) / (d * l)))))) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= -1e+14) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(D * Float64(Float64(Float64(M * Float64(D / l)) / d) * Float64(M / Float64(d / h))))))); else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(D * Float64(Float64(h * Float64(M / d)) * Float64(Float64(M * D) / Float64(d * l))))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (M <= -1e+14)
tmp = w0 * (1.0 + (-0.125 * (D * (((M * (D / l)) / d) * (M / (d / h))))));
else
tmp = w0 * (1.0 + (-0.125 * (D * ((h * (M / d)) * ((M * D) / (d * l))))));
end
tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, -1e+14], N[(w0 * N[(1.0 + N[(-0.125 * N[(D * N[(N[(N[(M * N[(D / l), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(M / N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[(1.0 + N[(-0.125 * N[(D * N[(N[(h * N[(M / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -1 \cdot 10^{+14}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(D \cdot \left(\frac{M \cdot \frac{D}{\ell}}{d} \cdot \frac{M}{\frac{d}{h}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(D \cdot \left(\left(h \cdot \frac{M}{d}\right) \cdot \frac{M \cdot D}{d \cdot \ell}\right)\right)\right)\\
\end{array}
\end{array}
if M < -1e14Initial program 74.0%
*-commutative74.0%
times-frac75.9%
Simplified75.9%
Taylor expanded in M around 0 37.2%
*-commutative37.2%
unpow237.2%
unpow237.2%
unpow237.2%
Simplified37.2%
Taylor expanded in D around 0 37.2%
unpow237.2%
*-commutative37.2%
times-frac42.9%
unpow242.9%
times-frac46.8%
associate-*l/54.5%
associate-/r/54.5%
*-commutative54.5%
unpow254.5%
associate-/l*60.6%
associate-*l/60.8%
associate-/r/61.1%
*-commutative61.1%
*-commutative61.1%
associate-/l*60.8%
Simplified51.0%
div-inv51.0%
associate-/l*66.4%
div-inv66.4%
clear-num66.4%
Applied egg-rr66.4%
pow166.4%
clear-num66.4%
associate-*l/70.7%
associate-/l*70.8%
Applied egg-rr70.8%
unpow170.8%
associate-/r/72.7%
Simplified72.7%
if -1e14 < M Initial program 82.8%
*-commutative82.8%
times-frac82.4%
Simplified82.4%
Taylor expanded in M around 0 55.9%
*-commutative55.9%
unpow255.9%
unpow255.9%
unpow255.9%
Simplified55.9%
Taylor expanded in D around 0 55.9%
unpow255.9%
*-commutative55.9%
times-frac56.3%
unpow256.3%
times-frac61.4%
associate-*l/64.9%
associate-/r/64.9%
*-commutative64.9%
unpow264.9%
associate-/l*66.9%
associate-*l/72.5%
associate-/r/78.0%
*-commutative78.0%
*-commutative78.0%
associate-/l*72.5%
Simplified65.0%
div-inv64.5%
associate-/l*70.5%
div-inv70.5%
clear-num70.5%
Applied egg-rr70.5%
Taylor expanded in M around 0 67.3%
*-commutative67.3%
*-commutative67.3%
times-frac62.9%
*-commutative62.9%
associate-/l*62.5%
unpow262.5%
unpow262.5%
associate-*r/64.5%
times-frac74.4%
associate-/r/73.9%
associate-/r/74.4%
associate-/l*73.8%
associate-/r/74.8%
*-commutative74.8%
associate-/r/77.8%
*-commutative77.8%
associate-*r/82.8%
*-commutative82.8%
associate-/l/82.3%
*-commutative82.3%
Simplified82.3%
Final simplification80.4%
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 (* (* h (/ M d)) (/ (* M D) (* d l))))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * (1.0 + (-0.125 * (D * ((h * (M / d)) * ((M * D) / (d * l))))));
}
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 * ((h * (m / d_1)) * ((m * d) / (d_1 * l))))))
end function
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 * ((h * (M / d)) * ((M * D) / (d * l))))));
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * (1.0 + (-0.125 * (D * ((h * (M / d)) * ((M * D) / (d * l))))))
M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(D * Float64(Float64(h * Float64(M / d)) * Float64(Float64(M * D) / Float64(d * l))))))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * (1.0 + (-0.125 * (D * ((h * (M / d)) * ((M * D) / (d * l))))));
end
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[(D * N[(N[(h * N[(M / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \left(1 + -0.125 \cdot \left(D \cdot \left(\left(h \cdot \frac{M}{d}\right) \cdot \frac{M \cdot D}{d \cdot \ell}\right)\right)\right)
\end{array}
Initial program 81.0%
*-commutative81.0%
times-frac81.1%
Simplified81.1%
Taylor expanded in M around 0 52.1%
*-commutative52.1%
unpow252.1%
unpow252.1%
unpow252.1%
Simplified52.1%
Taylor expanded in D around 0 52.1%
unpow252.1%
*-commutative52.1%
times-frac53.6%
unpow253.6%
times-frac58.4%
associate-*l/62.8%
associate-/r/62.8%
*-commutative62.8%
unpow262.8%
associate-/l*65.6%
associate-*l/70.1%
associate-/r/74.5%
*-commutative74.5%
*-commutative74.5%
associate-/l*70.1%
Simplified62.2%
div-inv61.8%
associate-/l*69.7%
div-inv69.7%
clear-num69.7%
Applied egg-rr69.7%
Taylor expanded in M around 0 62.1%
*-commutative62.1%
*-commutative62.1%
times-frac59.7%
*-commutative59.7%
associate-/l*60.2%
unpow260.2%
unpow260.2%
associate-*r/61.8%
times-frac72.8%
associate-/r/72.4%
associate-/r/73.7%
associate-/l*73.2%
associate-/r/74.4%
*-commutative74.4%
associate-/r/76.4%
*-commutative76.4%
associate-*r/79.6%
*-commutative79.6%
associate-/l/78.1%
*-commutative78.1%
Simplified78.1%
Final simplification78.1%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 w0)
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
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
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0
M, D = sort([M, D]) function code(w0, M, D, h, l, d) return w0 end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0;
end
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, D] = \mathsf{sort}([M, D])\\
\\
w0
\end{array}
Initial program 81.0%
*-commutative81.0%
times-frac81.1%
Simplified81.1%
Taylor expanded in M around 0 68.6%
Final simplification68.6%
herbie shell --seed 2023182
(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))))))