
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
code = c0 * sqrt((a / (v * l)))
end function
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
function tmp = code(c0, A, V, l) tmp = c0 * sqrt((A / (V * l))); end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
code = c0 * sqrt((a / (v * l)))
end function
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
function tmp = code(c0, A, V, l) tmp = c0 * sqrt((A / (V * l))); end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) (- INFINITY))
(* (sqrt (/ A V)) (* (pow l -0.5) c0))
(if (<= (* V l) -5e-317)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 5e-317)
(* c0 (/ 1.0 (sqrt (/ V (/ A l)))))
(/ c0 (/ (sqrt (* V l)) (sqrt A)))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = sqrt((A / V)) * (pow(l, -0.5) * c0);
} else if ((V * l) <= -5e-317) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 5e-317) {
tmp = c0 * (1.0 / sqrt((V / (A / l))));
} else {
tmp = c0 / (sqrt((V * l)) / sqrt(A));
}
return tmp;
}
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = Math.sqrt((A / V)) * (Math.pow(l, -0.5) * c0);
} else if ((V * l) <= -5e-317) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 5e-317) {
tmp = c0 * (1.0 / Math.sqrt((V / (A / l))));
} else {
tmp = c0 / (Math.sqrt((V * l)) / Math.sqrt(A));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -math.inf: tmp = math.sqrt((A / V)) * (math.pow(l, -0.5) * c0) elif (V * l) <= -5e-317: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 5e-317: tmp = c0 * (1.0 / math.sqrt((V / (A / l)))) else: tmp = c0 / (math.sqrt((V * l)) / math.sqrt(A)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(sqrt(Float64(A / V)) * Float64((l ^ -0.5) * c0)); elseif (Float64(V * l) <= -5e-317) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 5e-317) tmp = Float64(c0 * Float64(1.0 / sqrt(Float64(V / Float64(A / l))))); else tmp = Float64(c0 / Float64(sqrt(Float64(V * l)) / sqrt(A))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if ((V * l) <= -Inf)
tmp = sqrt((A / V)) * ((l ^ -0.5) * c0);
elseif ((V * l) <= -5e-317)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 5e-317)
tmp = c0 * (1.0 / sqrt((V / (A / l))));
else
tmp = c0 / (sqrt((V * l)) / sqrt(A));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(N[Power[l, -0.5], $MachinePrecision] * c0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-317], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-317], N[(c0 * N[(1.0 / N[Sqrt[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[(N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;\sqrt{\frac{A}{V}} \cdot \left({\ell}^{-0.5} \cdot c0\right)\\
\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-317}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-317}:\\
\;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 19.0%
sqrt-div0.0%
associate-*r/0.0%
Applied egg-rr0.0%
associate-/l*0.0%
Simplified0.0%
div-inv0.0%
clear-num0.0%
*-rgt-identity0.0%
sqrt-div19.0%
frac-times69.5%
*-commutative69.5%
sqrt-prod61.4%
associate-*l*61.6%
inv-pow61.6%
sqrt-pow161.6%
metadata-eval61.6%
Applied egg-rr61.6%
if -inf.0 < (*.f64 V l) < -5.00000017e-317Initial program 88.5%
frac-2neg88.5%
sqrt-div98.9%
*-commutative98.9%
distribute-rgt-neg-in98.9%
Applied egg-rr98.9%
if -5.00000017e-317 < (*.f64 V l) < 5.00000017e-317Initial program 48.4%
clear-num48.4%
sqrt-div48.4%
metadata-eval48.4%
associate-/l*63.6%
Applied egg-rr63.6%
if 5.00000017e-317 < (*.f64 V l) Initial program 82.8%
sqrt-div91.9%
associate-*r/89.6%
Applied egg-rr89.6%
associate-/l*91.8%
Simplified91.8%
Final simplification90.1%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) -5e+204)
(* c0 (/ (sqrt (/ A V)) (sqrt l)))
(if (<= (* V l) 1e+104)
(* c0 (pow (/ (* V l) A) -0.5))
(* c0 (sqrt (/ (/ A l) V))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -5e+204) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else if ((V * l) <= 1e+104) {
tmp = c0 * pow(((V * l) / A), -0.5);
} else {
tmp = c0 * sqrt(((A / l) / V));
}
return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: tmp
if ((v * l) <= (-5d+204)) then
tmp = c0 * (sqrt((a / v)) / sqrt(l))
else if ((v * l) <= 1d+104) then
tmp = c0 * (((v * l) / a) ** (-0.5d0))
else
tmp = c0 * sqrt(((a / l) / v))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -5e+204) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else if ((V * l) <= 1e+104) {
tmp = c0 * Math.pow(((V * l) / A), -0.5);
} else {
tmp = c0 * Math.sqrt(((A / l) / V));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -5e+204: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) elif (V * l) <= 1e+104: tmp = c0 * math.pow(((V * l) / A), -0.5) else: tmp = c0 * math.sqrt(((A / l) / V)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= -5e+204) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); elseif (Float64(V * l) <= 1e+104) tmp = Float64(c0 * (Float64(Float64(V * l) / A) ^ -0.5)); else tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if ((V * l) <= -5e+204)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
elseif ((V * l) <= 1e+104)
tmp = c0 * (((V * l) / A) ^ -0.5);
else
tmp = c0 * sqrt(((A / l) / V));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], -5e+204], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+104], N[(c0 * N[Power[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+204}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+104}:\\
\;\;\;\;c0 \cdot {\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\end{array}
\end{array}
if (*.f64 V l) < -5.00000000000000008e204Initial program 47.7%
associate-/r*68.8%
sqrt-div49.5%
Applied egg-rr49.5%
if -5.00000000000000008e204 < (*.f64 V l) < 1e104Initial program 85.7%
pow1/285.7%
clear-num85.7%
inv-pow85.7%
pow-pow87.1%
associate-/l*80.4%
metadata-eval80.4%
Applied egg-rr80.4%
associate-/l*87.1%
Simplified87.1%
if 1e104 < (*.f64 V l) Initial program 71.0%
associate-/r*78.6%
div-inv78.7%
Applied egg-rr78.7%
associate-*l/78.6%
div-inv78.6%
Applied egg-rr78.6%
Final simplification80.9%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= A -2e-310) (* c0 (/ (sqrt (/ A V)) (sqrt l))) (* (sqrt A) (/ c0 (sqrt (* V l))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (A <= -2e-310) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else {
tmp = sqrt(A) * (c0 / sqrt((V * l)));
}
return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: tmp
if (a <= (-2d-310)) then
tmp = c0 * (sqrt((a / v)) / sqrt(l))
else
tmp = sqrt(a) * (c0 / sqrt((v * l)))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if (A <= -2e-310) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else {
tmp = Math.sqrt(A) * (c0 / Math.sqrt((V * l)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if A <= -2e-310: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) else: tmp = math.sqrt(A) * (c0 / math.sqrt((V * l))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (A <= -2e-310) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); else tmp = Float64(sqrt(A) * Float64(c0 / sqrt(Float64(V * l)))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (A <= -2e-310)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
else
tmp = sqrt(A) * (c0 / sqrt((V * l)));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[A, -2e-310], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[A], $MachinePrecision] * N[(c0 / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq -2 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{A} \cdot \frac{c0}{\sqrt{V \cdot \ell}}\\
\end{array}
\end{array}
if A < -1.999999999999994e-310Initial program 78.4%
associate-/r*77.4%
sqrt-div45.0%
Applied egg-rr45.0%
if -1.999999999999994e-310 < A Initial program 78.1%
sqrt-div86.0%
associate-*r/84.0%
Applied egg-rr84.0%
associate-*l/83.2%
Simplified83.2%
Final simplification66.5%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= A -2e-310) (* c0 (/ (sqrt (/ A V)) (sqrt l))) (/ c0 (/ (sqrt (* V l)) (sqrt A)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (A <= -2e-310) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else {
tmp = c0 / (sqrt((V * l)) / sqrt(A));
}
return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: tmp
if (a <= (-2d-310)) then
tmp = c0 * (sqrt((a / v)) / sqrt(l))
else
tmp = c0 / (sqrt((v * l)) / sqrt(a))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if (A <= -2e-310) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else {
tmp = c0 / (Math.sqrt((V * l)) / Math.sqrt(A));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if A <= -2e-310: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) else: tmp = c0 / (math.sqrt((V * l)) / math.sqrt(A)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (A <= -2e-310) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); else tmp = Float64(c0 / Float64(sqrt(Float64(V * l)) / sqrt(A))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (A <= -2e-310)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
else
tmp = c0 / (sqrt((V * l)) / sqrt(A));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[A, -2e-310], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[(N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq -2 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\
\end{array}
\end{array}
if A < -1.999999999999994e-310Initial program 78.4%
associate-/r*77.4%
sqrt-div45.0%
Applied egg-rr45.0%
if -1.999999999999994e-310 < A Initial program 78.1%
sqrt-div86.0%
associate-*r/84.0%
Applied egg-rr84.0%
associate-/l*86.0%
Simplified86.0%
Final simplification68.0%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (/ A (* V l))))
(if (<= t_0 0.0)
(* c0 (sqrt (/ (/ A l) V)))
(if (<= t_0 2e+304) (* c0 (sqrt t_0)) (/ c0 (sqrt (* V (/ l A))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * sqrt(((A / l) / V));
} else if (t_0 <= 2e+304) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 / sqrt((V * (l / A)));
}
return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = a / (v * l)
if (t_0 <= 0.0d0) then
tmp = c0 * sqrt(((a / l) / v))
else if (t_0 <= 2d+304) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 / sqrt((v * (l / a)))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * Math.sqrt(((A / l) / V));
} else if (t_0 <= 2e+304) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 / Math.sqrt((V * (l / A)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = A / (V * l) tmp = 0 if t_0 <= 0.0: tmp = c0 * math.sqrt(((A / l) / V)) elif t_0 <= 2e+304: tmp = c0 * math.sqrt(t_0) else: tmp = c0 / math.sqrt((V * (l / A))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(V * l)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V))); elseif (t_0 <= 2e+304) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (V * l);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = c0 * sqrt(((A / l) / V));
elseif (t_0 <= 2e+304)
tmp = c0 * sqrt(t_0);
else
tmp = c0 / sqrt((V * (l / A)));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+304], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+304}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 33.1%
associate-/r*55.1%
div-inv55.1%
Applied egg-rr55.1%
associate-*l/55.1%
div-inv55.1%
Applied egg-rr55.1%
if 0.0 < (/.f64 A (*.f64 V l)) < 1.9999999999999999e304Initial program 99.3%
if 1.9999999999999999e304 < (/.f64 A (*.f64 V l)) Initial program 49.8%
pow1/249.8%
clear-num49.8%
inv-pow49.8%
pow-pow54.8%
associate-/l*59.0%
metadata-eval59.0%
Applied egg-rr59.0%
associate-/l*54.8%
Simplified54.8%
add-sqr-sqrt54.8%
sqrt-unprod49.8%
pow-prod-up49.8%
metadata-eval49.8%
inv-pow49.8%
clear-num49.8%
sqrt-div44.3%
clear-num44.2%
div-inv44.3%
sqrt-undiv54.8%
associate-*r/59.0%
Applied egg-rr59.0%
Final simplification83.9%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= (/ A (* V l)) 1e-309) (* c0 (sqrt (/ (/ A l) V))) (* c0 (pow (/ (* V l) A) -0.5))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((A / (V * l)) <= 1e-309) {
tmp = c0 * sqrt(((A / l) / V));
} else {
tmp = c0 * pow(((V * l) / A), -0.5);
}
return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: tmp
if ((a / (v * l)) <= 1d-309) then
tmp = c0 * sqrt(((a / l) / v))
else
tmp = c0 * (((v * l) / a) ** (-0.5d0))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((A / (V * l)) <= 1e-309) {
tmp = c0 * Math.sqrt(((A / l) / V));
} else {
tmp = c0 * Math.pow(((V * l) / A), -0.5);
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (A / (V * l)) <= 1e-309: tmp = c0 * math.sqrt(((A / l) / V)) else: tmp = c0 * math.pow(((V * l) / A), -0.5) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(A / Float64(V * l)) <= 1e-309) tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V))); else tmp = Float64(c0 * (Float64(Float64(V * l) / A) ^ -0.5)); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if ((A / (V * l)) <= 1e-309)
tmp = c0 * sqrt(((A / l) / V));
else
tmp = c0 * (((V * l) / A) ^ -0.5);
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision], 1e-309], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Power[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{A}{V \cdot \ell} \leq 10^{-309}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot {\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 1.000000000000002e-309Initial program 34.4%
associate-/r*56.0%
div-inv56.0%
Applied egg-rr56.0%
associate-*l/56.0%
div-inv56.0%
Applied egg-rr56.0%
if 1.000000000000002e-309 < (/.f64 A (*.f64 V l)) Initial program 88.4%
pow1/288.4%
clear-num88.4%
inv-pow88.4%
pow-pow89.5%
associate-/l*83.9%
metadata-eval83.9%
Applied egg-rr83.9%
associate-/l*89.5%
Simplified89.5%
Final simplification83.2%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (let* ((t_0 (/ A (* V l)))) (if (<= t_0 0.0) (* c0 (sqrt (/ (/ A V) l))) (* c0 (sqrt t_0)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * sqrt(((A / V) / l));
} else {
tmp = c0 * sqrt(t_0);
}
return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = a / (v * l)
if (t_0 <= 0.0d0) then
tmp = c0 * sqrt(((a / v) / l))
else
tmp = c0 * sqrt(t_0)
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else {
tmp = c0 * Math.sqrt(t_0);
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = A / (V * l) tmp = 0 if t_0 <= 0.0: tmp = c0 * math.sqrt(((A / V) / l)) else: tmp = c0 * math.sqrt(t_0) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(V * l)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); else tmp = Float64(c0 * sqrt(t_0)); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (V * l);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = c0 * sqrt(((A / V) / l));
else
tmp = c0 * sqrt(t_0);
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 33.1%
associate-/r*55.1%
div-inv55.1%
Applied egg-rr55.1%
un-div-inv55.1%
Applied egg-rr55.1%
if 0.0 < (/.f64 A (*.f64 V l)) Initial program 88.4%
Final simplification82.3%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (let* ((t_0 (/ A (* V l)))) (if (<= t_0 0.0) (* c0 (sqrt (/ (/ A l) V))) (* c0 (sqrt t_0)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * sqrt(((A / l) / V));
} else {
tmp = c0 * sqrt(t_0);
}
return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = a / (v * l)
if (t_0 <= 0.0d0) then
tmp = c0 * sqrt(((a / l) / v))
else
tmp = c0 * sqrt(t_0)
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * Math.sqrt(((A / l) / V));
} else {
tmp = c0 * Math.sqrt(t_0);
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = A / (V * l) tmp = 0 if t_0 <= 0.0: tmp = c0 * math.sqrt(((A / l) / V)) else: tmp = c0 * math.sqrt(t_0) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(V * l)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V))); else tmp = Float64(c0 * sqrt(t_0)); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (V * l);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = c0 * sqrt(((A / l) / V));
else
tmp = c0 * sqrt(t_0);
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 33.1%
associate-/r*55.1%
div-inv55.1%
Applied egg-rr55.1%
associate-*l/55.1%
div-inv55.1%
Applied egg-rr55.1%
if 0.0 < (/.f64 A (*.f64 V l)) Initial program 88.4%
Final simplification82.3%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
NOTE: V and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
code = c0 * sqrt((a / (v * l)))
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
[V, l] = sort([V, l]) def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
V, l = sort([V, l]) function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
V, l = num2cell(sort([V, l])){:}
function tmp = code(c0, A, V, l)
tmp = c0 * sqrt((A / (V * l)));
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
Initial program 78.2%
Final simplification78.2%
herbie shell --seed 2023230
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))