
(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 10 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) -1e-201)
(* c0 (/ (/ (sqrt (- A)) (sqrt (- V))) (sqrt l)))
(if (<= (* V l) 0.0)
(* c0 (pow (/ V (/ A l)) -0.5))
(if (<= (* V l) 4e+301)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(/ c0 (sqrt (/ l (/ A V))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -1e-201) {
tmp = c0 * ((sqrt(-A) / sqrt(-V)) / sqrt(l));
} else if ((V * l) <= 0.0) {
tmp = c0 * pow((V / (A / l)), -0.5);
} else if ((V * l) <= 4e+301) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} else {
tmp = c0 / sqrt((l / (A / 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) <= (-1d-201)) then
tmp = c0 * ((sqrt(-a) / sqrt(-v)) / sqrt(l))
else if ((v * l) <= 0.0d0) then
tmp = c0 * ((v / (a / l)) ** (-0.5d0))
else if ((v * l) <= 4d+301) then
tmp = c0 * (sqrt(a) / sqrt((v * l)))
else
tmp = c0 / sqrt((l / (a / 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) <= -1e-201) {
tmp = c0 * ((Math.sqrt(-A) / Math.sqrt(-V)) / Math.sqrt(l));
} else if ((V * l) <= 0.0) {
tmp = c0 * Math.pow((V / (A / l)), -0.5);
} else if ((V * l) <= 4e+301) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} else {
tmp = c0 / Math.sqrt((l / (A / V)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -1e-201: tmp = c0 * ((math.sqrt(-A) / math.sqrt(-V)) / math.sqrt(l)) elif (V * l) <= 0.0: tmp = c0 * math.pow((V / (A / l)), -0.5) elif (V * l) <= 4e+301: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) else: tmp = c0 / math.sqrt((l / (A / V))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= -1e-201) tmp = Float64(c0 * Float64(Float64(sqrt(Float64(-A)) / sqrt(Float64(-V))) / sqrt(l))); elseif (Float64(V * l) <= 0.0) tmp = Float64(c0 * (Float64(V / Float64(A / l)) ^ -0.5)); elseif (Float64(V * l) <= 4e+301) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); else tmp = Float64(c0 / sqrt(Float64(l / Float64(A / 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) <= -1e-201)
tmp = c0 * ((sqrt(-A) / sqrt(-V)) / sqrt(l));
elseif ((V * l) <= 0.0)
tmp = c0 * ((V / (A / l)) ^ -0.5);
elseif ((V * l) <= 4e+301)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
else
tmp = c0 / sqrt((l / (A / 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], -1e-201], N[(c0 * N[(N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 * N[Power[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+301], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l / N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{-201}:\\
\;\;\;\;c0 \cdot \frac{\frac{\sqrt{-A}}{\sqrt{-V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;c0 \cdot {\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\
\end{array}
\end{array}
if (*.f64 V l) < -9.99999999999999946e-202Initial program 77.9%
associate-/r*73.9%
sqrt-div41.8%
Applied egg-rr41.8%
frac-2neg41.8%
sqrt-div51.2%
Applied egg-rr51.2%
if -9.99999999999999946e-202 < (*.f64 V l) < 0.0Initial program 72.6%
pow1/272.6%
clear-num72.6%
inv-pow72.6%
pow-pow72.6%
associate-/l*75.8%
metadata-eval75.8%
Applied egg-rr75.8%
if 0.0 < (*.f64 V l) < 4.00000000000000021e301Initial program 90.5%
sqrt-div99.5%
associate-*r/97.8%
Applied egg-rr97.8%
*-commutative97.8%
associate-*l/99.5%
Simplified99.5%
if 4.00000000000000021e301 < (*.f64 V l) Initial program 16.9%
*-un-lft-identity16.9%
times-frac78.5%
Applied egg-rr78.5%
frac-times16.9%
*-un-lft-identity16.9%
associate-/r*78.7%
sqrt-undiv39.0%
associate-*r/39.1%
associate-/l*39.0%
sqrt-undiv78.7%
Applied egg-rr78.7%
Final simplification75.4%
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))
(* c0 (* (pow (/ V A) -0.5) (pow l -0.5)))
(if (<= (* V l) -5e-282)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 5e-261)
(* c0 (/ 1.0 (sqrt (/ V (/ A l)))))
(if (<= (* V l) 4e+301)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(/ c0 (sqrt (/ l (/ A V)))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = c0 * (pow((V / A), -0.5) * pow(l, -0.5));
} else if ((V * l) <= -5e-282) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 5e-261) {
tmp = c0 * (1.0 / sqrt((V / (A / l))));
} else if ((V * l) <= 4e+301) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} else {
tmp = c0 / sqrt((l / (A / V)));
}
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 = c0 * (Math.pow((V / A), -0.5) * Math.pow(l, -0.5));
} else if ((V * l) <= -5e-282) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 5e-261) {
tmp = c0 * (1.0 / Math.sqrt((V / (A / l))));
} else if ((V * l) <= 4e+301) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} else {
tmp = c0 / Math.sqrt((l / (A / V)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -math.inf: tmp = c0 * (math.pow((V / A), -0.5) * math.pow(l, -0.5)) elif (V * l) <= -5e-282: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 5e-261: tmp = c0 * (1.0 / math.sqrt((V / (A / l)))) elif (V * l) <= 4e+301: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) else: tmp = c0 / math.sqrt((l / (A / V))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(c0 * Float64((Float64(V / A) ^ -0.5) * (l ^ -0.5))); elseif (Float64(V * l) <= -5e-282) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 5e-261) tmp = Float64(c0 * Float64(1.0 / sqrt(Float64(V / Float64(A / l))))); elseif (Float64(V * l) <= 4e+301) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); else tmp = Float64(c0 / sqrt(Float64(l / Float64(A / 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) <= -Inf)
tmp = c0 * (((V / A) ^ -0.5) * (l ^ -0.5));
elseif ((V * l) <= -5e-282)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 5e-261)
tmp = c0 * (1.0 / sqrt((V / (A / l))));
elseif ((V * l) <= 4e+301)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
else
tmp = c0 / sqrt((l / (A / 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], (-Infinity)], N[(c0 * N[(N[Power[N[(V / A), $MachinePrecision], -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-282], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-261], N[(c0 * N[(1.0 / N[Sqrt[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+301], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l / N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;c0 \cdot \left({\left(\frac{V}{A}\right)}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-282}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\
\;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 28.6%
*-un-lft-identity28.6%
times-frac66.1%
Applied egg-rr66.1%
frac-times28.6%
*-un-lft-identity28.6%
associate-/l/66.2%
clear-num66.1%
unpow-166.1%
sqrt-pow166.2%
associate-/r/66.2%
metadata-eval66.2%
unpow-prod-down33.9%
Applied egg-rr33.9%
if -inf.0 < (*.f64 V l) < -5.0000000000000001e-282Initial program 87.5%
frac-2neg87.5%
sqrt-div99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
Applied egg-rr99.5%
if -5.0000000000000001e-282 < (*.f64 V l) < 4.99999999999999981e-261Initial program 71.1%
clear-num71.1%
sqrt-div71.1%
metadata-eval71.1%
associate-/l*77.1%
Applied egg-rr77.1%
if 4.99999999999999981e-261 < (*.f64 V l) < 4.00000000000000021e301Initial program 90.0%
sqrt-div99.5%
associate-*r/97.7%
Applied egg-rr97.7%
*-commutative97.7%
associate-*l/99.5%
Simplified99.5%
if 4.00000000000000021e301 < (*.f64 V l) Initial program 16.9%
*-un-lft-identity16.9%
times-frac78.5%
Applied egg-rr78.5%
frac-times16.9%
*-un-lft-identity16.9%
associate-/r*78.7%
sqrt-undiv39.0%
associate-*r/39.1%
associate-/l*39.0%
sqrt-undiv78.7%
Applied egg-rr78.7%
Final simplification90.9%
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))
(* c0 (/ (sqrt (- (/ A l))) (sqrt (- V))))
(if (<= (* V l) -5e-282)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 5e-261)
(* c0 (/ 1.0 (sqrt (/ V (/ A l)))))
(if (<= (* V l) 4e+301)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(/ c0 (sqrt (/ l (/ A V)))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = c0 * (sqrt(-(A / l)) / sqrt(-V));
} else if ((V * l) <= -5e-282) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 5e-261) {
tmp = c0 * (1.0 / sqrt((V / (A / l))));
} else if ((V * l) <= 4e+301) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} else {
tmp = c0 / sqrt((l / (A / V)));
}
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 = c0 * (Math.sqrt(-(A / l)) / Math.sqrt(-V));
} else if ((V * l) <= -5e-282) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 5e-261) {
tmp = c0 * (1.0 / Math.sqrt((V / (A / l))));
} else if ((V * l) <= 4e+301) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} else {
tmp = c0 / Math.sqrt((l / (A / V)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -math.inf: tmp = c0 * (math.sqrt(-(A / l)) / math.sqrt(-V)) elif (V * l) <= -5e-282: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 5e-261: tmp = c0 * (1.0 / math.sqrt((V / (A / l)))) elif (V * l) <= 4e+301: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) else: tmp = c0 / math.sqrt((l / (A / V))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(c0 * Float64(sqrt(Float64(-Float64(A / l))) / sqrt(Float64(-V)))); elseif (Float64(V * l) <= -5e-282) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 5e-261) tmp = Float64(c0 * Float64(1.0 / sqrt(Float64(V / Float64(A / l))))); elseif (Float64(V * l) <= 4e+301) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); else tmp = Float64(c0 / sqrt(Float64(l / Float64(A / 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) <= -Inf)
tmp = c0 * (sqrt(-(A / l)) / sqrt(-V));
elseif ((V * l) <= -5e-282)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 5e-261)
tmp = c0 * (1.0 / sqrt((V / (A / l))));
elseif ((V * l) <= 4e+301)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
else
tmp = c0 / sqrt((l / (A / 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], (-Infinity)], N[(c0 * N[(N[Sqrt[(-N[(A / l), $MachinePrecision])], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-282], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-261], N[(c0 * N[(1.0 / N[Sqrt[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+301], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l / N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-\frac{A}{\ell}}}{\sqrt{-V}}\\
\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-282}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\
\;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 28.6%
*-un-lft-identity28.6%
times-frac66.1%
Applied egg-rr66.1%
associate-*l/66.2%
*-un-lft-identity66.2%
Applied egg-rr66.2%
frac-2neg66.2%
sqrt-div39.7%
Applied egg-rr39.7%
distribute-neg-frac39.7%
Simplified39.7%
if -inf.0 < (*.f64 V l) < -5.0000000000000001e-282Initial program 87.5%
frac-2neg87.5%
sqrt-div99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
Applied egg-rr99.5%
if -5.0000000000000001e-282 < (*.f64 V l) < 4.99999999999999981e-261Initial program 71.1%
clear-num71.1%
sqrt-div71.1%
metadata-eval71.1%
associate-/l*77.1%
Applied egg-rr77.1%
if 4.99999999999999981e-261 < (*.f64 V l) < 4.00000000000000021e301Initial program 90.0%
sqrt-div99.5%
associate-*r/97.7%
Applied egg-rr97.7%
*-commutative97.7%
associate-*l/99.5%
Simplified99.5%
if 4.00000000000000021e301 < (*.f64 V l) Initial program 16.9%
*-un-lft-identity16.9%
times-frac78.5%
Applied egg-rr78.5%
frac-times16.9%
*-un-lft-identity16.9%
associate-/r*78.7%
sqrt-undiv39.0%
associate-*r/39.1%
associate-/l*39.0%
sqrt-undiv78.7%
Applied egg-rr78.7%
Final simplification91.3%
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))
(/ c0 (/ (sqrt (/ (- l) A)) (sqrt (/ -1.0 V))))
(if (<= (* V l) -5e-282)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 5e-261)
(* c0 (/ 1.0 (sqrt (/ V (/ A l)))))
(if (<= (* V l) 4e+301)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(/ c0 (sqrt (/ l (/ A V)))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = c0 / (sqrt((-l / A)) / sqrt((-1.0 / V)));
} else if ((V * l) <= -5e-282) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 5e-261) {
tmp = c0 * (1.0 / sqrt((V / (A / l))));
} else if ((V * l) <= 4e+301) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} else {
tmp = c0 / sqrt((l / (A / V)));
}
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 = c0 / (Math.sqrt((-l / A)) / Math.sqrt((-1.0 / V)));
} else if ((V * l) <= -5e-282) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 5e-261) {
tmp = c0 * (1.0 / Math.sqrt((V / (A / l))));
} else if ((V * l) <= 4e+301) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} else {
tmp = c0 / Math.sqrt((l / (A / V)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -math.inf: tmp = c0 / (math.sqrt((-l / A)) / math.sqrt((-1.0 / V))) elif (V * l) <= -5e-282: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 5e-261: tmp = c0 * (1.0 / math.sqrt((V / (A / l)))) elif (V * l) <= 4e+301: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) else: tmp = c0 / math.sqrt((l / (A / V))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(c0 / Float64(sqrt(Float64(Float64(-l) / A)) / sqrt(Float64(-1.0 / V)))); elseif (Float64(V * l) <= -5e-282) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 5e-261) tmp = Float64(c0 * Float64(1.0 / sqrt(Float64(V / Float64(A / l))))); elseif (Float64(V * l) <= 4e+301) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); else tmp = Float64(c0 / sqrt(Float64(l / Float64(A / 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) <= -Inf)
tmp = c0 / (sqrt((-l / A)) / sqrt((-1.0 / V)));
elseif ((V * l) <= -5e-282)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 5e-261)
tmp = c0 * (1.0 / sqrt((V / (A / l))));
elseif ((V * l) <= 4e+301)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
else
tmp = c0 / sqrt((l / (A / 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], (-Infinity)], N[(c0 / N[(N[Sqrt[N[((-l) / A), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(-1.0 / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-282], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-261], N[(c0 * N[(1.0 / N[Sqrt[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+301], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l / N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{\frac{-\ell}{A}}}{\sqrt{\frac{-1}{V}}}}\\
\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-282}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\
\;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 28.6%
*-un-lft-identity28.6%
times-frac66.1%
Applied egg-rr66.1%
add-sqr-sqrt31.9%
sqrt-prod40.5%
sqrt-prod28.2%
*-commutative28.2%
frac-times28.2%
*-un-lft-identity28.2%
expm1-log1p-u28.2%
expm1-udef28.2%
Applied egg-rr28.4%
expm1-def59.5%
expm1-log1p66.1%
associate-/r/66.1%
*-commutative66.1%
Simplified66.1%
pow166.1%
metadata-eval66.1%
pow-flip66.1%
inv-pow66.1%
times-frac66.1%
*-un-lft-identity66.1%
associate-/l/66.1%
frac-2neg66.1%
sqrt-div39.7%
Applied egg-rr39.7%
distribute-neg-frac39.7%
distribute-neg-frac39.7%
metadata-eval39.7%
Simplified39.7%
if -inf.0 < (*.f64 V l) < -5.0000000000000001e-282Initial program 87.5%
frac-2neg87.5%
sqrt-div99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
Applied egg-rr99.5%
if -5.0000000000000001e-282 < (*.f64 V l) < 4.99999999999999981e-261Initial program 71.1%
clear-num71.1%
sqrt-div71.1%
metadata-eval71.1%
associate-/l*77.1%
Applied egg-rr77.1%
if 4.99999999999999981e-261 < (*.f64 V l) < 4.00000000000000021e301Initial program 90.0%
sqrt-div99.5%
associate-*r/97.7%
Applied egg-rr97.7%
*-commutative97.7%
associate-*l/99.5%
Simplified99.5%
if 4.00000000000000021e301 < (*.f64 V l) Initial program 16.9%
*-un-lft-identity16.9%
times-frac78.5%
Applied egg-rr78.5%
frac-times16.9%
*-un-lft-identity16.9%
associate-/r*78.7%
sqrt-undiv39.0%
associate-*r/39.1%
associate-/l*39.0%
sqrt-undiv78.7%
Applied egg-rr78.7%
Final simplification91.3%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) -2e+263)
(* c0 (/ (sqrt (/ A V)) (sqrt l)))
(if (<= (* V l) 5e-261)
(/ c0 (sqrt (/ (* V l) A)))
(if (<= (* V l) 4e+301)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(/ c0 (sqrt (/ l (/ A V))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -2e+263) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else if ((V * l) <= 5e-261) {
tmp = c0 / sqrt(((V * l) / A));
} else if ((V * l) <= 4e+301) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} else {
tmp = c0 / sqrt((l / (A / 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) <= (-2d+263)) then
tmp = c0 * (sqrt((a / v)) / sqrt(l))
else if ((v * l) <= 5d-261) then
tmp = c0 / sqrt(((v * l) / a))
else if ((v * l) <= 4d+301) then
tmp = c0 * (sqrt(a) / sqrt((v * l)))
else
tmp = c0 / sqrt((l / (a / 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) <= -2e+263) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else if ((V * l) <= 5e-261) {
tmp = c0 / Math.sqrt(((V * l) / A));
} else if ((V * l) <= 4e+301) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} else {
tmp = c0 / Math.sqrt((l / (A / V)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -2e+263: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) elif (V * l) <= 5e-261: tmp = c0 / math.sqrt(((V * l) / A)) elif (V * l) <= 4e+301: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) else: tmp = c0 / math.sqrt((l / (A / V))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= -2e+263) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); elseif (Float64(V * l) <= 5e-261) tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / A))); elseif (Float64(V * l) <= 4e+301) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); else tmp = Float64(c0 / sqrt(Float64(l / Float64(A / 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) <= -2e+263)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
elseif ((V * l) <= 5e-261)
tmp = c0 / sqrt(((V * l) / A));
elseif ((V * l) <= 4e+301)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
else
tmp = c0 / sqrt((l / (A / 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], -2e+263], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-261], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+301], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l / N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+263}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\
\end{array}
\end{array}
if (*.f64 V l) < -2.00000000000000003e263Initial program 38.5%
associate-/r*68.2%
sqrt-div37.2%
Applied egg-rr37.2%
if -2.00000000000000003e263 < (*.f64 V l) < 4.99999999999999981e-261Initial program 83.0%
*-un-lft-identity83.0%
times-frac74.9%
Applied egg-rr74.9%
add-sqr-sqrt34.3%
sqrt-prod29.5%
sqrt-prod27.8%
*-commutative27.8%
frac-times30.7%
*-un-lft-identity30.7%
expm1-log1p-u30.4%
expm1-udef23.8%
Applied egg-rr30.3%
expm1-def47.9%
expm1-log1p77.0%
associate-/r/74.6%
*-commutative74.6%
Simplified74.6%
Taylor expanded in V around 0 83.1%
if 4.99999999999999981e-261 < (*.f64 V l) < 4.00000000000000021e301Initial program 90.0%
sqrt-div99.5%
associate-*r/97.7%
Applied egg-rr97.7%
*-commutative97.7%
associate-*l/99.5%
Simplified99.5%
if 4.00000000000000021e301 < (*.f64 V l) Initial program 16.9%
*-un-lft-identity16.9%
times-frac78.5%
Applied egg-rr78.5%
frac-times16.9%
*-un-lft-identity16.9%
associate-/r*78.7%
sqrt-undiv39.0%
associate-*r/39.1%
associate-/l*39.0%
sqrt-undiv78.7%
Applied egg-rr78.7%
Final simplification85.3%
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+307)
(* c0 (* (pow (/ V A) -0.5) (pow l -0.5)))
(if (<= (* V l) 5e-261)
(/ c0 (sqrt (/ (* V l) A)))
(if (<= (* V l) 4e+301)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(/ c0 (sqrt (/ l (/ A V))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -5e+307) {
tmp = c0 * (pow((V / A), -0.5) * pow(l, -0.5));
} else if ((V * l) <= 5e-261) {
tmp = c0 / sqrt(((V * l) / A));
} else if ((V * l) <= 4e+301) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} else {
tmp = c0 / sqrt((l / (A / 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+307)) then
tmp = c0 * (((v / a) ** (-0.5d0)) * (l ** (-0.5d0)))
else if ((v * l) <= 5d-261) then
tmp = c0 / sqrt(((v * l) / a))
else if ((v * l) <= 4d+301) then
tmp = c0 * (sqrt(a) / sqrt((v * l)))
else
tmp = c0 / sqrt((l / (a / 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+307) {
tmp = c0 * (Math.pow((V / A), -0.5) * Math.pow(l, -0.5));
} else if ((V * l) <= 5e-261) {
tmp = c0 / Math.sqrt(((V * l) / A));
} else if ((V * l) <= 4e+301) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} else {
tmp = c0 / Math.sqrt((l / (A / V)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -5e+307: tmp = c0 * (math.pow((V / A), -0.5) * math.pow(l, -0.5)) elif (V * l) <= 5e-261: tmp = c0 / math.sqrt(((V * l) / A)) elif (V * l) <= 4e+301: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) else: tmp = c0 / math.sqrt((l / (A / V))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= -5e+307) tmp = Float64(c0 * Float64((Float64(V / A) ^ -0.5) * (l ^ -0.5))); elseif (Float64(V * l) <= 5e-261) tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / A))); elseif (Float64(V * l) <= 4e+301) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); else tmp = Float64(c0 / sqrt(Float64(l / Float64(A / 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+307)
tmp = c0 * (((V / A) ^ -0.5) * (l ^ -0.5));
elseif ((V * l) <= 5e-261)
tmp = c0 / sqrt(((V * l) / A));
elseif ((V * l) <= 4e+301)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
else
tmp = c0 / sqrt((l / (A / 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+307], N[(c0 * N[(N[Power[N[(V / A), $MachinePrecision], -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-261], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e+301], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l / N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+307}:\\
\;\;\;\;c0 \cdot \left({\left(\frac{V}{A}\right)}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-261}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+301}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\
\end{array}
\end{array}
if (*.f64 V l) < -5e307Initial program 27.0%
*-un-lft-identity27.0%
times-frac62.2%
Applied egg-rr62.2%
frac-times27.0%
*-un-lft-identity27.0%
associate-/l/62.3%
clear-num62.2%
unpow-162.2%
sqrt-pow162.3%
associate-/r/62.3%
metadata-eval62.3%
unpow-prod-down31.8%
Applied egg-rr31.8%
if -5e307 < (*.f64 V l) < 4.99999999999999981e-261Initial program 83.4%
*-un-lft-identity83.4%
times-frac75.5%
Applied egg-rr75.5%
add-sqr-sqrt35.1%
sqrt-prod30.4%
sqrt-prod28.1%
*-commutative28.1%
frac-times30.9%
*-un-lft-identity30.9%
expm1-log1p-u30.6%
expm1-udef24.1%
Applied egg-rr31.1%
expm1-def49.0%
expm1-log1p77.6%
associate-/r/75.2%
*-commutative75.2%
Simplified75.2%
Taylor expanded in V around 0 83.4%
if 4.99999999999999981e-261 < (*.f64 V l) < 4.00000000000000021e301Initial program 90.0%
sqrt-div99.5%
associate-*r/97.7%
Applied egg-rr97.7%
*-commutative97.7%
associate-*l/99.5%
Simplified99.5%
if 4.00000000000000021e301 < (*.f64 V l) Initial program 16.9%
*-un-lft-identity16.9%
times-frac78.5%
Applied egg-rr78.5%
frac-times16.9%
*-un-lft-identity16.9%
associate-/r*78.7%
sqrt-undiv39.0%
associate-*r/39.1%
associate-/l*39.0%
sqrt-undiv78.7%
Applied egg-rr78.7%
Final simplification85.7%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) -2e+263)
(* c0 (/ (sqrt (/ A V)) (sqrt l)))
(if (<= (* V l) 5e+55)
(/ c0 (sqrt (/ (* V l) A)))
(* c0 (sqrt (/ (/ A l) V))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -2e+263) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else if ((V * l) <= 5e+55) {
tmp = c0 / sqrt(((V * l) / A));
} 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) <= (-2d+263)) then
tmp = c0 * (sqrt((a / v)) / sqrt(l))
else if ((v * l) <= 5d+55) then
tmp = c0 / sqrt(((v * l) / a))
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) <= -2e+263) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else if ((V * l) <= 5e+55) {
tmp = c0 / Math.sqrt(((V * l) / A));
} 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) <= -2e+263: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) elif (V * l) <= 5e+55: tmp = c0 / math.sqrt(((V * l) / A)) 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) <= -2e+263) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); elseif (Float64(V * l) <= 5e+55) tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / A))); 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) <= -2e+263)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
elseif ((V * l) <= 5e+55)
tmp = c0 / sqrt(((V * l) / A));
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], -2e+263], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e+55], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $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 -2 \cdot 10^{+263}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+55}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\end{array}
\end{array}
if (*.f64 V l) < -2.00000000000000003e263Initial program 38.5%
associate-/r*68.2%
sqrt-div37.2%
Applied egg-rr37.2%
if -2.00000000000000003e263 < (*.f64 V l) < 5.00000000000000046e55Initial program 85.3%
*-un-lft-identity85.3%
times-frac78.1%
Applied egg-rr78.1%
add-sqr-sqrt36.9%
sqrt-prod29.4%
sqrt-prod27.3%
*-commutative27.3%
frac-times29.3%
*-un-lft-identity29.3%
expm1-log1p-u28.8%
expm1-udef22.2%
Applied egg-rr28.4%
expm1-def47.4%
expm1-log1p76.0%
associate-/r/78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in V around 0 85.3%
if 5.00000000000000046e55 < (*.f64 V l) Initial program 64.7%
*-un-lft-identity64.7%
times-frac86.0%
Applied egg-rr86.0%
associate-*l/86.1%
*-un-lft-identity86.1%
Applied egg-rr86.1%
Final simplification81.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 (<= t_0 0.0) (* c0 (pow (* V (/ l A)) -0.5)) (* 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 * pow((V * (l / A)), -0.5);
} 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 * ((v * (l / a)) ** (-0.5d0))
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.pow((V * (l / A)), -0.5);
} 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.pow((V * (l / A)), -0.5) 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 * (Float64(V * Float64(l / A)) ^ -0.5)); 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 * ((V * (l / A)) ^ -0.5);
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[Power[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision], -0.5], $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 {\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 25.4%
pow1/225.4%
clear-num25.4%
inv-pow25.4%
pow-pow25.4%
associate-/l*65.3%
metadata-eval65.3%
Applied egg-rr65.3%
associate-/l*25.4%
*-lft-identity25.4%
times-frac65.3%
/-rgt-identity65.3%
Simplified65.3%
if 0.0 < (/.f64 A (*.f64 V l)) Initial program 87.8%
Final simplification84.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 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 25.4%
*-un-lft-identity25.4%
times-frac65.2%
Applied egg-rr65.2%
associate-*l/65.3%
*-un-lft-identity65.3%
Applied egg-rr65.3%
if 0.0 < (/.f64 A (*.f64 V l)) Initial program 87.8%
Final simplification84.2%
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 77.6%
Final simplification77.6%
herbie shell --seed 2023254
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))