(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) (- INFINITY))
(* (* (sqrt (/ A V)) (sqrt (/ 1.0 l))) c0)
(if (<= (* V l) -2e-320)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 4e-296)
(/ c0 (sqrt (/ V (/ A l))))
(if (<= (* V l) 1e+268)
(* c0 (* (sqrt A) (sqrt (/ 1.0 (* V l)))))
(* c0 (sqrt (/ (/ A V) l))))))))double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = (sqrt((A / V)) * sqrt((1.0 / l))) * c0;
} else if ((V * l) <= -2e-320) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 4e-296) {
tmp = c0 / sqrt((V / (A / l)));
} else if ((V * l) <= 1e+268) {
tmp = c0 * (sqrt(A) * sqrt((1.0 / (V * l))));
} else {
tmp = c0 * sqrt(((A / V) / l));
}
return tmp;
}
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (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.sqrt((1.0 / l))) * c0;
} else if ((V * l) <= -2e-320) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 4e-296) {
tmp = c0 / Math.sqrt((V / (A / l)));
} else if ((V * l) <= 1e+268) {
tmp = c0 * (Math.sqrt(A) * Math.sqrt((1.0 / (V * l))));
} else {
tmp = c0 * Math.sqrt(((A / V) / l));
}
return tmp;
}
def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
def code(c0, A, V, l): tmp = 0 if (V * l) <= -math.inf: tmp = (math.sqrt((A / V)) * math.sqrt((1.0 / l))) * c0 elif (V * l) <= -2e-320: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 4e-296: tmp = c0 / math.sqrt((V / (A / l))) elif (V * l) <= 1e+268: tmp = c0 * (math.sqrt(A) * math.sqrt((1.0 / (V * l)))) else: tmp = c0 * math.sqrt(((A / V) / l)) return tmp
function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(Float64(sqrt(Float64(A / V)) * sqrt(Float64(1.0 / l))) * c0); elseif (Float64(V * l) <= -2e-320) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 4e-296) tmp = Float64(c0 / sqrt(Float64(V / Float64(A / l)))); elseif (Float64(V * l) <= 1e+268) tmp = Float64(c0 * Float64(sqrt(A) * sqrt(Float64(1.0 / Float64(V * l))))); else tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); end return tmp end
function tmp = code(c0, A, V, l) tmp = c0 * sqrt((A / (V * l))); end
function tmp_2 = code(c0, A, V, l) tmp = 0.0; if ((V * l) <= -Inf) tmp = (sqrt((A / V)) * sqrt((1.0 / l))) * c0; elseif ((V * l) <= -2e-320) tmp = c0 * (sqrt(-A) / sqrt((V * -l))); elseif ((V * l) <= 4e-296) tmp = c0 / sqrt((V / (A / l))); elseif ((V * l) <= 1e+268) tmp = c0 * (sqrt(A) * sqrt((1.0 / (V * l)))); else tmp = c0 * sqrt(((A / V) / l)); end tmp_2 = tmp; end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -2e-320], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e-296], N[(c0 / N[Sqrt[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+268], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Sqrt[N[(1.0 / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;\left(\sqrt{\frac{A}{V}} \cdot \sqrt{\frac{1}{\ell}}\right) \cdot c0\\
\mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-320}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{-296}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+268}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{1}{V \cdot \ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\end{array}
Results
if (*.f64 V l) < -inf.0Initial program 40.5
Applied egg-rr24.3
Applied egg-rr24.3
Taylor expanded in c0 around 0 40.5
Simplified23.7
Applied egg-rr10.8
if -inf.0 < (*.f64 V l) < -1.99998e-320Initial program 10.3
Applied egg-rr0.6
if -1.99998e-320 < (*.f64 V l) < 4e-296Initial program 60.9
Applied egg-rr36.7
Applied egg-rr36.7
Applied egg-rr36.7
if 4e-296 < (*.f64 V l) < 9.9999999999999997e267Initial program 9.7
Applied egg-rr0.4
if 9.9999999999999997e267 < (*.f64 V l) Initial program 36.6
Applied egg-rr23.7
Applied egg-rr23.6
Taylor expanded in c0 around 0 36.6
Simplified22.5
Final simplification6.7
herbie shell --seed 2022206
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))