
(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
(let* ((t_0 (sqrt (- 1.0 (* (pow (/ (* D M) (* d 2.0)) 2.0) (/ h l))))))
(if (<= t_0 2e+139)
(* w0 t_0)
(* 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) {
double t_0 = sqrt((1.0 - (pow(((D * M) / (d * 2.0)), 2.0) * (h / l))));
double tmp;
if (t_0 <= 2e+139) {
tmp = w0 * t_0;
} else {
tmp = w0 * sqrt((1.0 - (h * (pow((M * (D * (0.5 / d))), 2.0) / 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 = sqrt((1.0d0 - ((((d * m) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l))))
if (t_0 <= 2d+139) then
tmp = w0 * t_0
else
tmp = w0 * sqrt((1.0d0 - (h * (((m * (d * (0.5d0 / d_1))) ** 2.0d0) / 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 = Math.sqrt((1.0 - (Math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l))));
double tmp;
if (t_0 <= 2e+139) {
tmp = w0 * t_0;
} else {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow((M * (D * (0.5 / d))), 2.0) / l))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): t_0 = math.sqrt((1.0 - (math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l)))) tmp = 0 if t_0 <= 2e+139: tmp = w0 * t_0 else: tmp = w0 * math.sqrt((1.0 - (h * (math.pow((M * (D * (0.5 / d))), 2.0) / l)))) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) t_0 = sqrt(Float64(1.0 - Float64((Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l)))) tmp = 0.0 if (t_0 <= 2e+139) tmp = Float64(w0 * t_0); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0) / l))))); end return tmp end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
t_0 = sqrt((1.0 - ((((D * M) / (d * 2.0)) ^ 2.0) * (h / l))));
tmp = 0.0;
if (t_0 <= 2e+139)
tmp = w0 * t_0;
else
tmp = w0 * sqrt((1.0 - (h * (((M * (D * (0.5 / d))) ^ 2.0) / 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[Sqrt[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]], $MachinePrecision]}, If[LessEqual[t$95$0, 2e+139], N[(w0 * t$95$0), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{1 - {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell}}\\
\mathbf{if}\;t_0 \leq 2 \cdot 10^{+139}:\\
\;\;\;\;w0 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}}\\
\end{array}
\end{array}
if (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)))) < 2.00000000000000007e139Initial program 99.9%
if 2.00000000000000007e139 < (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)))) Initial program 46.7%
associate-/l*49.0%
Simplified49.0%
associate-/l*46.7%
clear-num46.7%
un-div-inv49.2%
associate-*l/51.6%
*-commutative51.6%
associate-/r*51.6%
div-inv51.6%
metadata-eval51.6%
Applied egg-rr51.6%
associate-/r/70.1%
*-commutative70.1%
*-commutative70.1%
associate-*l/70.1%
associate-*l*69.3%
*-commutative69.3%
Simplified69.3%
Final simplification90.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 (sqrt (+ 1.0 (* (* h (pow (* D (/ (* M 0.5) d)) 2.0)) (/ -1.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((D * ((M * 0.5) / d)), 2.0)) * (-1.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 * ((d * ((m * 0.5d0) / d_1)) ** 2.0d0)) * ((-1.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((D * ((M * 0.5) / d)), 2.0)) * (-1.0 / l))));
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 + ((h * math.pow((D * ((M * 0.5) / d)), 2.0)) * (-1.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(D * Float64(Float64(M * 0.5) / d)) ^ 2.0)) * Float64(-1.0 / l))))) end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 + ((h * ((D * ((M * 0.5) / d)) ^ 2.0)) * (-1.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[(D * N[(N[(M * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 + \left(h \cdot {\left(D \cdot \frac{M \cdot 0.5}{d}\right)}^{2}\right) \cdot \frac{-1}{\ell}}
\end{array}
Initial program 83.3%
associate-/l*82.1%
Simplified82.1%
associate-*r/87.8%
associate-/l*88.7%
clear-num88.7%
*-commutative88.7%
associate-*l/89.1%
*-commutative89.1%
associate-/r*89.1%
div-inv89.1%
metadata-eval89.1%
Applied egg-rr89.1%
associate-/r/89.1%
Simplified89.1%
Final simplification89.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 (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(h * Float64((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[(h * N[(N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}}
\end{array}
Initial program 83.3%
associate-/l*82.1%
Simplified82.1%
associate-/l*83.3%
clear-num83.3%
un-div-inv84.0%
associate-*l/84.4%
*-commutative84.4%
associate-/r*84.4%
div-inv84.4%
metadata-eval84.4%
Applied egg-rr84.4%
associate-/r/88.7%
*-commutative88.7%
*-commutative88.7%
associate-*l/88.8%
associate-*l*87.0%
*-commutative87.0%
Simplified87.0%
Final simplification87.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 M) 1e-148)
w0
(if (<= (* D M) 2e+119)
(* w0 (+ 1.0 (* -0.125 (/ (* (* D M) (* D M)) (* d (* d (/ l h)))))))
(*
w0
(sqrt (+ 1.0 (* -0.25 (* (* (/ D l) (/ D (* d d))) (* h (* M M))))))))))assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((D * M) <= 1e-148) {
tmp = w0;
} else if ((D * M) <= 2e+119) {
tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h))))));
} else {
tmp = w0 * sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * M))))));
}
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 * m) <= 1d-148) then
tmp = w0
else if ((d * m) <= 2d+119) then
tmp = w0 * (1.0d0 + ((-0.125d0) * (((d * m) * (d * m)) / (d_1 * (d_1 * (l / h))))))
else
tmp = w0 * sqrt((1.0d0 + ((-0.25d0) * (((d / l) * (d / (d_1 * d_1))) * (h * (m * m))))))
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 * M) <= 1e-148) {
tmp = w0;
} else if ((D * M) <= 2e+119) {
tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h))))));
} else {
tmp = w0 * Math.sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * M))))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (D * M) <= 1e-148: tmp = w0 elif (D * M) <= 2e+119: tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h)))))) else: tmp = w0 * math.sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * M)))))) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(D * M) <= 1e-148) tmp = w0; elseif (Float64(D * M) <= 2e+119) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) / Float64(d * Float64(d * Float64(l / h))))))); else tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(-0.25 * Float64(Float64(Float64(D / l) * Float64(D / Float64(d * d))) * Float64(h * Float64(M * M))))))); 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 * M) <= 1e-148)
tmp = w0;
elseif ((D * M) <= 2e+119)
tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h))))));
else
tmp = w0 * sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * M))))));
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[(D * M), $MachinePrecision], 1e-148], w0, If[LessEqual[N[(D * M), $MachinePrecision], 2e+119], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 + N[(-0.25 * N[(N[(N[(D / l), $MachinePrecision] * N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \cdot M \leq 10^{-148}:\\
\;\;\;\;w0\\
\mathbf{elif}\;D \cdot M \leq 2 \cdot 10^{+119}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d \cdot \left(d \cdot \frac{\ell}{h}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \left(\left(\frac{D}{\ell} \cdot \frac{D}{d \cdot d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}\\
\end{array}
\end{array}
if (*.f64 M D) < 9.99999999999999936e-149Initial program 87.6%
associate-/l*85.4%
Simplified85.4%
Taylor expanded in M around 0 79.0%
if 9.99999999999999936e-149 < (*.f64 M D) < 1.99999999999999989e119Initial program 77.1%
associate-/l*75.1%
Simplified75.1%
Taylor expanded in M around 0 47.0%
*-commutative47.0%
associate-/l*49.0%
unpow249.0%
unpow249.0%
*-commutative49.0%
unpow249.0%
Simplified49.0%
Taylor expanded in D around 0 47.0%
associate-*r*51.0%
unpow251.0%
times-frac50.8%
unpow250.8%
unpow250.8%
swap-sqr69.7%
unpow269.7%
associate-*l/69.8%
associate-/l*69.8%
Simplified69.8%
unpow269.8%
*-commutative69.8%
*-commutative69.8%
Applied egg-rr69.8%
Taylor expanded in d around 0 72.0%
unpow272.0%
associate-*r/69.8%
associate-*l*69.9%
Simplified69.9%
if 1.99999999999999989e119 < (*.f64 M D) Initial program 68.9%
associate-/l*75.1%
Simplified75.1%
Taylor expanded in w0 around 0 39.9%
Simplified43.1%
Taylor expanded in D around 0 39.9%
unpow239.9%
*-commutative39.9%
unpow239.9%
*-commutative39.9%
associate-*l/43.1%
unpow243.1%
times-frac56.1%
Simplified56.1%
Final simplification74.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 1.1e-105)
(* w0 (sqrt (+ 1.0 (* -0.25 (/ (* D D) (* (/ l h) (* (/ d M) (/ d M))))))))
(if (<= d 1.35e+111)
(*
w0
(sqrt (+ 1.0 (* -0.25 (* (* (/ D l) (/ D (* d d))) (* h (* M M)))))))
w0)))assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 1.1e-105) {
tmp = w0 * sqrt((1.0 + (-0.25 * ((D * D) / ((l / h) * ((d / M) * (d / M)))))));
} else if (d <= 1.35e+111) {
tmp = w0 * sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * 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 <= 1.1d-105) then
tmp = w0 * sqrt((1.0d0 + ((-0.25d0) * ((d * d) / ((l / h) * ((d_1 / m) * (d_1 / m)))))))
else if (d_1 <= 1.35d+111) then
tmp = w0 * sqrt((1.0d0 + ((-0.25d0) * (((d / l) * (d / (d_1 * d_1))) * (h * (m * 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 <= 1.1e-105) {
tmp = w0 * Math.sqrt((1.0 + (-0.25 * ((D * D) / ((l / h) * ((d / M) * (d / M)))))));
} else if (d <= 1.35e+111) {
tmp = w0 * Math.sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * M))))));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if d <= 1.1e-105: tmp = w0 * math.sqrt((1.0 + (-0.25 * ((D * D) / ((l / h) * ((d / M) * (d / M))))))) elif d <= 1.35e+111: tmp = w0 * math.sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * M)))))) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (d <= 1.1e-105) tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(-0.25 * Float64(Float64(D * D) / Float64(Float64(l / h) * Float64(Float64(d / M) * Float64(d / M)))))))); elseif (d <= 1.35e+111) tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(-0.25 * Float64(Float64(Float64(D / l) * Float64(D / Float64(d * d))) * Float64(h * Float64(M * 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 <= 1.1e-105)
tmp = w0 * sqrt((1.0 + (-0.25 * ((D * D) / ((l / h) * ((d / M) * (d / M)))))));
elseif (d <= 1.35e+111)
tmp = w0 * sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * 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, 1.1e-105], N[(w0 * N[Sqrt[N[(1.0 + N[(-0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(l / h), $MachinePrecision] * N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.35e+111], N[(w0 * N[Sqrt[N[(1.0 + N[(-0.25 * N[(N[(N[(D / l), $MachinePrecision] * N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M * 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 1.1 \cdot 10^{-105}:\\
\;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \frac{D \cdot D}{\frac{\ell}{h} \cdot \left(\frac{d}{M} \cdot \frac{d}{M}\right)}}\\
\mathbf{elif}\;d \leq 1.35 \cdot 10^{+111}:\\
\;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \left(\left(\frac{D}{\ell} \cdot \frac{D}{d \cdot d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if d < 1.10000000000000002e-105Initial program 79.6%
associate-/l*78.4%
Simplified78.4%
Taylor expanded in w0 around 0 52.5%
Simplified53.7%
Taylor expanded in l around 0 53.7%
unpow253.7%
*-commutative53.7%
times-frac50.7%
unpow250.7%
times-frac63.1%
Simplified67.0%
if 1.10000000000000002e-105 < d < 1.3499999999999999e111Initial program 86.2%
associate-/l*83.8%
Simplified83.8%
Taylor expanded in w0 around 0 58.6%
Simplified57.2%
Taylor expanded in D around 0 58.6%
unpow258.6%
*-commutative58.6%
unpow258.6%
*-commutative58.6%
associate-*l/60.8%
unpow260.8%
times-frac72.6%
Simplified72.6%
if 1.3499999999999999e111 < d Initial program 93.6%
associate-/l*93.6%
Simplified93.6%
Taylor expanded in M around 0 91.9%
Final simplification72.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 (<= (* D M) 1e-148)
w0
(if (<= (* D M) 5e+154)
(* w0 (+ 1.0 (* -0.125 (/ (* (* D M) (* D M)) (* d (* d (/ l h)))))))
(* w0 (+ 1.0 (* (* (* (/ D l) (/ D (* d d))) (* h (* M M))) -0.125))))))assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((D * M) <= 1e-148) {
tmp = w0;
} else if ((D * M) <= 5e+154) {
tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h))))));
} else {
tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -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 * m) <= 1d-148) then
tmp = w0
else if ((d * m) <= 5d+154) then
tmp = w0 * (1.0d0 + ((-0.125d0) * (((d * m) * (d * m)) / (d_1 * (d_1 * (l / h))))))
else
tmp = w0 * (1.0d0 + ((((d / l) * (d / (d_1 * d_1))) * (h * (m * m))) * (-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 * M) <= 1e-148) {
tmp = w0;
} else if ((D * M) <= 5e+154) {
tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h))))));
} else {
tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -0.125));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (D * M) <= 1e-148: tmp = w0 elif (D * M) <= 5e+154: tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h)))))) else: tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -0.125)) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(D * M) <= 1e-148) tmp = w0; elseif (Float64(D * M) <= 5e+154) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) / Float64(d * Float64(d * Float64(l / h))))))); else tmp = Float64(w0 * Float64(1.0 + Float64(Float64(Float64(Float64(D / l) * Float64(D / Float64(d * d))) * Float64(h * Float64(M * M))) * -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 * M) <= 1e-148)
tmp = w0;
elseif ((D * M) <= 5e+154)
tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h))))));
else
tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -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[N[(D * M), $MachinePrecision], 1e-148], w0, If[LessEqual[N[(D * M), $MachinePrecision], 5e+154], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[(1.0 + N[(N[(N[(N[(D / l), $MachinePrecision] * N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \cdot M \leq 10^{-148}:\\
\;\;\;\;w0\\
\mathbf{elif}\;D \cdot M \leq 5 \cdot 10^{+154}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d \cdot \left(d \cdot \frac{\ell}{h}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + \left(\left(\frac{D}{\ell} \cdot \frac{D}{d \cdot d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right) \cdot -0.125\right)\\
\end{array}
\end{array}
if (*.f64 M D) < 9.99999999999999936e-149Initial program 87.6%
associate-/l*85.4%
Simplified85.4%
Taylor expanded in M around 0 79.0%
if 9.99999999999999936e-149 < (*.f64 M D) < 5.00000000000000004e154Initial program 75.6%
associate-/l*73.8%
Simplified73.8%
Taylor expanded in M around 0 44.7%
*-commutative44.7%
associate-/l*46.6%
unpow246.6%
unpow246.6%
*-commutative46.6%
unpow246.6%
Simplified46.6%
Taylor expanded in D around 0 44.7%
associate-*r*48.4%
unpow248.4%
times-frac48.3%
unpow248.3%
unpow248.3%
swap-sqr67.2%
unpow267.2%
associate-*l/67.3%
associate-/l*67.4%
Simplified67.4%
unpow267.4%
*-commutative67.4%
*-commutative67.4%
Applied egg-rr67.4%
Taylor expanded in d around 0 69.3%
unpow269.3%
associate-*r/67.4%
associate-*l*67.4%
Simplified67.4%
if 5.00000000000000004e154 < (*.f64 M D) Initial program 70.4%
associate-/l*77.8%
Simplified77.8%
associate-*r/78.0%
associate-/l*70.6%
clear-num70.6%
*-commutative70.6%
associate-*l/77.9%
*-commutative77.9%
associate-/r*77.9%
div-inv77.9%
metadata-eval77.9%
Applied egg-rr77.9%
associate-/r/77.9%
Simplified77.9%
Taylor expanded in l around inf 43.3%
*-commutative43.3%
associate-*r/43.3%
unpow243.3%
*-commutative43.3%
unpow243.3%
associate-*r/43.3%
*-commutative43.3%
unpow243.3%
unpow243.3%
associate-*l/47.1%
unpow247.1%
times-frac58.7%
Simplified58.7%
Final simplification74.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 (<= M 3.1e-111) w0 (* w0 (+ 1.0 (* (* (* (/ D l) (/ D (* d d))) (* h (* M M))) -0.125)))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 3.1e-111) {
tmp = w0;
} else {
tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -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 (m <= 3.1d-111) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((((d / l) * (d / (d_1 * d_1))) * (h * (m * m))) * (-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 (M <= 3.1e-111) {
tmp = w0;
} else {
tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -0.125));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= 3.1e-111: tmp = w0 else: tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -0.125)) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 3.1e-111) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(Float64(Float64(Float64(D / l) * Float64(D / Float64(d * d))) * Float64(h * Float64(M * M))) * -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 (M <= 3.1e-111)
tmp = w0;
else
tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -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[M, 3.1e-111], w0, N[(w0 * N[(1.0 + N[(N[(N[(N[(D / l), $MachinePrecision] * N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 3.1 \cdot 10^{-111}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + \left(\left(\frac{D}{\ell} \cdot \frac{D}{d \cdot d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right) \cdot -0.125\right)\\
\end{array}
\end{array}
if M < 3.10000000000000014e-111Initial program 84.9%
associate-/l*83.3%
Simplified83.3%
Taylor expanded in M around 0 71.9%
if 3.10000000000000014e-111 < M Initial program 79.7%
associate-/l*79.6%
Simplified79.6%
associate-*r/83.6%
associate-/l*84.3%
clear-num84.3%
*-commutative84.3%
associate-*l/83.1%
*-commutative83.1%
associate-/r*83.1%
div-inv83.1%
metadata-eval83.1%
Applied egg-rr83.1%
associate-/r/83.1%
Simplified83.1%
Taylor expanded in l around inf 55.1%
*-commutative55.1%
associate-*r/55.1%
unpow255.1%
*-commutative55.1%
unpow255.1%
associate-*r/55.1%
*-commutative55.1%
unpow255.1%
unpow255.1%
associate-*l/58.8%
unpow258.8%
times-frac62.6%
Simplified62.6%
Final simplification69.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 6.2e-62) (* w0 (+ 1.0 (* (/ (* D D) (* (/ l h) (* (/ d M) (/ d M)))) -0.125))) w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 6.2e-62) {
tmp = w0 * (1.0 + (((D * D) / ((l / h) * ((d / M) * (d / M)))) * -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 (d_1 <= 6.2d-62) then
tmp = w0 * (1.0d0 + (((d * d) / ((l / h) * ((d_1 / m) * (d_1 / m)))) * (-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 (d <= 6.2e-62) {
tmp = w0 * (1.0 + (((D * D) / ((l / h) * ((d / M) * (d / M)))) * -0.125));
} else {
tmp = w0;
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if d <= 6.2e-62: tmp = w0 * (1.0 + (((D * D) / ((l / h) * ((d / M) * (d / M)))) * -0.125)) else: tmp = w0 return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (d <= 6.2e-62) tmp = Float64(w0 * Float64(1.0 + Float64(Float64(Float64(D * D) / Float64(Float64(l / h) * Float64(Float64(d / M) * Float64(d / M)))) * -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 (d <= 6.2e-62)
tmp = w0 * (1.0 + (((D * D) / ((l / h) * ((d / M) * (d / M)))) * -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[d, 6.2e-62], N[(w0 * N[(1.0 + N[(N[(N[(D * D), $MachinePrecision] / N[(N[(l / h), $MachinePrecision] * N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 6.2 \cdot 10^{-62}:\\
\;\;\;\;w0 \cdot \left(1 + \frac{D \cdot D}{\frac{\ell}{h} \cdot \left(\frac{d}{M} \cdot \frac{d}{M}\right)} \cdot -0.125\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if d < 6.1999999999999999e-62Initial program 79.6%
associate-/l*77.9%
Simplified77.9%
Taylor expanded in M around 0 53.5%
*-commutative53.5%
associate-/l*54.6%
unpow254.6%
unpow254.6%
*-commutative54.6%
unpow254.6%
Simplified54.6%
Taylor expanded in l around 0 54.6%
unpow254.6%
*-commutative54.6%
times-frac51.8%
unpow251.8%
times-frac64.1%
Simplified64.1%
if 6.1999999999999999e-62 < d Initial program 91.3%
associate-/l*91.3%
Simplified91.3%
Taylor expanded in M around 0 84.7%
Final simplification70.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 (<= M 1.35e+40) w0 (* -0.125 (* (* D (/ D l)) (/ (* w0 (* h (* M M))) (* d d))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 1.35e+40) {
tmp = w0;
} else {
tmp = -0.125 * ((D * (D / l)) * ((w0 * (h * (M * M))) / (d * 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+40) then
tmp = w0
else
tmp = (-0.125d0) * ((d * (d / l)) * ((w0 * (h * (m * m))) / (d_1 * 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+40) {
tmp = w0;
} else {
tmp = -0.125 * ((D * (D / l)) * ((w0 * (h * (M * M))) / (d * d)));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= 1.35e+40: tmp = w0 else: tmp = -0.125 * ((D * (D / l)) * ((w0 * (h * (M * M))) / (d * d))) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 1.35e+40) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(D * Float64(D / l)) * Float64(Float64(w0 * Float64(h * Float64(M * M))) / Float64(d * 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+40)
tmp = w0;
else
tmp = -0.125 * ((D * (D / l)) * ((w0 * (h * (M * M))) / (d * 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+40], w0, N[(-0.125 * N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(w0 * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * 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^{+40}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \frac{w0 \cdot \left(h \cdot \left(M \cdot M\right)\right)}{d \cdot d}\right)\\
\end{array}
\end{array}
if M < 1.35000000000000005e40Initial program 84.4%
associate-/l*83.0%
Simplified83.0%
Taylor expanded in M around 0 72.8%
if 1.35000000000000005e40 < M Initial program 78.0%
associate-/l*77.9%
Simplified77.9%
Taylor expanded in M around 0 41.7%
*-commutative41.7%
associate-/l*45.9%
unpow245.9%
unpow245.9%
*-commutative45.9%
unpow245.9%
Simplified45.9%
Taylor expanded in D around 0 41.7%
associate-*r*46.3%
unpow246.3%
times-frac44.0%
unpow244.0%
unpow244.0%
swap-sqr53.5%
unpow253.5%
associate-*l/53.5%
associate-/l*53.5%
Simplified53.5%
Taylor expanded in D around inf 25.9%
associate-*r/25.9%
associate-*r*25.9%
*-commutative25.9%
associate-*r*25.9%
unpow225.9%
associate-*r/25.9%
*-commutative25.9%
times-frac25.8%
unpow225.8%
*-commutative25.8%
unpow225.8%
Simplified25.8%
Taylor expanded in D around 0 25.8%
unpow225.8%
associate-*l/28.3%
*-commutative28.3%
Simplified28.3%
Final simplification65.1%
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 7.5e+17) w0 (* -0.125 (* (/ (* D D) l) (* (/ w0 d) (/ (* h M) (/ d M)))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 7.5e+17) {
tmp = w0;
} else {
tmp = -0.125 * (((D * D) / l) * ((w0 / d) * ((h * M) / (d / M))));
}
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 <= 7.5d+17) then
tmp = w0
else
tmp = (-0.125d0) * (((d * d) / l) * ((w0 / d_1) * ((h * m) / (d_1 / m))))
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 <= 7.5e+17) {
tmp = w0;
} else {
tmp = -0.125 * (((D * D) / l) * ((w0 / d) * ((h * M) / (d / M))));
}
return tmp;
}
[M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= 7.5e+17: tmp = w0 else: tmp = -0.125 * (((D * D) / l) * ((w0 / d) * ((h * M) / (d / M)))) return tmp
M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 7.5e+17) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) / l) * Float64(Float64(w0 / d) * Float64(Float64(h * M) / Float64(d / M))))); 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 <= 7.5e+17)
tmp = w0;
else
tmp = -0.125 * (((D * D) / l) * ((w0 / d) * ((h * M) / (d / M))));
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, 7.5e+17], w0, N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision] * N[(N[(w0 / d), $MachinePrecision] * N[(N[(h * M), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 7.5 \cdot 10^{+17}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\ell} \cdot \left(\frac{w0}{d} \cdot \frac{h \cdot M}{\frac{d}{M}}\right)\right)\\
\end{array}
\end{array}
if M < 7.5e17Initial program 85.4%
associate-/l*84.0%
Simplified84.0%
Taylor expanded in M around 0 73.5%
if 7.5e17 < M Initial program 74.3%
associate-/l*74.2%
Simplified74.2%
Taylor expanded in M around 0 41.7%
*-commutative41.7%
associate-/l*47.6%
unpow247.6%
unpow247.6%
*-commutative47.6%
unpow247.6%
Simplified47.6%
Taylor expanded in D around 0 41.7%
associate-*r*45.8%
unpow245.8%
times-frac43.8%
unpow243.8%
unpow243.8%
swap-sqr52.3%
unpow252.3%
associate-*l/52.3%
associate-/l*52.3%
Simplified52.3%
Taylor expanded in D around inf 25.6%
associate-*r/25.6%
associate-*r*25.5%
*-commutative25.5%
associate-*r*25.6%
unpow225.6%
associate-*r/25.6%
*-commutative25.6%
times-frac25.6%
unpow225.6%
*-commutative25.6%
unpow225.6%
Simplified25.6%
Taylor expanded in w0 around 0 25.6%
unpow225.6%
unpow225.6%
associate-*l*25.8%
times-frac27.9%
associate-/l*27.9%
Simplified27.9%
Final simplification64.8%
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 83.3%
associate-/l*82.1%
Simplified82.1%
Taylor expanded in M around 0 68.2%
Final simplification68.2%
herbie shell --seed 2023258
(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))))))