
(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
(let* ((t_0 (/ c0 (/ (sqrt (/ V A)) (pow l -0.5)))))
(if (<= (* V l) (- INFINITY))
t_0
(if (<= (* V l) -1e-282)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 0.0) t_0 (* c0 (/ (sqrt A) (sqrt (* V l)))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 / (sqrt((V / A)) / pow(l, -0.5));
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = t_0;
} else if ((V * l) <= -1e-282) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = t_0;
} else {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
}
return tmp;
}
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = c0 / (Math.sqrt((V / A)) / Math.pow(l, -0.5));
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = t_0;
} else if ((V * l) <= -1e-282) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = t_0;
} else {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = c0 / (math.sqrt((V / A)) / math.pow(l, -0.5)) tmp = 0 if (V * l) <= -math.inf: tmp = t_0 elif (V * l) <= -1e-282: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 0.0: tmp = t_0 else: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(c0 / Float64(sqrt(Float64(V / A)) / (l ^ -0.5))) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = t_0; elseif (Float64(V * l) <= -1e-282) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 0.0) tmp = t_0; else tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = c0 / (sqrt((V / A)) / (l ^ -0.5));
tmp = 0.0;
if ((V * l) <= -Inf)
tmp = t_0;
elseif ((V * l) <= -1e-282)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 0.0)
tmp = t_0;
else
tmp = c0 * (sqrt(A) / 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_] := Block[{t$95$0 = N[(c0 / N[(N[Sqrt[N[(V / A), $MachinePrecision]], $MachinePrecision] / N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], -1e-282], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], t$95$0, N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{c0}{\frac{\sqrt{\frac{V}{A}}}{{\ell}^{-0.5}}}\\
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;t_0\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-282}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0 or -1e-282 < (*.f64 V l) < 0.0Initial program 43.4%
clear-num43.4%
associate-/r/42.9%
associate-/r*42.9%
Applied egg-rr42.9%
sqrt-prod9.5%
associate-*r*9.5%
associate-/r*9.5%
sqrt-div9.5%
metadata-eval9.5%
div-inv9.5%
associate-/r/9.5%
sqrt-undiv43.5%
associate-*l/62.0%
sqrt-prod45.0%
associate-/r*45.0%
Applied egg-rr45.0%
associate-/l/45.0%
clear-num43.7%
sqrt-div43.7%
metadata-eval43.7%
div-inv43.7%
sqrt-undiv62.0%
clear-num62.0%
associate-/r*43.4%
clear-num43.5%
frac-2neg43.5%
distribute-rgt-neg-out43.5%
sqrt-div33.9%
associate-/l*33.8%
*-commutative33.8%
associate-*l/33.9%
Applied egg-rr61.9%
clear-num61.9%
sqrt-div61.8%
metadata-eval61.8%
associate-/r/61.8%
*-commutative61.8%
*-commutative61.8%
div-inv62.0%
sqrt-prod45.0%
associate-/r*45.0%
div-inv45.0%
associate-/l*44.9%
pow1/244.9%
pow-flip44.9%
metadata-eval44.9%
Applied egg-rr44.9%
if -inf.0 < (*.f64 V l) < -1e-282Initial program 86.2%
frac-2neg86.2%
sqrt-div99.3%
distribute-rgt-neg-in99.3%
Applied egg-rr99.3%
if 0.0 < (*.f64 V l) Initial program 76.6%
sqrt-div90.1%
associate-*r/88.3%
Applied egg-rr88.3%
*-commutative88.3%
associate-/l*88.2%
associate-/r/90.1%
Simplified90.1%
Final simplification82.7%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= V -5e-310) (* (/ (sqrt (/ (- A) l)) (sqrt (- V))) c0) (* c0 (/ (/ (sqrt A) (sqrt V)) (sqrt l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (V <= -5e-310) {
tmp = (sqrt((-A / l)) / sqrt(-V)) * c0;
} else {
tmp = c0 * ((sqrt(A) / sqrt(V)) / sqrt(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 (v <= (-5d-310)) then
tmp = (sqrt((-a / l)) / sqrt(-v)) * c0
else
tmp = c0 * ((sqrt(a) / sqrt(v)) / sqrt(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 (V <= -5e-310) {
tmp = (Math.sqrt((-A / l)) / Math.sqrt(-V)) * c0;
} else {
tmp = c0 * ((Math.sqrt(A) / Math.sqrt(V)) / Math.sqrt(l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if V <= -5e-310: tmp = (math.sqrt((-A / l)) / math.sqrt(-V)) * c0 else: tmp = c0 * ((math.sqrt(A) / math.sqrt(V)) / math.sqrt(l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (V <= -5e-310) tmp = Float64(Float64(sqrt(Float64(Float64(-A) / l)) / sqrt(Float64(-V))) * c0); else tmp = Float64(c0 * Float64(Float64(sqrt(A) / sqrt(V)) / sqrt(l))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (V <= -5e-310)
tmp = (sqrt((-A / l)) / sqrt(-V)) * c0;
else
tmp = c0 * ((sqrt(A) / sqrt(V)) / sqrt(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[V, -5e-310], N[(N[(N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], N[(c0 * N[(N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[V], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{\frac{-A}{\ell}}}{\sqrt{-V}} \cdot c0\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\frac{\sqrt{A}}{\sqrt{V}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if V < -4.999999999999985e-310Initial program 76.3%
clear-num75.5%
associate-/r/76.1%
associate-/r*76.1%
Applied egg-rr76.1%
sqrt-prod38.2%
associate-*r*37.5%
associate-/r*37.5%
sqrt-div37.5%
metadata-eval37.5%
div-inv37.5%
associate-/r/38.2%
sqrt-undiv75.5%
associate-*l/72.0%
sqrt-prod45.5%
associate-/r*42.6%
Applied egg-rr42.6%
associate-/l/45.5%
clear-num44.8%
sqrt-div46.5%
metadata-eval46.5%
div-inv46.6%
sqrt-undiv73.5%
clear-num73.5%
associate-/r*75.5%
clear-num75.5%
frac-2neg75.5%
distribute-rgt-neg-out75.5%
sqrt-div46.6%
associate-/l*44.4%
*-commutative44.4%
associate-*l/46.6%
Applied egg-rr76.7%
frac-2neg76.7%
sqrt-div85.2%
distribute-neg-frac85.2%
Applied egg-rr85.2%
if -4.999999999999985e-310 < V Initial program 68.4%
clear-num68.1%
associate-/r/68.4%
associate-/r*68.5%
Applied egg-rr68.5%
*-commutative68.5%
associate-/r*68.4%
un-div-inv68.4%
sqrt-undiv41.4%
sqrt-prod50.8%
associate-/r*50.8%
Applied egg-rr50.8%
Final simplification67.1%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= l -2e-310) (* c0 (* (sqrt A) (sqrt (/ (/ 1.0 V) l)))) (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -2e-310) {
tmp = c0 * (sqrt(A) * sqrt(((1.0 / V) / l)));
} else {
tmp = c0 * (sqrt((A / V)) / sqrt(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 (l <= (-2d-310)) then
tmp = c0 * (sqrt(a) * sqrt(((1.0d0 / v) / l)))
else
tmp = c0 * (sqrt((a / v)) / sqrt(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 (l <= -2e-310) {
tmp = c0 * (Math.sqrt(A) * Math.sqrt(((1.0 / V) / l)));
} else {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if l <= -2e-310: tmp = c0 * (math.sqrt(A) * math.sqrt(((1.0 / V) / l))) else: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (l <= -2e-310) tmp = Float64(c0 * Float64(sqrt(A) * sqrt(Float64(Float64(1.0 / V) / l)))); else tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (l <= -2e-310)
tmp = c0 * (sqrt(A) * sqrt(((1.0 / V) / l)));
else
tmp = c0 * (sqrt((A / V)) / sqrt(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[l, -2e-310], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{\frac{1}{V}}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 70.4%
div-inv70.4%
sqrt-prod37.9%
associate-/r*37.9%
Applied egg-rr37.9%
if -1.999999999999994e-310 < l Initial program 73.8%
associate-/r*75.7%
sqrt-div87.5%
Applied egg-rr87.5%
Final simplification63.9%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= l -2e-310) (* c0 (sqrt (* A (/ (/ 1.0 V) l)))) (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -2e-310) {
tmp = c0 * sqrt((A * ((1.0 / V) / l)));
} else {
tmp = c0 * (sqrt((A / V)) / sqrt(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 (l <= (-2d-310)) then
tmp = c0 * sqrt((a * ((1.0d0 / v) / l)))
else
tmp = c0 * (sqrt((a / v)) / sqrt(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 (l <= -2e-310) {
tmp = c0 * Math.sqrt((A * ((1.0 / V) / l)));
} else {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if l <= -2e-310: tmp = c0 * math.sqrt((A * ((1.0 / V) / l))) else: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (l <= -2e-310) tmp = Float64(c0 * sqrt(Float64(A * Float64(Float64(1.0 / V) / l)))); else tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (l <= -2e-310)
tmp = c0 * sqrt((A * ((1.0 / V) / l)));
else
tmp = c0 * (sqrt((A / V)) / sqrt(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[l, -2e-310], N[(c0 * N[Sqrt[N[(A * N[(N[(1.0 / V), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \sqrt{A \cdot \frac{\frac{1}{V}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 70.4%
clear-num69.3%
associate-/r/70.4%
associate-/r*70.4%
Applied egg-rr70.4%
if -1.999999999999994e-310 < l Initial program 73.8%
associate-/r*75.7%
sqrt-div87.5%
Applied egg-rr87.5%
Final simplification79.3%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= l -2e-310) (* c0 (/ (sqrt A) (sqrt (* V l)))) (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -2e-310) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} else {
tmp = c0 * (sqrt((A / V)) / sqrt(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 (l <= (-2d-310)) then
tmp = c0 * (sqrt(a) / sqrt((v * l)))
else
tmp = c0 * (sqrt((a / v)) / sqrt(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 (l <= -2e-310) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} else {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if l <= -2e-310: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) else: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (l <= -2e-310) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); else tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (l <= -2e-310)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
else
tmp = c0 * (sqrt((A / V)) / sqrt(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[l, -2e-310], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 70.4%
sqrt-div37.9%
associate-*r/36.4%
Applied egg-rr36.4%
*-commutative36.4%
associate-/l*37.1%
associate-/r/37.9%
Simplified37.9%
if -1.999999999999994e-310 < l Initial program 73.8%
associate-/r*75.7%
sqrt-div87.5%
Applied egg-rr87.5%
Final simplification63.9%
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 (or (<= t_0 0.0) (not (<= t_0 1e+301)))
(* c0 (sqrt (/ (/ A V) l)))
(* c0 (sqrt (* A (/ (/ 1.0 V) l)))))))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) || !(t_0 <= 1e+301)) {
tmp = c0 * sqrt(((A / V) / l));
} else {
tmp = c0 * sqrt((A * ((1.0 / 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) :: t_0
real(8) :: tmp
t_0 = a / (v * l)
if ((t_0 <= 0.0d0) .or. (.not. (t_0 <= 1d+301))) then
tmp = c0 * sqrt(((a / v) / l))
else
tmp = c0 * sqrt((a * ((1.0d0 / v) / l)))
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) || !(t_0 <= 1e+301)) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else {
tmp = c0 * Math.sqrt((A * ((1.0 / V) / l)));
}
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) or not (t_0 <= 1e+301): tmp = c0 * math.sqrt(((A / V) / l)) else: tmp = c0 * math.sqrt((A * ((1.0 / V) / l))) 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) || !(t_0 <= 1e+301)) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); else tmp = Float64(c0 * sqrt(Float64(A * Float64(Float64(1.0 / V) / l)))); 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) || ~((t_0 <= 1e+301)))
tmp = c0 * sqrt(((A / V) / l));
else
tmp = c0 * sqrt((A * ((1.0 / 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_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 1e+301]], $MachinePrecision]], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(A * N[(N[(1.0 / V), $MachinePrecision] / l), $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 \lor \neg \left(t_0 \leq 10^{+301}\right):\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{A \cdot \frac{\frac{1}{V}}{\ell}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0 or 1.00000000000000005e301 < (/.f64 A (*.f64 V l)) Initial program 38.0%
clear-num38.0%
associate-/r/37.8%
associate-/r*37.8%
Applied egg-rr37.8%
*-commutative37.8%
associate-*r/48.5%
div-inv48.5%
Applied egg-rr48.5%
if 0.0 < (/.f64 A (*.f64 V l)) < 1.00000000000000005e301Initial program 99.1%
clear-num98.1%
associate-/r/99.1%
associate-/r*99.2%
Applied egg-rr99.2%
Final simplification76.8%
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 (or (<= t_0 0.0) (not (<= t_0 1e+301)))
(* 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) || !(t_0 <= 1e+301)) {
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) .or. (.not. (t_0 <= 1d+301))) 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) || !(t_0 <= 1e+301)) {
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) or not (t_0 <= 1e+301): 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) || !(t_0 <= 1e+301)) 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) || ~((t_0 <= 1e+301)))
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[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 1e+301]], $MachinePrecision]], 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 \lor \neg \left(t_0 \leq 10^{+301}\right):\\
\;\;\;\;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.0 or 1.00000000000000005e301 < (/.f64 A (*.f64 V l)) Initial program 38.0%
clear-num38.0%
associate-/r/37.8%
associate-/r*37.8%
Applied egg-rr37.8%
*-commutative37.8%
associate-*r/48.5%
div-inv48.5%
Applied egg-rr48.5%
if 0.0 < (/.f64 A (*.f64 V l)) < 1.00000000000000005e301Initial program 99.1%
Final simplification76.8%
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 4e-309)
(* c0 (sqrt (/ (/ A l) V)))
(if (<= t_0 1e+301)
(/ c0 (sqrt (/ (* V l) A)))
(* c0 (sqrt (/ (/ A V) l)))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 4e-309) {
tmp = c0 * sqrt(((A / l) / V));
} else if (t_0 <= 1e+301) {
tmp = c0 / sqrt(((V * l) / A));
} else {
tmp = c0 * sqrt(((A / 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) :: t_0
real(8) :: tmp
t_0 = a / (v * l)
if (t_0 <= 4d-309) then
tmp = c0 * sqrt(((a / l) / v))
else if (t_0 <= 1d+301) then
tmp = c0 / sqrt(((v * l) / a))
else
tmp = c0 * sqrt(((a / v) / l))
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 <= 4e-309) {
tmp = c0 * Math.sqrt(((A / l) / V));
} else if (t_0 <= 1e+301) {
tmp = c0 / Math.sqrt(((V * l) / A));
} else {
tmp = c0 * Math.sqrt(((A / V) / l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = A / (V * l) tmp = 0 if t_0 <= 4e-309: tmp = c0 * math.sqrt(((A / l) / V)) elif t_0 <= 1e+301: tmp = c0 / math.sqrt(((V * l) / A)) else: tmp = c0 * math.sqrt(((A / V) / l)) 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 <= 4e-309) tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V))); elseif (t_0 <= 1e+301) tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / A))); else tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); 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 <= 4e-309)
tmp = c0 * sqrt(((A / l) / V));
elseif (t_0 <= 1e+301)
tmp = c0 / sqrt(((V * l) / A));
else
tmp = c0 * sqrt(((A / 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_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 4e-309], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+301], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $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 4 \cdot 10^{-309}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\mathbf{elif}\;t_0 \leq 10^{+301}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 3.9999999999999977e-309Initial program 36.2%
clear-num33.9%
associate-/r/36.2%
associate-/r*36.2%
Applied egg-rr36.2%
sqrt-prod28.5%
associate-*r*28.6%
associate-/r*28.6%
sqrt-div28.6%
metadata-eval28.6%
div-inv28.6%
associate-/r/28.6%
sqrt-undiv33.9%
associate-*l/42.0%
sqrt-prod37.4%
associate-/r*37.4%
Applied egg-rr37.4%
associate-/l/37.4%
clear-num37.4%
sqrt-div37.4%
metadata-eval37.4%
div-inv37.4%
sqrt-undiv41.9%
clear-num42.0%
associate-/r*33.9%
clear-num33.9%
frac-2neg33.9%
distribute-rgt-neg-out33.9%
sqrt-div34.6%
associate-/l*34.6%
*-commutative34.6%
associate-*l/34.6%
Applied egg-rr44.7%
if 3.9999999999999977e-309 < (/.f64 A (*.f64 V l)) < 1.00000000000000005e301Initial program 99.5%
pow1/299.5%
clear-num99.5%
inv-pow99.5%
pow-pow99.5%
*-commutative99.5%
associate-/l*87.8%
metadata-eval87.8%
Applied egg-rr87.8%
associate-/l*99.5%
*-commutative99.5%
associate-/l*87.2%
associate-/r/87.6%
Simplified87.6%
Taylor expanded in V around 0 99.5%
add-sqr-sqrt98.9%
sqrt-unprod99.5%
pow-prod-up99.5%
*-commutative99.5%
associate-/l*87.8%
metadata-eval87.8%
inv-pow87.8%
clear-num87.9%
sqrt-div50.0%
associate-*r/47.4%
associate-/l*50.0%
sqrt-undiv87.9%
associate-/r/87.3%
Applied egg-rr87.3%
associate-*l/99.5%
associate-*r/87.7%
Simplified87.7%
associate-*r/99.5%
Applied egg-rr99.5%
if 1.00000000000000005e301 < (/.f64 A (*.f64 V l)) Initial program 42.2%
clear-num42.1%
associate-/r/41.6%
associate-/r*41.7%
Applied egg-rr41.7%
*-commutative41.7%
associate-*r/53.3%
div-inv53.4%
Applied egg-rr53.4%
Final simplification76.6%
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 72.2%
Final simplification72.2%
herbie shell --seed 2023315
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))