
(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 11 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
(if (<= (/ h l) (- INFINITY))
(* w0 (sqrt (- 1.0 (* 0.25 (/ D (/ (/ (* (/ d M) (/ d M)) h) (/ D l)))))))
(if (<= (/ h l) -1e-206)
(* 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 * (D / ((((d / M) * (d / M)) / h) / (D / l))))));
} else if ((h / l) <= -1e-206) {
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 * (D / ((((d / M) * (d / M)) / h) / (D / l))))));
} else if ((h / l) <= -1e-206) {
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 * (D / ((((d / M) * (d / M)) / h) / (D / l)))))) elif (h / l) <= -1e-206: 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(0.25 * Float64(D / Float64(Float64(Float64(Float64(d / M) * Float64(d / M)) / h) / Float64(D / l))))))); elseif (Float64(h / l) <= -1e-206) 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 * (D / ((((d / M) * (d / M)) / h) / (D / l))))));
elseif ((h / l) <= -1e-206)
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[(0.25 * N[(D / N[(N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] / N[(D / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -1e-206], 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 - 0.25 \cdot \frac{D}{\frac{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}{\frac{D}{\ell}}}}\\
\mathbf{elif}\;\frac{h}{\ell} \leq -1 \cdot 10^{-206}:\\
\;\;\;\;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 39.1%
*-commutative39.1%
times-frac39.1%
Simplified39.1%
*-commutative39.1%
frac-times39.1%
*-commutative39.1%
associate-*l/84.0%
div-inv84.0%
associate-*l*83.9%
associate-/r*83.9%
metadata-eval83.9%
Applied egg-rr83.9%
Taylor expanded in h around 0 57.6%
unpow257.6%
associate-/l*57.6%
*-commutative57.6%
unpow257.6%
associate-/l*57.6%
associate-/r/57.6%
*-commutative57.6%
unpow257.6%
associate-/l/62.2%
associate-*l/66.9%
*-commutative66.9%
associate-/l*69.6%
Simplified70.7%
if -inf.0 < (/.f64 h l) < -1.00000000000000003e-206Initial program 86.5%
*-commutative86.5%
times-frac87.4%
Simplified87.4%
if -1.00000000000000003e-206 < (/.f64 h l) Initial program 86.0%
*-commutative86.0%
times-frac83.5%
Simplified83.5%
Taylor expanded in M around 0 96.0%
Final simplification90.1%
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) (* d 2.0)) 2.0) (/ h l)))))
(if (<= t_0 2e+160)
(* w0 (sqrt t_0))
(*
w0
(sqrt (- 1.0 (* 0.25 (/ D (/ (/ (* (/ d M) (/ d M)) 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) / (d * 2.0)), 2.0) * (h / l));
double tmp;
if (t_0 <= 2e+160) {
tmp = w0 * sqrt(t_0);
} else {
tmp = w0 * sqrt((1.0 - (0.25 * (D / ((((d / M) * (d / M)) / 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) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l))
if (t_0 <= 2d+160) then
tmp = w0 * sqrt(t_0)
else
tmp = w0 * sqrt((1.0d0 - (0.25d0 * (d / ((((d_1 / m) * (d_1 / m)) / h) / (d / 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) / (d * 2.0)), 2.0) * (h / l));
double tmp;
if (t_0 <= 2e+160) {
tmp = w0 * Math.sqrt(t_0);
} else {
tmp = w0 * Math.sqrt((1.0 - (0.25 * (D / ((((d / M) * (d / M)) / 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) / (d * 2.0)), 2.0) * (h / l)) tmp = 0 if t_0 <= 2e+160: tmp = w0 * math.sqrt(t_0) else: tmp = w0 * math.sqrt((1.0 - (0.25 * (D / ((((d / M) * (d / M)) / 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(d * 2.0)) ^ 2.0) * Float64(h / l))) tmp = 0.0 if (t_0 <= 2e+160) tmp = Float64(w0 * sqrt(t_0)); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(D / Float64(Float64(Float64(Float64(d / M) * Float64(d / M)) / h) / Float64(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) / (d * 2.0)) ^ 2.0) * (h / l));
tmp = 0.0;
if (t_0 <= 2e+160)
tmp = w0 * sqrt(t_0);
else
tmp = w0 * sqrt((1.0 - (0.25 * (D / ((((d / M) * (d / M)) / 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[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e+160], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(D / N[(N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] / N[(D / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t_0 \leq 2 \cdot 10^{+160}:\\
\;\;\;\;w0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \frac{D}{\frac{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}{\frac{D}{\ell}}}}\\
\end{array}
\end{array}
if (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) < 2.00000000000000001e160Initial program 99.4%
if 2.00000000000000001e160 < (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) Initial program 42.8%
*-commutative42.8%
times-frac44.1%
Simplified44.1%
*-commutative44.1%
frac-times42.8%
*-commutative42.8%
associate-*l/70.0%
div-inv70.0%
associate-*l*72.5%
associate-/r*72.5%
metadata-eval72.5%
Applied egg-rr72.5%
Taylor expanded in h around 0 52.7%
unpow252.7%
associate-/l*54.0%
*-commutative54.0%
unpow254.0%
associate-/l*52.7%
associate-/r/56.6%
*-commutative56.6%
unpow256.6%
associate-/l/55.2%
associate-*l/56.5%
*-commutative56.5%
associate-/l*61.3%
Simplified68.3%
Final simplification90.0%
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 (* M (* D (/ 0.5 d))) 2.0)) l)))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - ((h * pow((M * (D * (0.5 / d))), 2.0)) / 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 * sqrt((1.0d0 - ((h * ((m * (d * (0.5d0 / d_1))) ** 2.0d0)) / l)))
end function
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((M * (D * (0.5 / d))), 2.0)) / l)));
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - ((h * math.pow((M * (D * (0.5 / d))), 2.0)) / l)))
M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0)) / l)))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 - ((h * ((M * (D * (0.5 / d))) ^ 2.0)) / 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[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, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 - \frac{h \cdot {\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}}
\end{array}
Initial program 82.4%
*-commutative82.4%
times-frac81.6%
Simplified81.6%
*-commutative81.6%
frac-times82.4%
*-commutative82.4%
associate-*l/90.5%
div-inv90.5%
associate-*l*91.7%
associate-/r*91.7%
metadata-eval91.7%
Applied egg-rr91.7%
Final simplification91.7%
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 (* (/ d M) (/ d M))))
(if (<= D -2.15e-203)
(* w0 (sqrt (- 1.0 (* 0.25 (/ D (/ (/ t_0 h) (/ D l)))))))
(if (<= D 8e-116)
w0
(if (<= D 2.9e+136)
(* w0 (sqrt (- 1.0 (/ (* 0.25 (* (* D D) (/ h t_0))) l))))
(*
w0
(+ 1.0 (* (/ D (* l (/ (/ (pow (/ d M) 2.0) h) D))) -0.125))))))))assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (d / M) * (d / M);
double tmp;
if (D <= -2.15e-203) {
tmp = w0 * sqrt((1.0 - (0.25 * (D / ((t_0 / h) / (D / l))))));
} else if (D <= 8e-116) {
tmp = w0;
} else if (D <= 2.9e+136) {
tmp = w0 * sqrt((1.0 - ((0.25 * ((D * D) * (h / t_0))) / l)));
} else {
tmp = w0 * (1.0 + ((D / (l * ((pow((d / M), 2.0) / 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) :: t_0
real(8) :: tmp
t_0 = (d_1 / m) * (d_1 / m)
if (d <= (-2.15d-203)) then
tmp = w0 * sqrt((1.0d0 - (0.25d0 * (d / ((t_0 / h) / (d / l))))))
else if (d <= 8d-116) then
tmp = w0
else if (d <= 2.9d+136) then
tmp = w0 * sqrt((1.0d0 - ((0.25d0 * ((d * d) * (h / t_0))) / l)))
else
tmp = w0 * (1.0d0 + ((d / (l * ((((d_1 / m) ** 2.0d0) / 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 t_0 = (d / M) * (d / M);
double tmp;
if (D <= -2.15e-203) {
tmp = w0 * Math.sqrt((1.0 - (0.25 * (D / ((t_0 / h) / (D / l))))));
} else if (D <= 8e-116) {
tmp = w0;
} else if (D <= 2.9e+136) {
tmp = w0 * Math.sqrt((1.0 - ((0.25 * ((D * D) * (h / t_0))) / l)));
} else {
tmp = w0 * (1.0 + ((D / (l * ((Math.pow((d / M), 2.0) / h) / D))) * -0.125));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): t_0 = (d / M) * (d / M) tmp = 0 if D <= -2.15e-203: tmp = w0 * math.sqrt((1.0 - (0.25 * (D / ((t_0 / h) / (D / l)))))) elif D <= 8e-116: tmp = w0 elif D <= 2.9e+136: tmp = w0 * math.sqrt((1.0 - ((0.25 * ((D * D) * (h / t_0))) / l))) else: tmp = w0 * (1.0 + ((D / (l * ((math.pow((d / M), 2.0) / h) / D))) * -0.125)) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) t_0 = Float64(Float64(d / M) * Float64(d / M)) tmp = 0.0 if (D <= -2.15e-203) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(D / Float64(Float64(t_0 / h) / Float64(D / l))))))); elseif (D <= 8e-116) tmp = w0; elseif (D <= 2.9e+136) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.25 * Float64(Float64(D * D) * Float64(h / t_0))) / l)))); else tmp = Float64(w0 * Float64(1.0 + Float64(Float64(D / Float64(l * Float64(Float64((Float64(d / M) ^ 2.0) / h) / D))) * -0.125))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
t_0 = (d / M) * (d / M);
tmp = 0.0;
if (D <= -2.15e-203)
tmp = w0 * sqrt((1.0 - (0.25 * (D / ((t_0 / h) / (D / l))))));
elseif (D <= 8e-116)
tmp = w0;
elseif (D <= 2.9e+136)
tmp = w0 * sqrt((1.0 - ((0.25 * ((D * D) * (h / t_0))) / l)));
else
tmp = w0 * (1.0 + ((D / (l * ((((d / M) ^ 2.0) / 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_] := Block[{t$95$0 = N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, -2.15e-203], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(D / N[(N[(t$95$0 / h), $MachinePrecision] / N[(D / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 8e-116], w0, If[LessEqual[D, 2.9e+136], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.25 * N[(N[(D * D), $MachinePrecision] * N[(h / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[(1.0 + N[(N[(D / N[(l * N[(N[(N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision] / h), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{d}{M} \cdot \frac{d}{M}\\
\mathbf{if}\;D \leq -2.15 \cdot 10^{-203}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \frac{D}{\frac{\frac{t_0}{h}}{\frac{D}{\ell}}}}\\
\mathbf{elif}\;D \leq 8 \cdot 10^{-116}:\\
\;\;\;\;w0\\
\mathbf{elif}\;D \leq 2.9 \cdot 10^{+136}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \frac{h}{t_0}\right)}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + \frac{D}{\ell \cdot \frac{\frac{{\left(\frac{d}{M}\right)}^{2}}{h}}{D}} \cdot -0.125\right)\\
\end{array}
\end{array}
if D < -2.15000000000000014e-203Initial program 78.4%
*-commutative78.4%
times-frac80.4%
Simplified80.4%
*-commutative80.4%
frac-times78.4%
*-commutative78.4%
associate-*l/89.5%
div-inv89.4%
associate-*l*91.2%
associate-/r*91.2%
metadata-eval91.2%
Applied egg-rr91.2%
Taylor expanded in h around 0 65.7%
unpow265.7%
associate-/l*67.9%
*-commutative67.9%
unpow267.9%
associate-/l*67.8%
associate-/r/69.9%
*-commutative69.9%
unpow269.9%
associate-/l/66.8%
associate-*l/69.0%
*-commutative69.0%
associate-/l*75.8%
Simplified84.3%
if -2.15000000000000014e-203 < D < 8e-116Initial program 89.5%
*-commutative89.5%
times-frac82.9%
Simplified82.9%
Taylor expanded in M around 0 91.8%
if 8e-116 < D < 2.89999999999999974e136Initial program 79.5%
*-commutative79.5%
times-frac81.6%
Simplified81.6%
*-commutative81.6%
frac-times79.5%
*-commutative79.5%
associate-*l/89.6%
div-inv89.6%
associate-*l*91.7%
associate-/r*91.7%
metadata-eval91.7%
Applied egg-rr91.7%
Taylor expanded in h around 0 76.2%
unpow276.2%
associate-/l*78.1%
unpow278.1%
associate-/l*76.2%
*-commutative76.2%
associate-*l/78.0%
associate-*l/78.0%
unpow278.0%
*-commutative78.0%
unpow278.0%
associate-/r/76.7%
unpow276.7%
times-frac89.3%
Simplified89.3%
if 2.89999999999999974e136 < D Initial program 82.3%
*-commutative82.3%
times-frac82.3%
Simplified82.3%
Taylor expanded in M around 0 25.9%
*-commutative25.9%
*-commutative25.9%
times-frac25.9%
*-commutative25.9%
unpow225.9%
unpow225.9%
*-commutative25.9%
unpow225.9%
Simplified25.9%
Taylor expanded in D around 0 25.9%
*-commutative25.9%
unpow225.9%
times-frac25.9%
unpow225.9%
associate-/l*25.9%
associate-/r/25.9%
associate-/l*25.9%
*-commutative25.9%
associate-/r/25.9%
*-commutative25.9%
unpow225.9%
associate-/l/19.5%
associate-*r/38.2%
associate-/l*56.9%
Simplified63.4%
associate-/r/79.4%
pow279.4%
Applied egg-rr79.4%
Final simplification86.9%
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 -1.1e-202)
(* w0 (sqrt (- 1.0 (* 0.25 (/ D (/ (/ (* (/ d M) (/ d M)) h) (/ D l)))))))
(if (<= D 1.8e-115)
w0
(* w0 (+ 1.0 (* (/ D (* l (/ (/ (pow (/ d M) 2.0) 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 <= -1.1e-202) {
tmp = w0 * sqrt((1.0 - (0.25 * (D / ((((d / M) * (d / M)) / h) / (D / l))))));
} else if (D <= 1.8e-115) {
tmp = w0;
} else {
tmp = w0 * (1.0 + ((D / (l * ((pow((d / M), 2.0) / 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 <= (-1.1d-202)) then
tmp = w0 * sqrt((1.0d0 - (0.25d0 * (d / ((((d_1 / m) * (d_1 / m)) / h) / (d / l))))))
else if (d <= 1.8d-115) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((d / (l * ((((d_1 / m) ** 2.0d0) / 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 <= -1.1e-202) {
tmp = w0 * Math.sqrt((1.0 - (0.25 * (D / ((((d / M) * (d / M)) / h) / (D / l))))));
} else if (D <= 1.8e-115) {
tmp = w0;
} else {
tmp = w0 * (1.0 + ((D / (l * ((Math.pow((d / M), 2.0) / h) / D))) * -0.125));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if D <= -1.1e-202: tmp = w0 * math.sqrt((1.0 - (0.25 * (D / ((((d / M) * (d / M)) / h) / (D / l)))))) elif D <= 1.8e-115: tmp = w0 else: tmp = w0 * (1.0 + ((D / (l * ((math.pow((d / M), 2.0) / h) / D))) * -0.125)) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (D <= -1.1e-202) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(D / Float64(Float64(Float64(Float64(d / M) * Float64(d / M)) / h) / Float64(D / l))))))); elseif (D <= 1.8e-115) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(Float64(D / Float64(l * Float64(Float64((Float64(d / M) ^ 2.0) / h) / 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 <= -1.1e-202)
tmp = w0 * sqrt((1.0 - (0.25 * (D / ((((d / M) * (d / M)) / h) / (D / l))))));
elseif (D <= 1.8e-115)
tmp = w0;
else
tmp = w0 * (1.0 + ((D / (l * ((((d / M) ^ 2.0) / 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, -1.1e-202], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(D / N[(N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] / N[(D / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 1.8e-115], w0, N[(w0 * N[(1.0 + N[(N[(D / N[(l * N[(N[(N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision] / h), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq -1.1 \cdot 10^{-202}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \frac{D}{\frac{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}{\frac{D}{\ell}}}}\\
\mathbf{elif}\;D \leq 1.8 \cdot 10^{-115}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + \frac{D}{\ell \cdot \frac{\frac{{\left(\frac{d}{M}\right)}^{2}}{h}}{D}} \cdot -0.125\right)\\
\end{array}
\end{array}
if D < -1.10000000000000004e-202Initial program 78.4%
*-commutative78.4%
times-frac80.4%
Simplified80.4%
*-commutative80.4%
frac-times78.4%
*-commutative78.4%
associate-*l/89.5%
div-inv89.4%
associate-*l*91.2%
associate-/r*91.2%
metadata-eval91.2%
Applied egg-rr91.2%
Taylor expanded in h around 0 65.7%
unpow265.7%
associate-/l*67.9%
*-commutative67.9%
unpow267.9%
associate-/l*67.8%
associate-/r/69.9%
*-commutative69.9%
unpow269.9%
associate-/l/66.8%
associate-*l/69.0%
*-commutative69.0%
associate-/l*75.8%
Simplified84.3%
if -1.10000000000000004e-202 < D < 1.80000000000000005e-115Initial program 89.5%
*-commutative89.5%
times-frac82.9%
Simplified82.9%
Taylor expanded in M around 0 91.8%
if 1.80000000000000005e-115 < D Initial program 80.5%
*-commutative80.5%
times-frac81.8%
Simplified81.8%
Taylor expanded in M around 0 51.5%
*-commutative51.5%
*-commutative51.5%
times-frac53.8%
*-commutative53.8%
unpow253.8%
unpow253.8%
*-commutative53.8%
unpow253.8%
Simplified53.8%
Taylor expanded in D around 0 51.5%
*-commutative51.5%
unpow251.5%
times-frac53.8%
unpow253.8%
associate-/l*50.2%
associate-/r/52.6%
associate-/l*56.3%
*-commutative56.3%
associate-/r/56.3%
*-commutative56.3%
unpow256.3%
associate-/l/46.7%
associate-*r/53.8%
associate-/l*64.4%
Simplified69.6%
associate-/r/79.1%
pow279.1%
Applied egg-rr79.1%
Final simplification84.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 (<= w0 -6.6e+56)
(* w0 (+ 1.0 (* (/ D (/ (/ (* (/ d M) (/ d M)) h) (/ D l))) -0.125)))
(if (<= w0 1.05e-57)
w0
(* w0 (+ 1.0 (* -0.125 (* (/ D l) (/ D (/ (pow (/ d M) 2.0) h)))))))))assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (w0 <= -6.6e+56) {
tmp = w0 * (1.0 + ((D / ((((d / M) * (d / M)) / h) / (D / l))) * -0.125));
} else if (w0 <= 1.05e-57) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * ((D / l) * (D / (pow((d / M), 2.0) / h)))));
}
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 (w0 <= (-6.6d+56)) then
tmp = w0 * (1.0d0 + ((d / ((((d_1 / m) * (d_1 / m)) / h) / (d / l))) * (-0.125d0)))
else if (w0 <= 1.05d-57) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((-0.125d0) * ((d / l) * (d / (((d_1 / m) ** 2.0d0) / h)))))
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 (w0 <= -6.6e+56) {
tmp = w0 * (1.0 + ((D / ((((d / M) * (d / M)) / h) / (D / l))) * -0.125));
} else if (w0 <= 1.05e-57) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * ((D / l) * (D / (Math.pow((d / M), 2.0) / h)))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if w0 <= -6.6e+56: tmp = w0 * (1.0 + ((D / ((((d / M) * (d / M)) / h) / (D / l))) * -0.125)) elif w0 <= 1.05e-57: tmp = w0 else: tmp = w0 * (1.0 + (-0.125 * ((D / l) * (D / (math.pow((d / M), 2.0) / h))))) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (w0 <= -6.6e+56) tmp = Float64(w0 * Float64(1.0 + Float64(Float64(D / Float64(Float64(Float64(Float64(d / M) * Float64(d / M)) / h) / Float64(D / l))) * -0.125))); elseif (w0 <= 1.05e-57) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(D / l) * Float64(D / Float64((Float64(d / M) ^ 2.0) / h)))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (w0 <= -6.6e+56)
tmp = w0 * (1.0 + ((D / ((((d / M) * (d / M)) / h) / (D / l))) * -0.125));
elseif (w0 <= 1.05e-57)
tmp = w0;
else
tmp = w0 * (1.0 + (-0.125 * ((D / l) * (D / (((d / M) ^ 2.0) / h)))));
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[w0, -6.6e+56], N[(w0 * N[(1.0 + N[(N[(D / N[(N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] / N[(D / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w0, 1.05e-57], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(D / l), $MachinePrecision] * N[(D / N[(N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;w0 \leq -6.6 \cdot 10^{+56}:\\
\;\;\;\;w0 \cdot \left(1 + \frac{D}{\frac{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}{\frac{D}{\ell}}} \cdot -0.125\right)\\
\mathbf{elif}\;w0 \leq 1.05 \cdot 10^{-57}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\frac{D}{\ell} \cdot \frac{D}{\frac{{\left(\frac{d}{M}\right)}^{2}}{h}}\right)\right)\\
\end{array}
\end{array}
if w0 < -6.60000000000000004e56Initial program 89.3%
*-commutative89.3%
times-frac87.5%
Simplified87.5%
Taylor expanded in M around 0 71.4%
*-commutative71.4%
*-commutative71.4%
times-frac71.4%
*-commutative71.4%
unpow271.4%
unpow271.4%
*-commutative71.4%
unpow271.4%
Simplified71.4%
Taylor expanded in D around 0 71.4%
*-commutative71.4%
unpow271.4%
times-frac71.4%
unpow271.4%
associate-/l*66.1%
associate-/r/67.9%
associate-/l*73.2%
*-commutative73.2%
associate-/r/73.2%
*-commutative73.2%
unpow273.2%
associate-/l/67.9%
associate-*r/69.6%
associate-/l*76.9%
Simplified80.7%
if -6.60000000000000004e56 < w0 < 1.05e-57Initial program 79.4%
*-commutative79.4%
times-frac79.4%
Simplified79.4%
Taylor expanded in M around 0 79.5%
if 1.05e-57 < w0 Initial program 82.1%
*-commutative82.1%
times-frac80.8%
Simplified80.8%
Taylor expanded in M around 0 56.5%
*-commutative56.5%
*-commutative56.5%
times-frac56.2%
*-commutative56.2%
unpow256.2%
unpow256.2%
*-commutative56.2%
unpow256.2%
Simplified56.2%
Taylor expanded in D around 0 56.5%
*-commutative56.5%
unpow256.5%
times-frac56.2%
unpow256.2%
associate-/l*52.6%
associate-/r/54.0%
associate-/l*57.5%
*-commutative57.5%
associate-/r/58.8%
*-commutative58.8%
unpow258.8%
associate-/l/54.8%
associate-*r/61.2%
associate-/l*64.0%
Simplified78.4%
associate-/r/78.4%
pow278.4%
Applied egg-rr78.4%
Final simplification79.4%
NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= l 1e+138) (* w0 (+ 1.0 (* (/ D (* l (/ (/ (pow (/ d M) 2.0) h) D))) -0.125))) w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (l <= 1e+138) {
tmp = w0 * (1.0 + ((D / (l * ((pow((d / M), 2.0) / h) / D))) * -0.125));
} 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 (l <= 1d+138) then
tmp = w0 * (1.0d0 + ((d / (l * ((((d_1 / m) ** 2.0d0) / h) / d))) * (-0.125d0)))
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 (l <= 1e+138) {
tmp = w0 * (1.0 + ((D / (l * ((Math.pow((d / M), 2.0) / h) / D))) * -0.125));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if l <= 1e+138: tmp = w0 * (1.0 + ((D / (l * ((math.pow((d / M), 2.0) / h) / D))) * -0.125)) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (l <= 1e+138) tmp = Float64(w0 * Float64(1.0 + Float64(Float64(D / Float64(l * Float64(Float64((Float64(d / M) ^ 2.0) / h) / D))) * -0.125))); 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 (l <= 1e+138)
tmp = w0 * (1.0 + ((D / (l * ((((d / M) ^ 2.0) / h) / D))) * -0.125));
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[l, 1e+138], N[(w0 * N[(1.0 + N[(N[(D / N[(l * N[(N[(N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision] / h), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 10^{+138}:\\
\;\;\;\;w0 \cdot \left(1 + \frac{D}{\ell \cdot \frac{\frac{{\left(\frac{d}{M}\right)}^{2}}{h}}{D}} \cdot -0.125\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if l < 1e138Initial program 82.2%
*-commutative82.2%
times-frac82.2%
Simplified82.2%
Taylor expanded in M around 0 56.4%
*-commutative56.4%
*-commutative56.4%
times-frac58.6%
*-commutative58.6%
unpow258.6%
unpow258.6%
*-commutative58.6%
unpow258.6%
Simplified58.6%
Taylor expanded in D around 0 56.4%
*-commutative56.4%
unpow256.4%
times-frac58.6%
unpow258.6%
associate-/l*54.1%
associate-/r/54.7%
associate-/l*59.1%
*-commutative59.1%
associate-/r/60.0%
*-commutative60.0%
unpow260.0%
associate-/l/55.5%
associate-*r/57.7%
associate-/l*64.5%
Simplified75.2%
associate-/r/80.4%
pow280.4%
Applied egg-rr80.4%
if 1e138 < l Initial program 83.5%
*-commutative83.5%
times-frac78.0%
Simplified78.0%
Taylor expanded in M around 0 85.9%
Final simplification81.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 (or (<= w0 -6.2e+57) (not (<= w0 1.06e-57))) (* w0 (+ 1.0 (* (/ D (/ (/ (* (/ d M) (/ d M)) h) (/ D l))) -0.125))) w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((w0 <= -6.2e+57) || !(w0 <= 1.06e-57)) {
tmp = w0 * (1.0 + ((D / ((((d / M) * (d / M)) / h) / (D / l))) * -0.125));
} 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 ((w0 <= (-6.2d+57)) .or. (.not. (w0 <= 1.06d-57))) then
tmp = w0 * (1.0d0 + ((d / ((((d_1 / m) * (d_1 / m)) / h) / (d / l))) * (-0.125d0)))
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 ((w0 <= -6.2e+57) || !(w0 <= 1.06e-57)) {
tmp = w0 * (1.0 + ((D / ((((d / M) * (d / M)) / h) / (D / l))) * -0.125));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (w0 <= -6.2e+57) or not (w0 <= 1.06e-57): tmp = w0 * (1.0 + ((D / ((((d / M) * (d / M)) / h) / (D / l))) * -0.125)) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if ((w0 <= -6.2e+57) || !(w0 <= 1.06e-57)) tmp = Float64(w0 * Float64(1.0 + Float64(Float64(D / Float64(Float64(Float64(Float64(d / M) * Float64(d / M)) / h) / Float64(D / l))) * -0.125))); 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 ((w0 <= -6.2e+57) || ~((w0 <= 1.06e-57)))
tmp = w0 * (1.0 + ((D / ((((d / M) * (d / M)) / h) / (D / l))) * -0.125));
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[w0, -6.2e+57], N[Not[LessEqual[w0, 1.06e-57]], $MachinePrecision]], N[(w0 * N[(1.0 + N[(N[(D / N[(N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] / N[(D / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;w0 \leq -6.2 \cdot 10^{+57} \lor \neg \left(w0 \leq 1.06 \cdot 10^{-57}\right):\\
\;\;\;\;w0 \cdot \left(1 + \frac{D}{\frac{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}{\frac{D}{\ell}}} \cdot -0.125\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if w0 < -6.20000000000000026e57 or 1.0600000000000001e-57 < w0 Initial program 85.1%
*-commutative85.1%
times-frac83.6%
Simplified83.6%
Taylor expanded in M around 0 62.8%
*-commutative62.8%
*-commutative62.8%
times-frac62.6%
*-commutative62.6%
unpow262.6%
unpow262.6%
*-commutative62.6%
unpow262.6%
Simplified62.6%
Taylor expanded in D around 0 62.8%
*-commutative62.8%
unpow262.8%
times-frac62.6%
unpow262.6%
associate-/l*58.3%
associate-/r/59.8%
associate-/l*64.1%
*-commutative64.1%
associate-/r/64.9%
*-commutative64.9%
unpow264.9%
associate-/l/60.3%
associate-*r/64.8%
associate-/l*69.4%
Simplified79.4%
if -6.20000000000000026e57 < w0 < 1.0600000000000001e-57Initial program 79.4%
*-commutative79.4%
times-frac79.4%
Simplified79.4%
Taylor expanded in M around 0 79.5%
Final simplification79.4%
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 -2.1e-67)
w0
(if (<= d 1.35e-96)
(* w0 (+ 1.0 (* -0.125 (* (* (/ D d) (/ D d)) (* h (/ M (/ l M)))))))
w0)))assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= -2.1e-67) {
tmp = w0;
} else if (d <= 1.35e-96) {
tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) * (h * (M / (l / M))))));
} 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 (d_1 <= (-2.1d-67)) then
tmp = w0
else if (d_1 <= 1.35d-96) then
tmp = w0 * (1.0d0 + ((-0.125d0) * (((d / d_1) * (d / d_1)) * (h * (m / (l / m))))))
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 (d <= -2.1e-67) {
tmp = w0;
} else if (d <= 1.35e-96) {
tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) * (h * (M / (l / M))))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if d <= -2.1e-67: tmp = w0 elif d <= 1.35e-96: tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) * (h * (M / (l / M)))))) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (d <= -2.1e-67) tmp = w0; elseif (d <= 1.35e-96) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(h * Float64(M / Float64(l / M))))))); 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 (d <= -2.1e-67)
tmp = w0;
elseif (d <= 1.35e-96)
tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) * (h * (M / (l / M))))));
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[d, -2.1e-67], w0, If[LessEqual[d, 1.35e-96], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.1 \cdot 10^{-67}:\\
\;\;\;\;w0\\
\mathbf{elif}\;d \leq 1.35 \cdot 10^{-96}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \frac{M}{\frac{\ell}{M}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if d < -2.1000000000000002e-67 or 1.35e-96 < d Initial program 83.8%
*-commutative83.8%
times-frac83.8%
Simplified83.8%
Taylor expanded in M around 0 85.0%
if -2.1000000000000002e-67 < d < 1.35e-96Initial program 78.9%
*-commutative78.9%
times-frac76.2%
Simplified76.2%
Taylor expanded in M around 0 39.9%
*-commutative39.9%
*-commutative39.9%
times-frac46.7%
*-commutative46.7%
unpow246.7%
unpow246.7%
*-commutative46.7%
unpow246.7%
Simplified46.7%
Taylor expanded in M around 0 46.7%
unpow246.7%
associate-*l/46.7%
*-commutative46.7%
associate-/l*49.5%
Simplified49.5%
times-frac75.4%
Applied egg-rr75.4%
Final simplification82.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 -2.55e+269) (* -0.125 (* h (/ w0 (/ (* (/ d M) (/ d M)) (/ D (/ l D)))))) w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= -2.55e+269) {
tmp = -0.125 * (h * (w0 / (((d / M) * (d / M)) / (D / (l / 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.55d+269)) then
tmp = (-0.125d0) * (h * (w0 / (((d_1 / m) * (d_1 / m)) / (d / (l / d)))))
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.55e+269) {
tmp = -0.125 * (h * (w0 / (((d / M) * (d / M)) / (D / (l / D)))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= -2.55e+269: tmp = -0.125 * (h * (w0 / (((d / M) * (d / M)) / (D / (l / 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.55e+269) tmp = Float64(-0.125 * Float64(h * Float64(w0 / Float64(Float64(Float64(d / M) * Float64(d / M)) / Float64(D / Float64(l / 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.55e+269)
tmp = -0.125 * (h * (w0 / (((d / M) * (d / M)) / (D / (l / 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[M, -2.55e+269], N[(-0.125 * N[(h * N[(w0 / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -2.55 \cdot 10^{+269}:\\
\;\;\;\;-0.125 \cdot \left(h \cdot \frac{w0}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{\frac{D}{\frac{\ell}{D}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if M < -2.55000000000000006e269Initial program 100.0%
*-commutative100.0%
times-frac100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
+-commutative100.0%
associate-*r/100.0%
*-commutative100.0%
associate-*r/100.0%
*-commutative100.0%
fma-def100.0%
times-frac100.0%
unpow2100.0%
associate-/l*100.0%
associate-/l*100.0%
unpow2100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in D around inf 100.0%
associate-*r/100.0%
unpow2100.0%
*-commutative100.0%
unpow2100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/r*100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
times-frac100.0%
*-commutative100.0%
unpow2100.0%
associate-*r*100.0%
associate-/l*100.0%
unpow2100.0%
unpow2100.0%
times-frac100.0%
unpow2100.0%
associate-*l/100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
pow2100.0%
Applied egg-rr100.0%
if -2.55000000000000006e269 < M Initial program 82.3%
*-commutative82.3%
times-frac81.5%
Simplified81.5%
Taylor expanded in M around 0 75.4%
Final simplification75.5%
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 82.4%
*-commutative82.4%
times-frac81.6%
Simplified81.6%
Taylor expanded in M around 0 75.2%
Final simplification75.2%
herbie shell --seed 2023178
(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))))))