
(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 8 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 (if (<= V -5e-310) (* c0 (/ (sqrt (/ (- A) l)) (sqrt (- V)))) (* (/ c0 (sqrt l)) (/ (sqrt A) (sqrt V)))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (V <= -5e-310) {
tmp = c0 * (sqrt((-A / l)) / sqrt(-V));
} else {
tmp = (c0 / sqrt(l)) * (sqrt(A) / sqrt(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) :: tmp
if (v <= (-5d-310)) then
tmp = c0 * (sqrt((-a / l)) / sqrt(-v))
else
tmp = (c0 / sqrt(l)) * (sqrt(a) / sqrt(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 tmp;
if (V <= -5e-310) {
tmp = c0 * (Math.sqrt((-A / l)) / Math.sqrt(-V));
} else {
tmp = (c0 / Math.sqrt(l)) * (Math.sqrt(A) / Math.sqrt(V));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): tmp = 0 if V <= -5e-310: tmp = c0 * (math.sqrt((-A / l)) / math.sqrt(-V)) else: tmp = (c0 / math.sqrt(l)) * (math.sqrt(A) / math.sqrt(V)) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) tmp = 0.0 if (V <= -5e-310) tmp = Float64(c0 * Float64(sqrt(Float64(Float64(-A) / l)) / sqrt(Float64(-V)))); else tmp = Float64(Float64(c0 / sqrt(l)) * Float64(sqrt(A) / sqrt(V))); 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 (V <= -5e-310)
tmp = c0 * (sqrt((-A / l)) / sqrt(-V));
else
tmp = (c0 / sqrt(l)) * (sqrt(A) / sqrt(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_] := If[LessEqual[V, -5e-310], N[(c0 * N[(N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[V], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \leq -5 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{-A}{\ell}}}{\sqrt{-V}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\ell}} \cdot \frac{\sqrt{A}}{\sqrt{V}}\\
\end{array}
\end{array}
if V < -4.999999999999985e-310Initial program 76.3%
*-un-lft-identity76.3%
times-frac78.4%
Applied egg-rr78.4%
clear-num78.4%
un-div-inv78.8%
Applied egg-rr78.8%
div-inv78.4%
clear-num78.4%
frac-times76.3%
*-un-lft-identity76.3%
associate-/l/78.5%
frac-2neg78.5%
sqrt-div88.5%
Applied egg-rr88.5%
distribute-neg-frac88.5%
Simplified88.5%
if -4.999999999999985e-310 < V Initial program 67.4%
*-un-lft-identity67.4%
times-frac65.2%
Applied egg-rr65.2%
clear-num65.0%
un-div-inv65.0%
Applied egg-rr65.0%
associate-/l/65.0%
sqrt-div65.4%
metadata-eval65.4%
/-rgt-identity65.4%
clear-num65.4%
div-inv65.4%
clear-num64.9%
div-inv64.9%
clear-num65.1%
frac-times67.3%
*-un-lft-identity67.3%
div-inv66.3%
metadata-eval66.3%
frac-times66.3%
div-inv66.3%
associate-/l/66.3%
un-div-inv67.3%
clear-num67.2%
associate-*r/66.2%
clear-num66.0%
div-inv66.0%
sqrt-undiv43.1%
Applied egg-rr51.4%
times-frac53.0%
Simplified53.0%
Final simplification71.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 (* c0 (sqrt (/ A (* V l))))))
(if (<= t_0 1e-225)
(* c0 (sqrt (/ (/ A V) l)))
(if (<= t_0 1e+259) t_0 (/ c0 (sqrt (* V (/ l A))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 * sqrt((A / (V * l)));
double tmp;
if (t_0 <= 1e-225) {
tmp = c0 * sqrt(((A / V) / l));
} else if (t_0 <= 1e+259) {
tmp = t_0;
} else {
tmp = c0 / sqrt((V * (l / 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) :: t_0
real(8) :: tmp
t_0 = c0 * sqrt((a / (v * l)))
if (t_0 <= 1d-225) then
tmp = c0 * sqrt(((a / v) / l))
else if (t_0 <= 1d+259) then
tmp = t_0
else
tmp = c0 / sqrt((v * (l / 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 t_0 = c0 * Math.sqrt((A / (V * l)));
double tmp;
if (t_0 <= 1e-225) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else if (t_0 <= 1e+259) {
tmp = t_0;
} else {
tmp = c0 / Math.sqrt((V * (l / A)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = c0 * math.sqrt((A / (V * l))) tmp = 0 if t_0 <= 1e-225: tmp = c0 * math.sqrt(((A / V) / l)) elif t_0 <= 1e+259: tmp = t_0 else: tmp = c0 / math.sqrt((V * (l / A))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(c0 * sqrt(Float64(A / Float64(V * l)))) tmp = 0.0 if (t_0 <= 1e-225) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); elseif (t_0 <= 1e+259) tmp = t_0; else tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); 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((A / (V * l)));
tmp = 0.0;
if (t_0 <= 1e-225)
tmp = c0 * sqrt(((A / V) / l));
elseif (t_0 <= 1e+259)
tmp = t_0;
else
tmp = c0 / sqrt((V * (l / 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_] := Block[{t$95$0 = N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e-225], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+259], t$95$0, N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
\mathbf{if}\;t_0 \leq 10^{-225}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{elif}\;t_0 \leq 10^{+259}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\end{array}
\end{array}
if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 9.9999999999999996e-226Initial program 67.3%
associate-/r*69.1%
Simplified69.1%
if 9.9999999999999996e-226 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 9.999999999999999e258Initial program 99.6%
if 9.999999999999999e258 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) Initial program 55.0%
associate-/r*65.1%
clear-num65.1%
sqrt-div70.6%
metadata-eval70.6%
div-inv70.6%
clear-num70.6%
Applied egg-rr70.6%
associate-*r/58.5%
*-commutative58.5%
*-lft-identity58.5%
times-frac68.1%
remove-double-div68.1%
associate-/r*68.1%
*-rgt-identity68.1%
remove-double-div68.1%
Simplified68.1%
Applied egg-rr57.7%
expm1-def57.7%
expm1-log1p58.5%
associate-*r/68.1%
Simplified68.1%
Final simplification74.8%
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))))
(if (<= (* V l) (- INFINITY))
(/ t_0 (/ (sqrt l) c0))
(if (<= (* V l) -5e-221)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (or (<= (* V l) 0.0) (not (<= (* V l) 1e+287)))
(/ c0 (/ (sqrt l) t_0))
(* c0 (/ (sqrt A) (sqrt (* V l)))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = sqrt((A / V));
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = t_0 / (sqrt(l) / c0);
} else if ((V * l) <= -5e-221) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if (((V * l) <= 0.0) || !((V * l) <= 1e+287)) {
tmp = c0 / (sqrt(l) / t_0);
} else {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
}
return tmp;
}
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));
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = t_0 / (Math.sqrt(l) / c0);
} else if ((V * l) <= -5e-221) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if (((V * l) <= 0.0) || !((V * l) <= 1e+287)) {
tmp = c0 / (Math.sqrt(l) / t_0);
} else {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = math.sqrt((A / V)) tmp = 0 if (V * l) <= -math.inf: tmp = t_0 / (math.sqrt(l) / c0) elif (V * l) <= -5e-221: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif ((V * l) <= 0.0) or not ((V * l) <= 1e+287): tmp = c0 / (math.sqrt(l) / t_0) else: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = sqrt(Float64(A / V)) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(t_0 / Float64(sqrt(l) / c0)); elseif (Float64(V * l) <= -5e-221) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif ((Float64(V * l) <= 0.0) || !(Float64(V * l) <= 1e+287)) tmp = Float64(c0 / Float64(sqrt(l) / t_0)); else tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); 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));
tmp = 0.0;
if ((V * l) <= -Inf)
tmp = t_0 / (sqrt(l) / c0);
elseif ((V * l) <= -5e-221)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif (((V * l) <= 0.0) || ~(((V * l) <= 1e+287)))
tmp = c0 / (sqrt(l) / t_0);
else
tmp = c0 * (sqrt(A) / sqrt((V * l)));
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[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(t$95$0 / N[(N[Sqrt[l], $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-221], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[Not[LessEqual[N[(V * l), $MachinePrecision], 1e+287]], $MachinePrecision]], N[(c0 / N[(N[Sqrt[l], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $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}}\\
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;\frac{t_0}{\frac{\sqrt{\ell}}{c0}}\\
\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-221}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 0 \lor \neg \left(V \cdot \ell \leq 10^{+287}\right):\\
\;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{t_0}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 20.6%
associate-/r*52.7%
sqrt-div50.7%
associate-*r/50.6%
Applied egg-rr50.6%
*-commutative50.6%
associate-/l*50.8%
Simplified50.8%
if -inf.0 < (*.f64 V l) < -4.99999999999999996e-221Initial program 87.8%
frac-2neg87.8%
sqrt-div99.5%
distribute-rgt-neg-in99.5%
Applied egg-rr99.5%
distribute-rgt-neg-out99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
Simplified99.5%
if -4.99999999999999996e-221 < (*.f64 V l) < -0.0 or 1.0000000000000001e287 < (*.f64 V l) Initial program 43.9%
associate-/r*58.7%
sqrt-div47.9%
associate-*r/47.9%
Applied egg-rr47.9%
associate-/l*48.0%
Simplified48.0%
if -0.0 < (*.f64 V l) < 1.0000000000000001e287Initial program 87.8%
sqrt-div98.9%
associate-*r/90.6%
Applied egg-rr90.6%
*-commutative90.6%
associate-/l*97.1%
associate-/r/98.9%
Simplified98.9%
Final simplification82.8%
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 (* V (/ l A))))))
(if (<= (* V l) -5e+83)
t_0
(if (<= (* V l) -1e-219)
(* c0 (sqrt (/ A (* V l))))
(if (<= (* V l) 2e-318)
t_0
(if (<= (* V l) 5e+299)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(* (/ c0 (sqrt V)) (sqrt (/ A l)))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 / sqrt((V * (l / A)));
double tmp;
if ((V * l) <= -5e+83) {
tmp = t_0;
} else if ((V * l) <= -1e-219) {
tmp = c0 * sqrt((A / (V * l)));
} else if ((V * l) <= 2e-318) {
tmp = t_0;
} else if ((V * l) <= 5e+299) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} else {
tmp = (c0 / sqrt(V)) * sqrt((A / l));
}
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((v * (l / a)))
if ((v * l) <= (-5d+83)) then
tmp = t_0
else if ((v * l) <= (-1d-219)) then
tmp = c0 * sqrt((a / (v * l)))
else if ((v * l) <= 2d-318) then
tmp = t_0
else if ((v * l) <= 5d+299) then
tmp = c0 * (sqrt(a) / sqrt((v * l)))
else
tmp = (c0 / sqrt(v)) * sqrt((a / l))
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((V * (l / A)));
double tmp;
if ((V * l) <= -5e+83) {
tmp = t_0;
} else if ((V * l) <= -1e-219) {
tmp = c0 * Math.sqrt((A / (V * l)));
} else if ((V * l) <= 2e-318) {
tmp = t_0;
} else if ((V * l) <= 5e+299) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} else {
tmp = (c0 / Math.sqrt(V)) * Math.sqrt((A / l));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = c0 / math.sqrt((V * (l / A))) tmp = 0 if (V * l) <= -5e+83: tmp = t_0 elif (V * l) <= -1e-219: tmp = c0 * math.sqrt((A / (V * l))) elif (V * l) <= 2e-318: tmp = t_0 elif (V * l) <= 5e+299: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) else: tmp = (c0 / math.sqrt(V)) * math.sqrt((A / l)) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(c0 / sqrt(Float64(V * Float64(l / A)))) tmp = 0.0 if (Float64(V * l) <= -5e+83) tmp = t_0; elseif (Float64(V * l) <= -1e-219) tmp = Float64(c0 * sqrt(Float64(A / Float64(V * l)))); elseif (Float64(V * l) <= 2e-318) tmp = t_0; elseif (Float64(V * l) <= 5e+299) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); else tmp = Float64(Float64(c0 / sqrt(V)) * sqrt(Float64(A / l))); 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((V * (l / A)));
tmp = 0.0;
if ((V * l) <= -5e+83)
tmp = t_0;
elseif ((V * l) <= -1e-219)
tmp = c0 * sqrt((A / (V * l)));
elseif ((V * l) <= 2e-318)
tmp = t_0;
elseif ((V * l) <= 5e+299)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
else
tmp = (c0 / sqrt(V)) * sqrt((A / l));
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[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -5e+83], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], -1e-219], N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e-318], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 5e+299], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[Sqrt[V], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(A / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+83}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-219}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-318}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+299}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{V}} \cdot \sqrt{\frac{A}{\ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -5.00000000000000029e83 or -1e-219 < (*.f64 V l) < 2.0000024e-318Initial program 53.4%
associate-/r*65.2%
clear-num65.2%
sqrt-div65.8%
metadata-eval65.8%
div-inv65.5%
clear-num65.5%
Applied egg-rr65.5%
associate-*r/53.4%
*-commutative53.4%
*-lft-identity53.4%
times-frac65.4%
remove-double-div65.4%
associate-/r*65.4%
*-rgt-identity65.4%
remove-double-div65.4%
Simplified65.4%
Applied egg-rr27.4%
expm1-def39.7%
expm1-log1p53.5%
associate-*r/65.6%
Simplified65.6%
if -5.00000000000000029e83 < (*.f64 V l) < -1e-219Initial program 93.3%
if 2.0000024e-318 < (*.f64 V l) < 5.0000000000000003e299Initial program 87.4%
sqrt-div99.4%
associate-*r/91.2%
Applied egg-rr91.2%
*-commutative91.2%
associate-/l*98.0%
associate-/r/99.4%
Simplified99.4%
if 5.0000000000000003e299 < (*.f64 V l) Initial program 28.9%
associate-/r*52.3%
sqrt-div55.7%
associate-*r/55.7%
Applied egg-rr55.7%
*-commutative55.7%
associate-/l*55.5%
Simplified55.5%
associate-/r/55.7%
sqrt-undiv52.3%
un-div-inv52.3%
frac-times28.9%
*-commutative28.9%
frac-times52.1%
*-commutative52.1%
clear-num52.1%
frac-times52.3%
add-sqr-sqrt52.2%
frac-times52.2%
sqrt-unprod52.2%
add-sqr-sqrt52.2%
*-commutative52.2%
associate-*r/52.4%
sqrt-prod55.7%
times-frac55.7%
metadata-eval55.7%
sqrt-div55.6%
clear-num55.6%
Applied egg-rr55.6%
Final simplification83.0%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (or (<= (* V l) 0.0) (not (<= (* V l) 1e+287))) (/ c0 (/ (sqrt l) (sqrt (/ A V)))) (* c0 (/ (sqrt A) (sqrt (* V l))))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (((V * l) <= 0.0) || !((V * l) <= 1e+287)) {
tmp = c0 / (sqrt(l) / sqrt((A / V)));
} else {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
}
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 (((v * l) <= 0.0d0) .or. (.not. ((v * l) <= 1d+287))) then
tmp = c0 / (sqrt(l) / sqrt((a / v)))
else
tmp = c0 * (sqrt(a) / sqrt((v * l)))
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 (((V * l) <= 0.0) || !((V * l) <= 1e+287)) {
tmp = c0 / (Math.sqrt(l) / Math.sqrt((A / V)));
} else {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): tmp = 0 if ((V * l) <= 0.0) or not ((V * l) <= 1e+287): tmp = c0 / (math.sqrt(l) / math.sqrt((A / V))) else: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) tmp = 0.0 if ((Float64(V * l) <= 0.0) || !(Float64(V * l) <= 1e+287)) tmp = Float64(c0 / Float64(sqrt(l) / sqrt(Float64(A / V)))); else tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); 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 (((V * l) <= 0.0) || ~(((V * l) <= 1e+287)))
tmp = c0 / (sqrt(l) / sqrt((A / V)));
else
tmp = c0 * (sqrt(A) / sqrt((V * l)));
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[Or[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[Not[LessEqual[N[(V * l), $MachinePrecision], 1e+287]], $MachinePrecision]], N[(c0 / N[(N[Sqrt[l], $MachinePrecision] / N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq 0 \lor \neg \left(V \cdot \ell \leq 10^{+287}\right):\\
\;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -0.0 or 1.0000000000000001e287 < (*.f64 V l) Initial program 61.8%
associate-/r*67.5%
sqrt-div45.8%
associate-*r/45.6%
Applied egg-rr45.6%
associate-/l*45.8%
Simplified45.8%
if -0.0 < (*.f64 V l) < 1.0000000000000001e287Initial program 87.8%
sqrt-div98.9%
associate-*r/90.6%
Applied egg-rr90.6%
*-commutative90.6%
associate-/l*97.1%
associate-/r/98.9%
Simplified98.9%
Final simplification66.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 (/ A (* V l)))))) (if (<= t_0 1e-225) (* c0 (sqrt (/ (/ A V) l))) t_0)))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 * sqrt((A / (V * l)));
double tmp;
if (t_0 <= 1e-225) {
tmp = c0 * sqrt(((A / V) / l));
} 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((a / (v * l)))
if (t_0 <= 1d-225) then
tmp = c0 * sqrt(((a / v) / l))
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((A / (V * l)));
double tmp;
if (t_0 <= 1e-225) {
tmp = c0 * Math.sqrt(((A / V) / l));
} 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((A / (V * l))) tmp = 0 if t_0 <= 1e-225: tmp = c0 * math.sqrt(((A / V) / l)) 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(A / Float64(V * l)))) tmp = 0.0 if (t_0 <= 1e-225) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); 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((A / (V * l)));
tmp = 0.0;
if (t_0 <= 1e-225)
tmp = c0 * sqrt(((A / V) / l));
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[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e-225], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
\mathbf{if}\;t_0 \leq 10^{-225}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 9.9999999999999996e-226Initial program 67.3%
associate-/r*69.1%
Simplified69.1%
if 9.9999999999999996e-226 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) Initial program 81.7%
Final simplification73.2%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= V -5e-310)
(* c0 (/ (sqrt (/ (- A) l)) (sqrt (- V))))
(if (<= V 4e+22)
(* c0 (* (sqrt A) (sqrt (/ (/ 1.0 V) l))))
(/ c0 (/ (sqrt l) (sqrt (/ A V)))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (V <= -5e-310) {
tmp = c0 * (sqrt((-A / l)) / sqrt(-V));
} else if (V <= 4e+22) {
tmp = c0 * (sqrt(A) * sqrt(((1.0 / V) / l)));
} else {
tmp = c0 / (sqrt(l) / sqrt((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) :: tmp
if (v <= (-5d-310)) then
tmp = c0 * (sqrt((-a / l)) / sqrt(-v))
else if (v <= 4d+22) then
tmp = c0 * (sqrt(a) * sqrt(((1.0d0 / v) / l)))
else
tmp = c0 / (sqrt(l) / sqrt((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 tmp;
if (V <= -5e-310) {
tmp = c0 * (Math.sqrt((-A / l)) / Math.sqrt(-V));
} else if (V <= 4e+22) {
tmp = c0 * (Math.sqrt(A) * Math.sqrt(((1.0 / V) / l)));
} else {
tmp = c0 / (Math.sqrt(l) / Math.sqrt((A / V)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): tmp = 0 if V <= -5e-310: tmp = c0 * (math.sqrt((-A / l)) / math.sqrt(-V)) elif V <= 4e+22: tmp = c0 * (math.sqrt(A) * math.sqrt(((1.0 / V) / l))) else: tmp = c0 / (math.sqrt(l) / math.sqrt((A / V))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) tmp = 0.0 if (V <= -5e-310) tmp = Float64(c0 * Float64(sqrt(Float64(Float64(-A) / l)) / sqrt(Float64(-V)))); elseif (V <= 4e+22) tmp = Float64(c0 * Float64(sqrt(A) * sqrt(Float64(Float64(1.0 / V) / l)))); else tmp = Float64(c0 / Float64(sqrt(l) / sqrt(Float64(A / V)))); 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 (V <= -5e-310)
tmp = c0 * (sqrt((-A / l)) / sqrt(-V));
elseif (V <= 4e+22)
tmp = c0 * (sqrt(A) * sqrt(((1.0 / V) / l)));
else
tmp = c0 / (sqrt(l) / sqrt((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_] := If[LessEqual[V, -5e-310], N[(c0 * N[(N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[V, 4e+22], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[(N[Sqrt[l], $MachinePrecision] / N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \leq -5 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{-A}{\ell}}}{\sqrt{-V}}\\
\mathbf{elif}\;V \leq 4 \cdot 10^{+22}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{\frac{1}{V}}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\\
\end{array}
\end{array}
if V < -4.999999999999985e-310Initial program 76.3%
*-un-lft-identity76.3%
times-frac78.4%
Applied egg-rr78.4%
clear-num78.4%
un-div-inv78.8%
Applied egg-rr78.8%
div-inv78.4%
clear-num78.4%
frac-times76.3%
*-un-lft-identity76.3%
associate-/l/78.5%
frac-2neg78.5%
sqrt-div88.5%
Applied egg-rr88.5%
distribute-neg-frac88.5%
Simplified88.5%
if -4.999999999999985e-310 < V < 4e22Initial program 76.0%
div-inv74.1%
sqrt-prod49.4%
associate-/r*49.3%
Applied egg-rr49.3%
if 4e22 < V Initial program 56.3%
associate-/r*59.9%
sqrt-div42.2%
associate-*r/40.6%
Applied egg-rr40.6%
associate-/l*42.3%
Simplified42.3%
Final simplification67.7%
NOTE: c0, A, 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(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
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 = c0 * sqrt((a / (v * l)))
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp = code(c0, A, V, l)
tmp = c0 * sqrt((A / (V * l)));
end
NOTE: c0, A, 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}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
Initial program 71.9%
Final simplification71.9%
herbie shell --seed 2023318
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))