
(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 (/ A V))) (sqrt l))))
(if (<= (* l V) -1e+269)
t_0
(if (<= (* l V) -1e-303)
(* c0 (/ (sqrt (- A)) (sqrt (* l (- V)))))
(if (<= (* l V) 0.0)
t_0
(if (<= (* l V) 5e+283)
(* c0 (/ (sqrt A) (sqrt (* l V))))
(/ (/ c0 (sqrt l)) (sqrt (/ V A)))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = (c0 * sqrt((A / V))) / sqrt(l);
double tmp;
if ((l * V) <= -1e+269) {
tmp = t_0;
} else if ((l * V) <= -1e-303) {
tmp = c0 * (sqrt(-A) / sqrt((l * -V)));
} else if ((l * V) <= 0.0) {
tmp = t_0;
} else if ((l * V) <= 5e+283) {
tmp = c0 * (sqrt(A) / sqrt((l * V)));
} else {
tmp = (c0 / sqrt(l)) / sqrt((V / 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 = (c0 * sqrt((a / v))) / sqrt(l)
if ((l * v) <= (-1d+269)) then
tmp = t_0
else if ((l * v) <= (-1d-303)) then
tmp = c0 * (sqrt(-a) / sqrt((l * -v)))
else if ((l * v) <= 0.0d0) then
tmp = t_0
else if ((l * v) <= 5d+283) then
tmp = c0 * (sqrt(a) / sqrt((l * v)))
else
tmp = (c0 / sqrt(l)) / sqrt((v / 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 = (c0 * Math.sqrt((A / V))) / Math.sqrt(l);
double tmp;
if ((l * V) <= -1e+269) {
tmp = t_0;
} else if ((l * V) <= -1e-303) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((l * -V)));
} else if ((l * V) <= 0.0) {
tmp = t_0;
} else if ((l * V) <= 5e+283) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((l * V)));
} else {
tmp = (c0 / Math.sqrt(l)) / Math.sqrt((V / A));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = (c0 * math.sqrt((A / V))) / math.sqrt(l) tmp = 0 if (l * V) <= -1e+269: tmp = t_0 elif (l * V) <= -1e-303: tmp = c0 * (math.sqrt(-A) / math.sqrt((l * -V))) elif (l * V) <= 0.0: tmp = t_0 elif (l * V) <= 5e+283: tmp = c0 * (math.sqrt(A) / math.sqrt((l * V))) else: tmp = (c0 / math.sqrt(l)) / math.sqrt((V / A)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(Float64(c0 * sqrt(Float64(A / V))) / sqrt(l)) tmp = 0.0 if (Float64(l * V) <= -1e+269) tmp = t_0; elseif (Float64(l * V) <= -1e-303) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(l * Float64(-V))))); elseif (Float64(l * V) <= 0.0) tmp = t_0; elseif (Float64(l * V) <= 5e+283) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(l * V)))); else tmp = Float64(Float64(c0 / sqrt(l)) / sqrt(Float64(V / A))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = (c0 * sqrt((A / V))) / sqrt(l);
tmp = 0.0;
if ((l * V) <= -1e+269)
tmp = t_0;
elseif ((l * V) <= -1e-303)
tmp = c0 * (sqrt(-A) / sqrt((l * -V)));
elseif ((l * V) <= 0.0)
tmp = t_0;
elseif ((l * V) <= 5e+283)
tmp = c0 * (sqrt(A) / sqrt((l * V)));
else
tmp = (c0 / sqrt(l)) / sqrt((V / 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[(N[(c0 * N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(l * V), $MachinePrecision], -1e+269], t$95$0, If[LessEqual[N[(l * V), $MachinePrecision], -1e-303], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(l * (-V)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(l * V), $MachinePrecision], 0.0], t$95$0, If[LessEqual[N[(l * V), $MachinePrecision], 5e+283], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(V / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{if}\;\ell \cdot V \leq -1 \cdot 10^{+269}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \cdot V \leq -1 \cdot 10^{-303}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{\ell \cdot \left(-V\right)}}\\
\mathbf{elif}\;\ell \cdot V \leq 0:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \cdot V \leq 5 \cdot 10^{+283}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{\ell \cdot V}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{c0}{\sqrt{\ell}}}{\sqrt{\frac{V}{A}}}\\
\end{array}
\end{array}
if (*.f64 V l) < -1e269 or -9.99999999999999931e-304 < (*.f64 V l) < -0.0Initial program 49.3%
pow1/249.3%
clear-num49.3%
inv-pow49.3%
pow-pow49.3%
associate-/l*62.5%
metadata-eval62.5%
Applied egg-rr62.5%
metadata-eval62.5%
sqrt-pow262.6%
inv-pow62.6%
un-div-inv62.7%
div-inv62.7%
clear-num62.7%
Applied egg-rr62.7%
*-commutative62.7%
associate-*l/49.4%
associate-*r/62.6%
Simplified62.6%
associate-*r/49.4%
Applied egg-rr49.4%
/-rgt-identity49.4%
div-inv49.4%
metadata-eval49.4%
associate-/l*62.6%
div-inv62.6%
clear-num62.6%
sqrt-prod49.3%
frac-times49.2%
metadata-eval49.2%
sqrt-div47.4%
clear-num47.5%
Applied egg-rr47.5%
associate-*l/47.6%
Simplified47.6%
if -1e269 < (*.f64 V l) < -9.99999999999999931e-304Initial program 86.3%
frac-2neg86.3%
sqrt-div99.6%
*-commutative99.6%
distribute-rgt-neg-in99.6%
Applied egg-rr99.6%
if -0.0 < (*.f64 V l) < 5.0000000000000004e283Initial program 86.5%
sqrt-div99.4%
associate-*r/97.5%
Applied egg-rr97.5%
*-commutative97.5%
associate-*l/99.4%
Simplified99.4%
if 5.0000000000000004e283 < (*.f64 V l) Initial program 31.3%
pow1/231.3%
clear-num31.3%
inv-pow31.3%
pow-pow31.3%
associate-/l*52.7%
metadata-eval52.7%
Applied egg-rr52.7%
metadata-eval52.7%
sqrt-pow252.7%
inv-pow52.7%
un-div-inv52.8%
div-inv52.9%
clear-num52.9%
Applied egg-rr52.9%
add-sqr-sqrt30.7%
sqrt-unprod31.0%
frac-times30.4%
add-sqr-sqrt30.4%
*-commutative30.4%
associate-*l/25.1%
associate-*r/30.4%
add-sqr-sqrt30.4%
frac-times31.0%
sqrt-unprod30.7%
add-sqr-sqrt52.8%
*-un-lft-identity52.8%
sqrt-prod66.3%
times-frac66.5%
Applied egg-rr66.5%
associate-*r/66.5%
associate-*l/66.4%
*-lft-identity66.4%
Simplified66.4%
Final simplification89.1%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= A -1e-310) (/ (/ c0 (sqrt l)) (/ (sqrt (- V)) (sqrt (- A)))) (* c0 (/ (sqrt A) (sqrt (* l V))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (A <= -1e-310) {
tmp = (c0 / sqrt(l)) / (sqrt(-V) / sqrt(-A));
} else {
tmp = c0 * (sqrt(A) / sqrt((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 (a <= (-1d-310)) then
tmp = (c0 / sqrt(l)) / (sqrt(-v) / sqrt(-a))
else
tmp = c0 * (sqrt(a) / sqrt((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 (A <= -1e-310) {
tmp = (c0 / Math.sqrt(l)) / (Math.sqrt(-V) / Math.sqrt(-A));
} else {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((l * V)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if A <= -1e-310: tmp = (c0 / math.sqrt(l)) / (math.sqrt(-V) / math.sqrt(-A)) else: tmp = c0 * (math.sqrt(A) / math.sqrt((l * V))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (A <= -1e-310) tmp = Float64(Float64(c0 / sqrt(l)) / Float64(sqrt(Float64(-V)) / sqrt(Float64(-A)))); else tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(l * V)))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (A <= -1e-310)
tmp = (c0 / sqrt(l)) / (sqrt(-V) / sqrt(-A));
else
tmp = c0 * (sqrt(A) / sqrt((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[A, -1e-310], N[(N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[(-V)], $MachinePrecision] / N[Sqrt[(-A)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\frac{c0}{\sqrt{\ell}}}{\frac{\sqrt{-V}}{\sqrt{-A}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{\ell \cdot V}}\\
\end{array}
\end{array}
if A < -9.999999999999969e-311Initial program 79.0%
pow1/279.0%
clear-num78.8%
inv-pow78.8%
pow-pow80.5%
associate-/l*78.1%
metadata-eval78.1%
Applied egg-rr78.1%
metadata-eval78.1%
sqrt-pow278.0%
inv-pow78.0%
un-div-inv78.2%
div-inv78.1%
clear-num78.5%
Applied egg-rr78.5%
add-sqr-sqrt42.2%
sqrt-unprod37.8%
frac-times29.3%
add-sqr-sqrt29.4%
*-commutative29.4%
associate-*l/30.7%
associate-*r/28.5%
add-sqr-sqrt28.5%
frac-times37.0%
sqrt-unprod40.9%
add-sqr-sqrt79.1%
*-un-lft-identity79.1%
sqrt-prod39.2%
times-frac37.0%
Applied egg-rr37.0%
associate-*r/39.2%
associate-*l/39.1%
*-lft-identity39.1%
Simplified39.1%
frac-2neg39.1%
sqrt-div43.1%
Applied egg-rr43.1%
if -9.999999999999969e-311 < A Initial program 74.4%
sqrt-div85.3%
associate-*r/83.8%
Applied egg-rr83.8%
*-commutative83.8%
associate-*l/85.3%
Simplified85.3%
Final simplification64.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 (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
(if (<= (* l V) -2e+147)
t_0
(if (<= (* l V) -5e-198)
(/ c0 (sqrt (/ (* l V) A)))
(if (or (<= (* l V) 0.0) (not (<= (* l V) 5e+283)))
t_0
(* (sqrt A) (/ c0 (sqrt (* l V)))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 * (sqrt((A / V)) / sqrt(l));
double tmp;
if ((l * V) <= -2e+147) {
tmp = t_0;
} else if ((l * V) <= -5e-198) {
tmp = c0 / sqrt(((l * V) / A));
} else if (((l * V) <= 0.0) || !((l * V) <= 5e+283)) {
tmp = t_0;
} else {
tmp = sqrt(A) * (c0 / sqrt((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) :: t_0
real(8) :: tmp
t_0 = c0 * (sqrt((a / v)) / sqrt(l))
if ((l * v) <= (-2d+147)) then
tmp = t_0
else if ((l * v) <= (-5d-198)) then
tmp = c0 / sqrt(((l * v) / a))
else if (((l * v) <= 0.0d0) .or. (.not. ((l * v) <= 5d+283))) then
tmp = t_0
else
tmp = sqrt(a) * (c0 / sqrt((l * v)))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
double tmp;
if ((l * V) <= -2e+147) {
tmp = t_0;
} else if ((l * V) <= -5e-198) {
tmp = c0 / Math.sqrt(((l * V) / A));
} else if (((l * V) <= 0.0) || !((l * V) <= 5e+283)) {
tmp = t_0;
} else {
tmp = Math.sqrt(A) * (c0 / Math.sqrt((l * V)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = c0 * (math.sqrt((A / V)) / math.sqrt(l)) tmp = 0 if (l * V) <= -2e+147: tmp = t_0 elif (l * V) <= -5e-198: tmp = c0 / math.sqrt(((l * V) / A)) elif ((l * V) <= 0.0) or not ((l * V) <= 5e+283): tmp = t_0 else: tmp = math.sqrt(A) * (c0 / math.sqrt((l * V))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))) tmp = 0.0 if (Float64(l * V) <= -2e+147) tmp = t_0; elseif (Float64(l * V) <= -5e-198) tmp = Float64(c0 / sqrt(Float64(Float64(l * V) / A))); elseif ((Float64(l * V) <= 0.0) || !(Float64(l * V) <= 5e+283)) tmp = t_0; else tmp = Float64(sqrt(A) * Float64(c0 / sqrt(Float64(l * V)))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = c0 * (sqrt((A / V)) / sqrt(l));
tmp = 0.0;
if ((l * V) <= -2e+147)
tmp = t_0;
elseif ((l * V) <= -5e-198)
tmp = c0 / sqrt(((l * V) / A));
elseif (((l * V) <= 0.0) || ~(((l * V) <= 5e+283)))
tmp = t_0;
else
tmp = sqrt(A) * (c0 / sqrt((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_] := Block[{t$95$0 = N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(l * V), $MachinePrecision], -2e+147], t$95$0, If[LessEqual[N[(l * V), $MachinePrecision], -5e-198], N[(c0 / N[Sqrt[N[(N[(l * V), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(l * V), $MachinePrecision], 0.0], N[Not[LessEqual[N[(l * V), $MachinePrecision], 5e+283]], $MachinePrecision]], t$95$0, N[(N[Sqrt[A], $MachinePrecision] * N[(c0 / N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{if}\;\ell \cdot V \leq -2 \cdot 10^{+147}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \cdot V \leq -5 \cdot 10^{-198}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell \cdot V}{A}}}\\
\mathbf{elif}\;\ell \cdot V \leq 0 \lor \neg \left(\ell \cdot V \leq 5 \cdot 10^{+283}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{A} \cdot \frac{c0}{\sqrt{\ell \cdot V}}\\
\end{array}
\end{array}
if (*.f64 V l) < -2e147 or -4.9999999999999999e-198 < (*.f64 V l) < -0.0 or 5.0000000000000004e283 < (*.f64 V l) Initial program 54.4%
associate-/r*63.9%
sqrt-div44.0%
Applied egg-rr44.0%
if -2e147 < (*.f64 V l) < -4.9999999999999999e-198Initial program 94.1%
pow1/294.1%
clear-num93.8%
inv-pow93.8%
pow-pow96.2%
associate-/l*84.6%
metadata-eval84.6%
Applied egg-rr84.6%
metadata-eval84.6%
sqrt-pow284.5%
inv-pow84.5%
un-div-inv84.6%
div-inv84.5%
clear-num85.2%
Applied egg-rr85.2%
*-commutative85.2%
associate-*l/96.2%
associate-*r/86.5%
Simplified86.5%
associate-*r/96.2%
Applied egg-rr96.2%
if -0.0 < (*.f64 V l) < 5.0000000000000004e283Initial program 86.5%
sqrt-div99.4%
associate-*r/97.5%
Applied egg-rr97.5%
associate-*l/96.5%
Simplified96.5%
Final simplification77.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 (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
(if (<= (* l V) -2e+147)
t_0
(if (<= (* l V) -5e-198)
(/ c0 (sqrt (/ (* l V) A)))
(if (or (<= (* l V) 0.0) (not (<= (* l V) 5e+283)))
t_0
(* c0 (/ (sqrt A) (sqrt (* l V)))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 * (sqrt((A / V)) / sqrt(l));
double tmp;
if ((l * V) <= -2e+147) {
tmp = t_0;
} else if ((l * V) <= -5e-198) {
tmp = c0 / sqrt(((l * V) / A));
} else if (((l * V) <= 0.0) || !((l * V) <= 5e+283)) {
tmp = t_0;
} else {
tmp = c0 * (sqrt(A) / sqrt((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) :: t_0
real(8) :: tmp
t_0 = c0 * (sqrt((a / v)) / sqrt(l))
if ((l * v) <= (-2d+147)) then
tmp = t_0
else if ((l * v) <= (-5d-198)) then
tmp = c0 / sqrt(((l * v) / a))
else if (((l * v) <= 0.0d0) .or. (.not. ((l * v) <= 5d+283))) then
tmp = t_0
else
tmp = c0 * (sqrt(a) / sqrt((l * v)))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
double tmp;
if ((l * V) <= -2e+147) {
tmp = t_0;
} else if ((l * V) <= -5e-198) {
tmp = c0 / Math.sqrt(((l * V) / A));
} else if (((l * V) <= 0.0) || !((l * V) <= 5e+283)) {
tmp = t_0;
} else {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((l * V)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = c0 * (math.sqrt((A / V)) / math.sqrt(l)) tmp = 0 if (l * V) <= -2e+147: tmp = t_0 elif (l * V) <= -5e-198: tmp = c0 / math.sqrt(((l * V) / A)) elif ((l * V) <= 0.0) or not ((l * V) <= 5e+283): tmp = t_0 else: tmp = c0 * (math.sqrt(A) / math.sqrt((l * V))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))) tmp = 0.0 if (Float64(l * V) <= -2e+147) tmp = t_0; elseif (Float64(l * V) <= -5e-198) tmp = Float64(c0 / sqrt(Float64(Float64(l * V) / A))); elseif ((Float64(l * V) <= 0.0) || !(Float64(l * V) <= 5e+283)) tmp = t_0; else tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(l * V)))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = c0 * (sqrt((A / V)) / sqrt(l));
tmp = 0.0;
if ((l * V) <= -2e+147)
tmp = t_0;
elseif ((l * V) <= -5e-198)
tmp = c0 / sqrt(((l * V) / A));
elseif (((l * V) <= 0.0) || ~(((l * V) <= 5e+283)))
tmp = t_0;
else
tmp = c0 * (sqrt(A) / sqrt((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_] := Block[{t$95$0 = N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(l * V), $MachinePrecision], -2e+147], t$95$0, If[LessEqual[N[(l * V), $MachinePrecision], -5e-198], N[(c0 / N[Sqrt[N[(N[(l * V), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(l * V), $MachinePrecision], 0.0], N[Not[LessEqual[N[(l * V), $MachinePrecision], 5e+283]], $MachinePrecision]], t$95$0, N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{if}\;\ell \cdot V \leq -2 \cdot 10^{+147}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \cdot V \leq -5 \cdot 10^{-198}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell \cdot V}{A}}}\\
\mathbf{elif}\;\ell \cdot V \leq 0 \lor \neg \left(\ell \cdot V \leq 5 \cdot 10^{+283}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{\ell \cdot V}}\\
\end{array}
\end{array}
if (*.f64 V l) < -2e147 or -4.9999999999999999e-198 < (*.f64 V l) < -0.0 or 5.0000000000000004e283 < (*.f64 V l) Initial program 54.4%
associate-/r*63.9%
sqrt-div44.0%
Applied egg-rr44.0%
if -2e147 < (*.f64 V l) < -4.9999999999999999e-198Initial program 94.1%
pow1/294.1%
clear-num93.8%
inv-pow93.8%
pow-pow96.2%
associate-/l*84.6%
metadata-eval84.6%
Applied egg-rr84.6%
metadata-eval84.6%
sqrt-pow284.5%
inv-pow84.5%
un-div-inv84.6%
div-inv84.5%
clear-num85.2%
Applied egg-rr85.2%
*-commutative85.2%
associate-*l/96.2%
associate-*r/86.5%
Simplified86.5%
associate-*r/96.2%
Applied egg-rr96.2%
if -0.0 < (*.f64 V l) < 5.0000000000000004e283Initial program 86.5%
sqrt-div99.4%
associate-*r/97.5%
Applied egg-rr97.5%
*-commutative97.5%
associate-*l/99.4%
Simplified99.4%
Final simplification78.5%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (sqrt (/ A V))) (t_1 (* c0 (/ t_0 (sqrt l)))))
(if (<= (* l V) -2e+147)
t_1
(if (<= (* l V) -5e-198)
(/ c0 (sqrt (/ (* l V) A)))
(if (<= (* l V) 0.0)
t_1
(if (<= (* l V) 5e+283)
(* c0 (/ (sqrt A) (sqrt (* l V))))
(/ (* c0 t_0) (sqrt l))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = sqrt((A / V));
double t_1 = c0 * (t_0 / sqrt(l));
double tmp;
if ((l * V) <= -2e+147) {
tmp = t_1;
} else if ((l * V) <= -5e-198) {
tmp = c0 / sqrt(((l * V) / A));
} else if ((l * V) <= 0.0) {
tmp = t_1;
} else if ((l * V) <= 5e+283) {
tmp = c0 * (sqrt(A) / sqrt((l * V)));
} else {
tmp = (c0 * t_0) / 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((a / v))
t_1 = c0 * (t_0 / sqrt(l))
if ((l * v) <= (-2d+147)) then
tmp = t_1
else if ((l * v) <= (-5d-198)) then
tmp = c0 / sqrt(((l * v) / a))
else if ((l * v) <= 0.0d0) then
tmp = t_1
else if ((l * v) <= 5d+283) then
tmp = c0 * (sqrt(a) / sqrt((l * v)))
else
tmp = (c0 * t_0) / sqrt(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 = Math.sqrt((A / V));
double t_1 = c0 * (t_0 / Math.sqrt(l));
double tmp;
if ((l * V) <= -2e+147) {
tmp = t_1;
} else if ((l * V) <= -5e-198) {
tmp = c0 / Math.sqrt(((l * V) / A));
} else if ((l * V) <= 0.0) {
tmp = t_1;
} else if ((l * V) <= 5e+283) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((l * V)));
} else {
tmp = (c0 * t_0) / Math.sqrt(l);
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = math.sqrt((A / V)) t_1 = c0 * (t_0 / math.sqrt(l)) tmp = 0 if (l * V) <= -2e+147: tmp = t_1 elif (l * V) <= -5e-198: tmp = c0 / math.sqrt(((l * V) / A)) elif (l * V) <= 0.0: tmp = t_1 elif (l * V) <= 5e+283: tmp = c0 * (math.sqrt(A) / math.sqrt((l * V))) else: tmp = (c0 * t_0) / math.sqrt(l) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = sqrt(Float64(A / V)) t_1 = Float64(c0 * Float64(t_0 / sqrt(l))) tmp = 0.0 if (Float64(l * V) <= -2e+147) tmp = t_1; elseif (Float64(l * V) <= -5e-198) tmp = Float64(c0 / sqrt(Float64(Float64(l * V) / A))); elseif (Float64(l * V) <= 0.0) tmp = t_1; elseif (Float64(l * V) <= 5e+283) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(l * V)))); else tmp = Float64(Float64(c0 * t_0) / sqrt(l)); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = sqrt((A / V));
t_1 = c0 * (t_0 / sqrt(l));
tmp = 0.0;
if ((l * V) <= -2e+147)
tmp = t_1;
elseif ((l * V) <= -5e-198)
tmp = c0 / sqrt(((l * V) / A));
elseif ((l * V) <= 0.0)
tmp = t_1;
elseif ((l * V) <= 5e+283)
tmp = c0 * (sqrt(A) / sqrt((l * V)));
else
tmp = (c0 * t_0) / 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_] := Block[{t$95$0 = N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(c0 * N[(t$95$0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(l * V), $MachinePrecision], -2e+147], t$95$1, If[LessEqual[N[(l * V), $MachinePrecision], -5e-198], N[(c0 / N[Sqrt[N[(N[(l * V), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(l * V), $MachinePrecision], 0.0], t$95$1, If[LessEqual[N[(l * V), $MachinePrecision], 5e+283], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c0 * t$95$0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{A}{V}}\\
t_1 := c0 \cdot \frac{t_0}{\sqrt{\ell}}\\
\mathbf{if}\;\ell \cdot V \leq -2 \cdot 10^{+147}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \cdot V \leq -5 \cdot 10^{-198}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell \cdot V}{A}}}\\
\mathbf{elif}\;\ell \cdot V \leq 0:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \cdot V \leq 5 \cdot 10^{+283}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{\ell \cdot V}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot t_0}{\sqrt{\ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -2e147 or -4.9999999999999999e-198 < (*.f64 V l) < -0.0Initial program 59.9%
associate-/r*66.6%
sqrt-div38.6%
Applied egg-rr38.6%
if -2e147 < (*.f64 V l) < -4.9999999999999999e-198Initial program 94.1%
pow1/294.1%
clear-num93.8%
inv-pow93.8%
pow-pow96.2%
associate-/l*84.6%
metadata-eval84.6%
Applied egg-rr84.6%
metadata-eval84.6%
sqrt-pow284.5%
inv-pow84.5%
un-div-inv84.6%
div-inv84.5%
clear-num85.2%
Applied egg-rr85.2%
*-commutative85.2%
associate-*l/96.2%
associate-*r/86.5%
Simplified86.5%
associate-*r/96.2%
Applied egg-rr96.2%
if -0.0 < (*.f64 V l) < 5.0000000000000004e283Initial program 86.5%
sqrt-div99.4%
associate-*r/97.5%
Applied egg-rr97.5%
*-commutative97.5%
associate-*l/99.4%
Simplified99.4%
if 5.0000000000000004e283 < (*.f64 V l) Initial program 31.3%
pow1/231.3%
clear-num31.3%
inv-pow31.3%
pow-pow31.3%
associate-/l*52.7%
metadata-eval52.7%
Applied egg-rr52.7%
metadata-eval52.7%
sqrt-pow252.7%
inv-pow52.7%
un-div-inv52.8%
div-inv52.9%
clear-num52.9%
Applied egg-rr52.9%
*-commutative52.9%
associate-*l/31.3%
associate-*r/52.8%
Simplified52.8%
associate-*r/31.3%
Applied egg-rr31.3%
/-rgt-identity31.3%
div-inv31.3%
metadata-eval31.3%
associate-/l*52.8%
div-inv52.9%
clear-num52.8%
sqrt-prod66.3%
frac-times66.4%
metadata-eval66.4%
sqrt-div66.4%
clear-num66.3%
Applied egg-rr66.3%
associate-*l/66.2%
Simplified66.2%
Final simplification78.5%
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 (/ A V)) (sqrt l)))))
(if (<= (* l V) -2e+147)
t_0
(if (<= (* l V) -5e-198)
(/ c0 (sqrt (/ (* l V) A)))
(if (<= (* l V) 0.0)
t_0
(if (<= (* l V) 5e+283)
(* c0 (/ (sqrt A) (sqrt (* l V))))
(/ (/ c0 (sqrt l)) (sqrt (/ V A)))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 * (sqrt((A / V)) / sqrt(l));
double tmp;
if ((l * V) <= -2e+147) {
tmp = t_0;
} else if ((l * V) <= -5e-198) {
tmp = c0 / sqrt(((l * V) / A));
} else if ((l * V) <= 0.0) {
tmp = t_0;
} else if ((l * V) <= 5e+283) {
tmp = c0 * (sqrt(A) / sqrt((l * V)));
} else {
tmp = (c0 / sqrt(l)) / sqrt((V / 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 = c0 * (sqrt((a / v)) / sqrt(l))
if ((l * v) <= (-2d+147)) then
tmp = t_0
else if ((l * v) <= (-5d-198)) then
tmp = c0 / sqrt(((l * v) / a))
else if ((l * v) <= 0.0d0) then
tmp = t_0
else if ((l * v) <= 5d+283) then
tmp = c0 * (sqrt(a) / sqrt((l * v)))
else
tmp = (c0 / sqrt(l)) / sqrt((v / 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 = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
double tmp;
if ((l * V) <= -2e+147) {
tmp = t_0;
} else if ((l * V) <= -5e-198) {
tmp = c0 / Math.sqrt(((l * V) / A));
} else if ((l * V) <= 0.0) {
tmp = t_0;
} else if ((l * V) <= 5e+283) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((l * V)));
} else {
tmp = (c0 / Math.sqrt(l)) / Math.sqrt((V / A));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = c0 * (math.sqrt((A / V)) / math.sqrt(l)) tmp = 0 if (l * V) <= -2e+147: tmp = t_0 elif (l * V) <= -5e-198: tmp = c0 / math.sqrt(((l * V) / A)) elif (l * V) <= 0.0: tmp = t_0 elif (l * V) <= 5e+283: tmp = c0 * (math.sqrt(A) / math.sqrt((l * V))) else: tmp = (c0 / math.sqrt(l)) / math.sqrt((V / A)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))) tmp = 0.0 if (Float64(l * V) <= -2e+147) tmp = t_0; elseif (Float64(l * V) <= -5e-198) tmp = Float64(c0 / sqrt(Float64(Float64(l * V) / A))); elseif (Float64(l * V) <= 0.0) tmp = t_0; elseif (Float64(l * V) <= 5e+283) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(l * V)))); else tmp = Float64(Float64(c0 / sqrt(l)) / sqrt(Float64(V / A))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = c0 * (sqrt((A / V)) / sqrt(l));
tmp = 0.0;
if ((l * V) <= -2e+147)
tmp = t_0;
elseif ((l * V) <= -5e-198)
tmp = c0 / sqrt(((l * V) / A));
elseif ((l * V) <= 0.0)
tmp = t_0;
elseif ((l * V) <= 5e+283)
tmp = c0 * (sqrt(A) / sqrt((l * V)));
else
tmp = (c0 / sqrt(l)) / sqrt((V / 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[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(l * V), $MachinePrecision], -2e+147], t$95$0, If[LessEqual[N[(l * V), $MachinePrecision], -5e-198], N[(c0 / N[Sqrt[N[(N[(l * V), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(l * V), $MachinePrecision], 0.0], t$95$0, If[LessEqual[N[(l * V), $MachinePrecision], 5e+283], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(V / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{if}\;\ell \cdot V \leq -2 \cdot 10^{+147}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \cdot V \leq -5 \cdot 10^{-198}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell \cdot V}{A}}}\\
\mathbf{elif}\;\ell \cdot V \leq 0:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \cdot V \leq 5 \cdot 10^{+283}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{\ell \cdot V}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{c0}{\sqrt{\ell}}}{\sqrt{\frac{V}{A}}}\\
\end{array}
\end{array}
if (*.f64 V l) < -2e147 or -4.9999999999999999e-198 < (*.f64 V l) < -0.0Initial program 59.9%
associate-/r*66.6%
sqrt-div38.6%
Applied egg-rr38.6%
if -2e147 < (*.f64 V l) < -4.9999999999999999e-198Initial program 94.1%
pow1/294.1%
clear-num93.8%
inv-pow93.8%
pow-pow96.2%
associate-/l*84.6%
metadata-eval84.6%
Applied egg-rr84.6%
metadata-eval84.6%
sqrt-pow284.5%
inv-pow84.5%
un-div-inv84.6%
div-inv84.5%
clear-num85.2%
Applied egg-rr85.2%
*-commutative85.2%
associate-*l/96.2%
associate-*r/86.5%
Simplified86.5%
associate-*r/96.2%
Applied egg-rr96.2%
if -0.0 < (*.f64 V l) < 5.0000000000000004e283Initial program 86.5%
sqrt-div99.4%
associate-*r/97.5%
Applied egg-rr97.5%
*-commutative97.5%
associate-*l/99.4%
Simplified99.4%
if 5.0000000000000004e283 < (*.f64 V l) Initial program 31.3%
pow1/231.3%
clear-num31.3%
inv-pow31.3%
pow-pow31.3%
associate-/l*52.7%
metadata-eval52.7%
Applied egg-rr52.7%
metadata-eval52.7%
sqrt-pow252.7%
inv-pow52.7%
un-div-inv52.8%
div-inv52.9%
clear-num52.9%
Applied egg-rr52.9%
add-sqr-sqrt30.7%
sqrt-unprod31.0%
frac-times30.4%
add-sqr-sqrt30.4%
*-commutative30.4%
associate-*l/25.1%
associate-*r/30.4%
add-sqr-sqrt30.4%
frac-times31.0%
sqrt-unprod30.7%
add-sqr-sqrt52.8%
*-un-lft-identity52.8%
sqrt-prod66.3%
times-frac66.5%
Applied egg-rr66.5%
associate-*r/66.5%
associate-*l/66.4%
*-lft-identity66.4%
Simplified66.4%
Final simplification78.5%
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 (* l V))))
(if (or (<= t_0 5e-313) (not (<= t_0 2e+297)))
(* c0 (/ (sqrt (/ A V)) (sqrt l)))
(/ c0 (sqrt (/ (* l V) A))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (l * V);
double tmp;
if ((t_0 <= 5e-313) || !(t_0 <= 2e+297)) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else {
tmp = c0 / sqrt(((l * V) / 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 / (l * v)
if ((t_0 <= 5d-313) .or. (.not. (t_0 <= 2d+297))) then
tmp = c0 * (sqrt((a / v)) / sqrt(l))
else
tmp = c0 / sqrt(((l * v) / 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 / (l * V);
double tmp;
if ((t_0 <= 5e-313) || !(t_0 <= 2e+297)) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else {
tmp = c0 / Math.sqrt(((l * V) / A));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = A / (l * V) tmp = 0 if (t_0 <= 5e-313) or not (t_0 <= 2e+297): tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) else: tmp = c0 / math.sqrt(((l * V) / A)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(l * V)) tmp = 0.0 if ((t_0 <= 5e-313) || !(t_0 <= 2e+297)) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); else tmp = Float64(c0 / sqrt(Float64(Float64(l * V) / A))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (l * V);
tmp = 0.0;
if ((t_0 <= 5e-313) || ~((t_0 <= 2e+297)))
tmp = c0 * (sqrt((A / V)) / sqrt(l));
else
tmp = c0 / sqrt(((l * V) / 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[(l * V), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, 5e-313], N[Not[LessEqual[t$95$0, 2e+297]], $MachinePrecision]], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(N[(l * V), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{\ell \cdot V}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-313} \lor \neg \left(t_0 \leq 2 \cdot 10^{+297}\right):\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell \cdot V}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 5.00000000002e-313 or 2e297 < (/.f64 A (*.f64 V l)) Initial program 37.5%
associate-/r*46.7%
sqrt-div46.8%
Applied egg-rr46.8%
if 5.00000000002e-313 < (/.f64 A (*.f64 V l)) < 2e297Initial program 99.5%
pow1/299.5%
clear-num99.5%
inv-pow99.5%
pow-pow99.5%
associate-/l*91.9%
metadata-eval91.9%
Applied egg-rr91.9%
metadata-eval91.9%
sqrt-pow291.8%
inv-pow91.8%
un-div-inv92.0%
div-inv91.4%
clear-num91.7%
Applied egg-rr91.7%
*-commutative91.7%
associate-*l/99.7%
associate-*r/90.4%
Simplified90.4%
associate-*r/99.7%
Applied egg-rr99.7%
Final simplification80.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 (* l V))))
(if (or (<= t_0 0.0) (not (<= t_0 2e+297)))
(/ c0 (sqrt (* V (/ l A))))
(* c0 (sqrt t_0)))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (l * V);
double tmp;
if ((t_0 <= 0.0) || !(t_0 <= 2e+297)) {
tmp = c0 / sqrt((V * (l / A)));
} 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 / (l * v)
if ((t_0 <= 0.0d0) .or. (.not. (t_0 <= 2d+297))) then
tmp = c0 / sqrt((v * (l / a)))
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 / (l * V);
double tmp;
if ((t_0 <= 0.0) || !(t_0 <= 2e+297)) {
tmp = c0 / Math.sqrt((V * (l / A)));
} else {
tmp = c0 * Math.sqrt(t_0);
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = A / (l * V) tmp = 0 if (t_0 <= 0.0) or not (t_0 <= 2e+297): tmp = c0 / math.sqrt((V * (l / A))) 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(l * V)) tmp = 0.0 if ((t_0 <= 0.0) || !(t_0 <= 2e+297)) tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); 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 / (l * V);
tmp = 0.0;
if ((t_0 <= 0.0) || ~((t_0 <= 2e+297)))
tmp = c0 / sqrt((V * (l / A)));
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[(l * V), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 2e+297]], $MachinePrecision]], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $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}{\ell \cdot V}\\
\mathbf{if}\;t_0 \leq 0 \lor \neg \left(t_0 \leq 2 \cdot 10^{+297}\right):\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0 or 2e297 < (/.f64 A (*.f64 V l)) Initial program 36.7%
pow1/236.7%
clear-num36.7%
inv-pow36.7%
pow-pow39.1%
associate-/l*48.3%
metadata-eval48.3%
Applied egg-rr48.3%
metadata-eval48.3%
sqrt-pow248.3%
inv-pow48.3%
un-div-inv48.3%
div-inv48.3%
clear-num48.3%
Applied egg-rr48.3%
if 0.0 < (/.f64 A (*.f64 V l)) < 2e297Initial program 98.8%
Final simplification80.9%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* l V)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (l * V)));
}
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 / (l * v)))
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (l * V)));
}
[V, l] = sort([V, l]) def code(c0, A, V, l): return c0 * math.sqrt((A / (l * V)))
V, l = sort([V, l]) function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(l * V)))) end
V, l = num2cell(sort([V, l])){:}
function tmp = code(c0, A, V, l)
tmp = c0 * sqrt((A / (l * V)));
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[(l * V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
c0 \cdot \sqrt{\frac{A}{\ell \cdot V}}
\end{array}
Initial program 76.7%
Final simplification76.7%
herbie shell --seed 2023178
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))