
(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: c0, A, 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 (* (/ l A) V)))))
(if (<= (* V l) -4e+289)
(/ c0 (* (sqrt l) (sqrt (/ V A))))
(if (<= (* V l) -1e-226)
(* (sqrt (- A)) (/ c0 (sqrt (* (- l) V))))
(if (<= (* V l) 4e-200)
t_0
(if (<= (* V l) 2e+271) (* (/ (sqrt A) (sqrt (* V l))) c0) t_0))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 / sqrt(((l / A) * V));
double tmp;
if ((V * l) <= -4e+289) {
tmp = c0 / (sqrt(l) * sqrt((V / A)));
} else if ((V * l) <= -1e-226) {
tmp = sqrt(-A) * (c0 / sqrt((-l * V)));
} else if ((V * l) <= 4e-200) {
tmp = t_0;
} else if ((V * l) <= 2e+271) {
tmp = (sqrt(A) / sqrt((V * l))) * c0;
} else {
tmp = t_0;
}
return tmp;
}
NOTE: c0, A, 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(((l / a) * v))
if ((v * l) <= (-4d+289)) then
tmp = c0 / (sqrt(l) * sqrt((v / a)))
else if ((v * l) <= (-1d-226)) then
tmp = sqrt(-a) * (c0 / sqrt((-l * v)))
else if ((v * l) <= 4d-200) then
tmp = t_0
else if ((v * l) <= 2d+271) then
tmp = (sqrt(a) / sqrt((v * l))) * c0
else
tmp = t_0
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = c0 / Math.sqrt(((l / A) * V));
double tmp;
if ((V * l) <= -4e+289) {
tmp = c0 / (Math.sqrt(l) * Math.sqrt((V / A)));
} else if ((V * l) <= -1e-226) {
tmp = Math.sqrt(-A) * (c0 / Math.sqrt((-l * V)));
} else if ((V * l) <= 4e-200) {
tmp = t_0;
} else if ((V * l) <= 2e+271) {
tmp = (Math.sqrt(A) / Math.sqrt((V * l))) * c0;
} else {
tmp = t_0;
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = c0 / math.sqrt(((l / A) * V)) tmp = 0 if (V * l) <= -4e+289: tmp = c0 / (math.sqrt(l) * math.sqrt((V / A))) elif (V * l) <= -1e-226: tmp = math.sqrt(-A) * (c0 / math.sqrt((-l * V))) elif (V * l) <= 4e-200: tmp = t_0 elif (V * l) <= 2e+271: tmp = (math.sqrt(A) / math.sqrt((V * l))) * c0 else: tmp = t_0 return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(c0 / sqrt(Float64(Float64(l / A) * V))) tmp = 0.0 if (Float64(V * l) <= -4e+289) tmp = Float64(c0 / Float64(sqrt(l) * sqrt(Float64(V / A)))); elseif (Float64(V * l) <= -1e-226) tmp = Float64(sqrt(Float64(-A)) * Float64(c0 / sqrt(Float64(Float64(-l) * V)))); elseif (Float64(V * l) <= 4e-200) tmp = t_0; elseif (Float64(V * l) <= 2e+271) tmp = Float64(Float64(sqrt(A) / sqrt(Float64(V * l))) * c0); else tmp = t_0; end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = c0 / sqrt(((l / A) * V));
tmp = 0.0;
if ((V * l) <= -4e+289)
tmp = c0 / (sqrt(l) * sqrt((V / A)));
elseif ((V * l) <= -1e-226)
tmp = sqrt(-A) * (c0 / sqrt((-l * V)));
elseif ((V * l) <= 4e-200)
tmp = t_0;
elseif ((V * l) <= 2e+271)
tmp = (sqrt(A) / sqrt((V * l))) * c0;
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: c0, A, 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[Sqrt[N[(N[(l / A), $MachinePrecision] * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -4e+289], N[(c0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[N[(V / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-226], N[(N[Sqrt[(-A)], $MachinePrecision] * N[(c0 / N[Sqrt[N[((-l) * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e-200], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 2e+271], N[(N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{c0}{\sqrt{\frac{\ell}{A} \cdot V}}\\
\mathbf{if}\;V \cdot \ell \leq -4 \cdot 10^{+289}:\\
\;\;\;\;\frac{c0}{\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-226}:\\
\;\;\;\;\sqrt{-A} \cdot \frac{c0}{\sqrt{\left(-\ell\right) \cdot V}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{-200}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+271}:\\
\;\;\;\;\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 V l) < -4.0000000000000002e289Initial program 47.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.0
Applied rewrites81.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
frac-timesN/A
*-rgt-identityN/A
lift-sqrt.f64N/A
sqrt-prodN/A
clear-numN/A
lift-/.f64N/A
div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
Applied rewrites81.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
sqrt-prodN/A
lift-sqrt.f64N/A
pow1/2N/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-/.f6430.2
Applied rewrites30.2%
if -4.0000000000000002e289 < (*.f64 V l) < -9.99999999999999921e-227Initial program 89.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6474.2
Applied rewrites74.2%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
frac-timesN/A
*-rgt-identityN/A
lift-sqrt.f64N/A
sqrt-prodN/A
clear-numN/A
lift-/.f64N/A
div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
Applied rewrites81.1%
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
frac-2negN/A
sqrt-divN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6499.4
Applied rewrites99.4%
if -9.99999999999999921e-227 < (*.f64 V l) < 3.9999999999999999e-200 or 1.99999999999999991e271 < (*.f64 V l) Initial program 50.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6477.8
Applied rewrites77.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
frac-timesN/A
*-rgt-identityN/A
lift-sqrt.f64N/A
sqrt-prodN/A
clear-numN/A
lift-/.f64N/A
div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
Applied rewrites74.1%
if 3.9999999999999999e-200 < (*.f64 V l) < 1.99999999999999991e271Initial program 83.4%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6499.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
Final simplification86.2%
NOTE: c0, A, 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 l))) c0)))
(if (<= t_0 0.0)
(* (sqrt (/ (/ A l) V)) c0)
(if (<= t_0 1e+137) t_0 (/ c0 (sqrt (* (/ l A) V)))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = sqrt((A / (V * l))) * c0;
double tmp;
if (t_0 <= 0.0) {
tmp = sqrt(((A / l) / V)) * c0;
} else if (t_0 <= 1e+137) {
tmp = t_0;
} else {
tmp = c0 / sqrt(((l / A) * V));
}
return tmp;
}
NOTE: c0, A, 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 = sqrt((a / (v * l))) * c0
if (t_0 <= 0.0d0) then
tmp = sqrt(((a / l) / v)) * c0
else if (t_0 <= 1d+137) then
tmp = t_0
else
tmp = c0 / sqrt(((l / a) * v))
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = Math.sqrt((A / (V * l))) * c0;
double tmp;
if (t_0 <= 0.0) {
tmp = Math.sqrt(((A / l) / V)) * c0;
} else if (t_0 <= 1e+137) {
tmp = t_0;
} else {
tmp = c0 / Math.sqrt(((l / A) * V));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = math.sqrt((A / (V * l))) * c0 tmp = 0 if t_0 <= 0.0: tmp = math.sqrt(((A / l) / V)) * c0 elif t_0 <= 1e+137: tmp = t_0 else: tmp = c0 / math.sqrt(((l / A) * V)) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(sqrt(Float64(A / Float64(V * l))) * c0) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(sqrt(Float64(Float64(A / l) / V)) * c0); elseif (t_0 <= 1e+137) tmp = t_0; else tmp = Float64(c0 / sqrt(Float64(Float64(l / A) * V))); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = sqrt((A / (V * l))) * c0;
tmp = 0.0;
if (t_0 <= 0.0)
tmp = sqrt(((A / l) / V)) * c0;
elseif (t_0 <= 1e+137)
tmp = t_0;
else
tmp = c0 / sqrt(((l / A) * V));
end
tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision], If[LessEqual[t$95$0, 1e+137], t$95$0, N[(c0 / N[Sqrt[N[(N[(l / A), $MachinePrecision] * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{A}{V \cdot \ell}} \cdot c0\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\sqrt{\frac{\frac{A}{\ell}}{V}} \cdot c0\\
\mathbf{elif}\;t\_0 \leq 10^{+137}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{A} \cdot V}}\\
\end{array}
\end{array}
if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 0.0Initial program 66.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-/.f6475.2
Applied rewrites75.2%
if 0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1e137Initial program 97.5%
if 1e137 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) Initial program 58.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6475.1
Applied rewrites75.1%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
frac-timesN/A
*-rgt-identityN/A
lift-sqrt.f64N/A
sqrt-prodN/A
clear-numN/A
lift-/.f64N/A
div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
Applied rewrites73.3%
Final simplification80.0%
NOTE: c0, A, 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 l))) c0)) (t_1 (* (sqrt (/ (/ A l) V)) c0))) (if (<= t_0 0.0) t_1 (if (<= t_0 1e+143) t_0 t_1))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = sqrt((A / (V * l))) * c0;
double t_1 = sqrt(((A / l) / V)) * c0;
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 1e+143) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: c0, A, 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 * l))) * c0
t_1 = sqrt(((a / l) / v)) * c0
if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 1d+143) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = Math.sqrt((A / (V * l))) * c0;
double t_1 = Math.sqrt(((A / l) / V)) * c0;
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 1e+143) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = math.sqrt((A / (V * l))) * c0 t_1 = math.sqrt(((A / l) / V)) * c0 tmp = 0 if t_0 <= 0.0: tmp = t_1 elif t_0 <= 1e+143: tmp = t_0 else: tmp = t_1 return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(sqrt(Float64(A / Float64(V * l))) * c0) t_1 = Float64(sqrt(Float64(Float64(A / l) / V)) * c0) tmp = 0.0 if (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 1e+143) tmp = t_0; else tmp = t_1; end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = sqrt((A / (V * l))) * c0;
t_1 = sqrt(((A / l) / V)) * c0;
tmp = 0.0;
if (t_0 <= 0.0)
tmp = t_1;
elseif (t_0 <= 1e+143)
tmp = t_0;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 1e+143], t$95$0, t$95$1]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{A}{V \cdot \ell}} \cdot c0\\
t_1 := \sqrt{\frac{\frac{A}{\ell}}{V}} \cdot c0\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+143}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 0.0 or 1e143 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) Initial program 64.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-/.f6474.0
Applied rewrites74.0%
if 0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1e143Initial program 97.5%
Final simplification79.5%
NOTE: c0, A, 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 (* (/ l A) V)))))
(if (<= (* V l) (- INFINITY))
(* (sqrt (/ A V)) (/ c0 (sqrt l)))
(if (<= (* V l) -1e-226)
(* (sqrt (- A)) (/ c0 (sqrt (* (- l) V))))
(if (<= (* V l) 4e-200)
t_0
(if (<= (* V l) 2e+271) (* (/ (sqrt A) (sqrt (* V l))) c0) t_0))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 / sqrt(((l / A) * V));
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = sqrt((A / V)) * (c0 / sqrt(l));
} else if ((V * l) <= -1e-226) {
tmp = sqrt(-A) * (c0 / sqrt((-l * V)));
} else if ((V * l) <= 4e-200) {
tmp = t_0;
} else if ((V * l) <= 2e+271) {
tmp = (sqrt(A) / sqrt((V * l))) * c0;
} else {
tmp = t_0;
}
return tmp;
}
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = c0 / Math.sqrt(((l / A) * V));
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = Math.sqrt((A / V)) * (c0 / Math.sqrt(l));
} else if ((V * l) <= -1e-226) {
tmp = Math.sqrt(-A) * (c0 / Math.sqrt((-l * V)));
} else if ((V * l) <= 4e-200) {
tmp = t_0;
} else if ((V * l) <= 2e+271) {
tmp = (Math.sqrt(A) / Math.sqrt((V * l))) * c0;
} else {
tmp = t_0;
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = c0 / math.sqrt(((l / A) * V)) tmp = 0 if (V * l) <= -math.inf: tmp = math.sqrt((A / V)) * (c0 / math.sqrt(l)) elif (V * l) <= -1e-226: tmp = math.sqrt(-A) * (c0 / math.sqrt((-l * V))) elif (V * l) <= 4e-200: tmp = t_0 elif (V * l) <= 2e+271: tmp = (math.sqrt(A) / math.sqrt((V * l))) * c0 else: tmp = t_0 return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(c0 / sqrt(Float64(Float64(l / A) * V))) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(sqrt(Float64(A / V)) * Float64(c0 / sqrt(l))); elseif (Float64(V * l) <= -1e-226) tmp = Float64(sqrt(Float64(-A)) * Float64(c0 / sqrt(Float64(Float64(-l) * V)))); elseif (Float64(V * l) <= 4e-200) tmp = t_0; elseif (Float64(V * l) <= 2e+271) tmp = Float64(Float64(sqrt(A) / sqrt(Float64(V * l))) * c0); else tmp = t_0; end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = c0 / sqrt(((l / A) * V));
tmp = 0.0;
if ((V * l) <= -Inf)
tmp = sqrt((A / V)) * (c0 / sqrt(l));
elseif ((V * l) <= -1e-226)
tmp = sqrt(-A) * (c0 / sqrt((-l * V)));
elseif ((V * l) <= 4e-200)
tmp = t_0;
elseif ((V * l) <= 2e+271)
tmp = (sqrt(A) / sqrt((V * l))) * c0;
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: c0, A, 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[Sqrt[N[(N[(l / A), $MachinePrecision] * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-226], N[(N[Sqrt[(-A)], $MachinePrecision] * N[(c0 / N[Sqrt[N[((-l) * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e-200], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 2e+271], N[(N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{c0}{\sqrt{\frac{\ell}{A} \cdot V}}\\
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-226}:\\
\;\;\;\;\sqrt{-A} \cdot \frac{c0}{\sqrt{\left(-\ell\right) \cdot V}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{-200}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+271}:\\
\;\;\;\;\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 41.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
sqrt-divN/A
associate-*r/N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f6428.1
Applied rewrites28.1%
if -inf.0 < (*.f64 V l) < -9.99999999999999921e-227Initial program 89.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6474.8
Applied rewrites74.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
frac-timesN/A
*-rgt-identityN/A
lift-sqrt.f64N/A
sqrt-prodN/A
clear-numN/A
lift-/.f64N/A
div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
Applied rewrites81.6%
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
frac-2negN/A
sqrt-divN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6499.4
Applied rewrites99.4%
if -9.99999999999999921e-227 < (*.f64 V l) < 3.9999999999999999e-200 or 1.99999999999999991e271 < (*.f64 V l) Initial program 50.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6477.8
Applied rewrites77.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
frac-timesN/A
*-rgt-identityN/A
lift-sqrt.f64N/A
sqrt-prodN/A
clear-numN/A
lift-/.f64N/A
div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
Applied rewrites74.1%
if 3.9999999999999999e-200 < (*.f64 V l) < 1.99999999999999991e271Initial program 83.4%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6499.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
Final simplification86.6%
NOTE: c0, A, 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 (* (/ l A) V)))))
(if (<= (* V l) -4e+289)
(* (/ (sqrt (/ A V)) (sqrt l)) c0)
(if (<= (* V l) -1e-226)
(* (sqrt (- A)) (/ c0 (sqrt (* (- l) V))))
(if (<= (* V l) 4e-200)
t_0
(if (<= (* V l) 2e+271) (* (/ (sqrt A) (sqrt (* V l))) c0) t_0))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 / sqrt(((l / A) * V));
double tmp;
if ((V * l) <= -4e+289) {
tmp = (sqrt((A / V)) / sqrt(l)) * c0;
} else if ((V * l) <= -1e-226) {
tmp = sqrt(-A) * (c0 / sqrt((-l * V)));
} else if ((V * l) <= 4e-200) {
tmp = t_0;
} else if ((V * l) <= 2e+271) {
tmp = (sqrt(A) / sqrt((V * l))) * c0;
} else {
tmp = t_0;
}
return tmp;
}
NOTE: c0, A, 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(((l / a) * v))
if ((v * l) <= (-4d+289)) then
tmp = (sqrt((a / v)) / sqrt(l)) * c0
else if ((v * l) <= (-1d-226)) then
tmp = sqrt(-a) * (c0 / sqrt((-l * v)))
else if ((v * l) <= 4d-200) then
tmp = t_0
else if ((v * l) <= 2d+271) then
tmp = (sqrt(a) / sqrt((v * l))) * c0
else
tmp = t_0
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = c0 / Math.sqrt(((l / A) * V));
double tmp;
if ((V * l) <= -4e+289) {
tmp = (Math.sqrt((A / V)) / Math.sqrt(l)) * c0;
} else if ((V * l) <= -1e-226) {
tmp = Math.sqrt(-A) * (c0 / Math.sqrt((-l * V)));
} else if ((V * l) <= 4e-200) {
tmp = t_0;
} else if ((V * l) <= 2e+271) {
tmp = (Math.sqrt(A) / Math.sqrt((V * l))) * c0;
} else {
tmp = t_0;
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = c0 / math.sqrt(((l / A) * V)) tmp = 0 if (V * l) <= -4e+289: tmp = (math.sqrt((A / V)) / math.sqrt(l)) * c0 elif (V * l) <= -1e-226: tmp = math.sqrt(-A) * (c0 / math.sqrt((-l * V))) elif (V * l) <= 4e-200: tmp = t_0 elif (V * l) <= 2e+271: tmp = (math.sqrt(A) / math.sqrt((V * l))) * c0 else: tmp = t_0 return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(c0 / sqrt(Float64(Float64(l / A) * V))) tmp = 0.0 if (Float64(V * l) <= -4e+289) tmp = Float64(Float64(sqrt(Float64(A / V)) / sqrt(l)) * c0); elseif (Float64(V * l) <= -1e-226) tmp = Float64(sqrt(Float64(-A)) * Float64(c0 / sqrt(Float64(Float64(-l) * V)))); elseif (Float64(V * l) <= 4e-200) tmp = t_0; elseif (Float64(V * l) <= 2e+271) tmp = Float64(Float64(sqrt(A) / sqrt(Float64(V * l))) * c0); else tmp = t_0; end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = c0 / sqrt(((l / A) * V));
tmp = 0.0;
if ((V * l) <= -4e+289)
tmp = (sqrt((A / V)) / sqrt(l)) * c0;
elseif ((V * l) <= -1e-226)
tmp = sqrt(-A) * (c0 / sqrt((-l * V)));
elseif ((V * l) <= 4e-200)
tmp = t_0;
elseif ((V * l) <= 2e+271)
tmp = (sqrt(A) / sqrt((V * l))) * c0;
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: c0, A, 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[Sqrt[N[(N[(l / A), $MachinePrecision] * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -4e+289], N[(N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-226], N[(N[Sqrt[(-A)], $MachinePrecision] * N[(c0 / N[Sqrt[N[((-l) * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e-200], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 2e+271], N[(N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{c0}{\sqrt{\frac{\ell}{A} \cdot V}}\\
\mathbf{if}\;V \cdot \ell \leq -4 \cdot 10^{+289}:\\
\;\;\;\;\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}} \cdot c0\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-226}:\\
\;\;\;\;\sqrt{-A} \cdot \frac{c0}{\sqrt{\left(-\ell\right) \cdot V}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{-200}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+271}:\\
\;\;\;\;\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 V l) < -4.0000000000000002e289Initial program 47.5%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6430.2
Applied rewrites30.2%
if -4.0000000000000002e289 < (*.f64 V l) < -9.99999999999999921e-227Initial program 89.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6474.2
Applied rewrites74.2%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
frac-timesN/A
*-rgt-identityN/A
lift-sqrt.f64N/A
sqrt-prodN/A
clear-numN/A
lift-/.f64N/A
div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
Applied rewrites81.1%
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
frac-2negN/A
sqrt-divN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6499.4
Applied rewrites99.4%
if -9.99999999999999921e-227 < (*.f64 V l) < 3.9999999999999999e-200 or 1.99999999999999991e271 < (*.f64 V l) Initial program 50.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6477.8
Applied rewrites77.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
frac-timesN/A
*-rgt-identityN/A
lift-sqrt.f64N/A
sqrt-prodN/A
clear-numN/A
lift-/.f64N/A
div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
Applied rewrites74.1%
if 3.9999999999999999e-200 < (*.f64 V l) < 1.99999999999999991e271Initial program 83.4%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6499.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
Final simplification86.2%
NOTE: c0, A, 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 (* (/ l A) V)))))
(if (<= (* V l) -4e+289)
(* (sqrt (/ (/ A l) V)) c0)
(if (<= (* V l) -1e-226)
(* (sqrt (- A)) (/ c0 (sqrt (* (- l) V))))
(if (<= (* V l) 4e-200)
t_0
(if (<= (* V l) 2e+271) (* (/ (sqrt A) (sqrt (* V l))) c0) t_0))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 / sqrt(((l / A) * V));
double tmp;
if ((V * l) <= -4e+289) {
tmp = sqrt(((A / l) / V)) * c0;
} else if ((V * l) <= -1e-226) {
tmp = sqrt(-A) * (c0 / sqrt((-l * V)));
} else if ((V * l) <= 4e-200) {
tmp = t_0;
} else if ((V * l) <= 2e+271) {
tmp = (sqrt(A) / sqrt((V * l))) * c0;
} else {
tmp = t_0;
}
return tmp;
}
NOTE: c0, A, 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(((l / a) * v))
if ((v * l) <= (-4d+289)) then
tmp = sqrt(((a / l) / v)) * c0
else if ((v * l) <= (-1d-226)) then
tmp = sqrt(-a) * (c0 / sqrt((-l * v)))
else if ((v * l) <= 4d-200) then
tmp = t_0
else if ((v * l) <= 2d+271) then
tmp = (sqrt(a) / sqrt((v * l))) * c0
else
tmp = t_0
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = c0 / Math.sqrt(((l / A) * V));
double tmp;
if ((V * l) <= -4e+289) {
tmp = Math.sqrt(((A / l) / V)) * c0;
} else if ((V * l) <= -1e-226) {
tmp = Math.sqrt(-A) * (c0 / Math.sqrt((-l * V)));
} else if ((V * l) <= 4e-200) {
tmp = t_0;
} else if ((V * l) <= 2e+271) {
tmp = (Math.sqrt(A) / Math.sqrt((V * l))) * c0;
} else {
tmp = t_0;
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = c0 / math.sqrt(((l / A) * V)) tmp = 0 if (V * l) <= -4e+289: tmp = math.sqrt(((A / l) / V)) * c0 elif (V * l) <= -1e-226: tmp = math.sqrt(-A) * (c0 / math.sqrt((-l * V))) elif (V * l) <= 4e-200: tmp = t_0 elif (V * l) <= 2e+271: tmp = (math.sqrt(A) / math.sqrt((V * l))) * c0 else: tmp = t_0 return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(c0 / sqrt(Float64(Float64(l / A) * V))) tmp = 0.0 if (Float64(V * l) <= -4e+289) tmp = Float64(sqrt(Float64(Float64(A / l) / V)) * c0); elseif (Float64(V * l) <= -1e-226) tmp = Float64(sqrt(Float64(-A)) * Float64(c0 / sqrt(Float64(Float64(-l) * V)))); elseif (Float64(V * l) <= 4e-200) tmp = t_0; elseif (Float64(V * l) <= 2e+271) tmp = Float64(Float64(sqrt(A) / sqrt(Float64(V * l))) * c0); else tmp = t_0; end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = c0 / sqrt(((l / A) * V));
tmp = 0.0;
if ((V * l) <= -4e+289)
tmp = sqrt(((A / l) / V)) * c0;
elseif ((V * l) <= -1e-226)
tmp = sqrt(-A) * (c0 / sqrt((-l * V)));
elseif ((V * l) <= 4e-200)
tmp = t_0;
elseif ((V * l) <= 2e+271)
tmp = (sqrt(A) / sqrt((V * l))) * c0;
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: c0, A, 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[Sqrt[N[(N[(l / A), $MachinePrecision] * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -4e+289], N[(N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-226], N[(N[Sqrt[(-A)], $MachinePrecision] * N[(c0 / N[Sqrt[N[((-l) * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e-200], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 2e+271], N[(N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{c0}{\sqrt{\frac{\ell}{A} \cdot V}}\\
\mathbf{if}\;V \cdot \ell \leq -4 \cdot 10^{+289}:\\
\;\;\;\;\sqrt{\frac{\frac{A}{\ell}}{V}} \cdot c0\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-226}:\\
\;\;\;\;\sqrt{-A} \cdot \frac{c0}{\sqrt{\left(-\ell\right) \cdot V}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{-200}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+271}:\\
\;\;\;\;\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 V l) < -4.0000000000000002e289Initial program 47.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-/.f6481.2
Applied rewrites81.2%
if -4.0000000000000002e289 < (*.f64 V l) < -9.99999999999999921e-227Initial program 89.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6474.2
Applied rewrites74.2%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
frac-timesN/A
*-rgt-identityN/A
lift-sqrt.f64N/A
sqrt-prodN/A
clear-numN/A
lift-/.f64N/A
div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
Applied rewrites81.1%
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
frac-2negN/A
sqrt-divN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6499.4
Applied rewrites99.4%
if -9.99999999999999921e-227 < (*.f64 V l) < 3.9999999999999999e-200 or 1.99999999999999991e271 < (*.f64 V l) Initial program 50.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6477.8
Applied rewrites77.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
frac-timesN/A
*-rgt-identityN/A
lift-sqrt.f64N/A
sqrt-prodN/A
clear-numN/A
lift-/.f64N/A
div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
Applied rewrites74.1%
if 3.9999999999999999e-200 < (*.f64 V l) < 1.99999999999999991e271Initial program 83.4%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6499.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
Final simplification90.2%
NOTE: c0, A, 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))) (t_1 (* (sqrt (/ (/ A V) l)) c0))) (if (<= t_0 2e-220) t_1 (if (<= t_0 4e+289) (* (sqrt t_0) c0) t_1))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double t_1 = sqrt(((A / V) / l)) * c0;
double tmp;
if (t_0 <= 2e-220) {
tmp = t_1;
} else if (t_0 <= 4e+289) {
tmp = sqrt(t_0) * c0;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: c0, A, 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 = a / (v * l)
t_1 = sqrt(((a / v) / l)) * c0
if (t_0 <= 2d-220) then
tmp = t_1
else if (t_0 <= 4d+289) then
tmp = sqrt(t_0) * c0
else
tmp = t_1
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double t_1 = Math.sqrt(((A / V) / l)) * c0;
double tmp;
if (t_0 <= 2e-220) {
tmp = t_1;
} else if (t_0 <= 4e+289) {
tmp = Math.sqrt(t_0) * c0;
} else {
tmp = t_1;
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = A / (V * l) t_1 = math.sqrt(((A / V) / l)) * c0 tmp = 0 if t_0 <= 2e-220: tmp = t_1 elif t_0 <= 4e+289: tmp = math.sqrt(t_0) * c0 else: tmp = t_1 return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(V * l)) t_1 = Float64(sqrt(Float64(Float64(A / V) / l)) * c0) tmp = 0.0 if (t_0 <= 2e-220) tmp = t_1; elseif (t_0 <= 4e+289) tmp = Float64(sqrt(t_0) * c0); else tmp = t_1; end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (V * l);
t_1 = sqrt(((A / V) / l)) * c0;
tmp = 0.0;
if (t_0 <= 2e-220)
tmp = t_1;
elseif (t_0 <= 4e+289)
tmp = sqrt(t_0) * c0;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: c0, A, 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]}, Block[{t$95$1 = N[(N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-220], t$95$1, If[LessEqual[t$95$0, 4e+289], N[(N[Sqrt[t$95$0], $MachinePrecision] * c0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
t_1 := \sqrt{\frac{\frac{A}{V}}{\ell}} \cdot c0\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-220}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+289}:\\
\;\;\;\;\sqrt{t\_0} \cdot c0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 1.99999999999999998e-220 or 4.0000000000000002e289 < (/.f64 A (*.f64 V l)) Initial program 44.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6462.6
Applied rewrites62.6%
if 1.99999999999999998e-220 < (/.f64 A (*.f64 V l)) < 4.0000000000000002e289Initial program 97.6%
Final simplification80.9%
NOTE: c0, A, 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 (* (/ l A) V)))))
(if (<= (* V l) -2e-27)
(* (sqrt (/ (/ A V) l)) c0)
(if (<= (* V l) 4e-200)
t_0
(if (<= (* V l) 2e+271) (* (/ (sqrt A) (sqrt (* V l))) c0) t_0)))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 / sqrt(((l / A) * V));
double tmp;
if ((V * l) <= -2e-27) {
tmp = sqrt(((A / V) / l)) * c0;
} else if ((V * l) <= 4e-200) {
tmp = t_0;
} else if ((V * l) <= 2e+271) {
tmp = (sqrt(A) / sqrt((V * l))) * c0;
} else {
tmp = t_0;
}
return tmp;
}
NOTE: c0, A, 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(((l / a) * v))
if ((v * l) <= (-2d-27)) then
tmp = sqrt(((a / v) / l)) * c0
else if ((v * l) <= 4d-200) then
tmp = t_0
else if ((v * l) <= 2d+271) then
tmp = (sqrt(a) / sqrt((v * l))) * c0
else
tmp = t_0
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = c0 / Math.sqrt(((l / A) * V));
double tmp;
if ((V * l) <= -2e-27) {
tmp = Math.sqrt(((A / V) / l)) * c0;
} else if ((V * l) <= 4e-200) {
tmp = t_0;
} else if ((V * l) <= 2e+271) {
tmp = (Math.sqrt(A) / Math.sqrt((V * l))) * c0;
} else {
tmp = t_0;
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = c0 / math.sqrt(((l / A) * V)) tmp = 0 if (V * l) <= -2e-27: tmp = math.sqrt(((A / V) / l)) * c0 elif (V * l) <= 4e-200: tmp = t_0 elif (V * l) <= 2e+271: tmp = (math.sqrt(A) / math.sqrt((V * l))) * c0 else: tmp = t_0 return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(c0 / sqrt(Float64(Float64(l / A) * V))) tmp = 0.0 if (Float64(V * l) <= -2e-27) tmp = Float64(sqrt(Float64(Float64(A / V) / l)) * c0); elseif (Float64(V * l) <= 4e-200) tmp = t_0; elseif (Float64(V * l) <= 2e+271) tmp = Float64(Float64(sqrt(A) / sqrt(Float64(V * l))) * c0); else tmp = t_0; end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = c0 / sqrt(((l / A) * V));
tmp = 0.0;
if ((V * l) <= -2e-27)
tmp = sqrt(((A / V) / l)) * c0;
elseif ((V * l) <= 4e-200)
tmp = t_0;
elseif ((V * l) <= 2e+271)
tmp = (sqrt(A) / sqrt((V * l))) * c0;
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: c0, A, 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[Sqrt[N[(N[(l / A), $MachinePrecision] * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -2e-27], N[(N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e-200], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 2e+271], N[(N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{c0}{\sqrt{\frac{\ell}{A} \cdot V}}\\
\mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{-27}:\\
\;\;\;\;\sqrt{\frac{\frac{A}{V}}{\ell}} \cdot c0\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{-200}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+271}:\\
\;\;\;\;\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 V l) < -2.0000000000000001e-27Initial program 78.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6476.5
Applied rewrites76.5%
if -2.0000000000000001e-27 < (*.f64 V l) < 3.9999999999999999e-200 or 1.99999999999999991e271 < (*.f64 V l) Initial program 62.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6476.5
Applied rewrites76.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
frac-timesN/A
*-rgt-identityN/A
lift-sqrt.f64N/A
sqrt-prodN/A
clear-numN/A
lift-/.f64N/A
div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
Applied rewrites76.5%
if 3.9999999999999999e-200 < (*.f64 V l) < 1.99999999999999991e271Initial program 83.4%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6499.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.5
Applied rewrites99.5%
Final simplification83.3%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= l 7.2e-254) (* (/ (sqrt (/ (- A) l)) (sqrt (- V))) c0) (/ c0 (* (sqrt l) (sqrt (/ V A))))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (l <= 7.2e-254) {
tmp = (sqrt((-A / l)) / sqrt(-V)) * c0;
} else {
tmp = c0 / (sqrt(l) * sqrt((V / A)));
}
return tmp;
}
NOTE: c0, A, 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 <= 7.2d-254) then
tmp = (sqrt((-a / l)) / sqrt(-v)) * c0
else
tmp = c0 / (sqrt(l) * sqrt((v / a)))
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if (l <= 7.2e-254) {
tmp = (Math.sqrt((-A / l)) / Math.sqrt(-V)) * c0;
} else {
tmp = c0 / (Math.sqrt(l) * Math.sqrt((V / A)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): tmp = 0 if l <= 7.2e-254: tmp = (math.sqrt((-A / l)) / math.sqrt(-V)) * c0 else: tmp = c0 / (math.sqrt(l) * math.sqrt((V / A))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) tmp = 0.0 if (l <= 7.2e-254) tmp = Float64(Float64(sqrt(Float64(Float64(-A) / l)) / sqrt(Float64(-V))) * c0); else tmp = Float64(c0 / Float64(sqrt(l) * sqrt(Float64(V / A)))); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (l <= 7.2e-254)
tmp = (sqrt((-A / l)) / sqrt(-V)) * c0;
else
tmp = c0 / (sqrt(l) * sqrt((V / A)));
end
tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[l, 7.2e-254], N[(N[(N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], N[(c0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[N[(V / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 7.2 \cdot 10^{-254}:\\
\;\;\;\;\frac{\sqrt{\frac{-A}{\ell}}}{\sqrt{-V}} \cdot c0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}}\\
\end{array}
\end{array}
if l < 7.19999999999999967e-254Initial program 73.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6474.7
Applied rewrites74.7%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
associate-/l/N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6445.3
Applied rewrites45.3%
if 7.19999999999999967e-254 < l Initial program 71.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6476.7
Applied rewrites76.7%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
associate-*l/N/A
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
frac-timesN/A
*-rgt-identityN/A
lift-sqrt.f64N/A
sqrt-prodN/A
clear-numN/A
lift-/.f64N/A
div-invN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
Applied rewrites77.2%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
sqrt-prodN/A
lift-sqrt.f64N/A
pow1/2N/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-/.f6485.0
Applied rewrites85.0%
Final simplification62.9%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (* (sqrt (/ A (* V l))) c0))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
return sqrt((A / (V * l))) * c0;
}
NOTE: c0, A, 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 = sqrt((a / (v * l))) * c0
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
return Math.sqrt((A / (V * l))) * c0;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): return math.sqrt((A / (V * l))) * c0
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) return Float64(sqrt(Float64(A / Float64(V * l))) * c0) end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp = code(c0, A, V, l)
tmp = sqrt((A / (V * l))) * c0;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := N[(N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\sqrt{\frac{A}{V \cdot \ell}} \cdot c0
\end{array}
Initial program 72.5%
Final simplification72.5%
herbie shell --seed 2024241
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))