
(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: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) (- INFINITY))
(* (/ c0 (sqrt l)) (sqrt (/ A V)))
(if (<= (* V l) -4e-265)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 0.0)
(/ c0 (sqrt (* V (/ l A))))
(if (<= (* V l) 2e+291)
(/ c0 (/ (sqrt (* V l)) (sqrt A)))
(* c0 (/ (sqrt (/ (- A) l)) (sqrt (- V)))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = (c0 / sqrt(l)) * sqrt((A / V));
} else if ((V * l) <= -4e-265) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / sqrt((V * (l / A)));
} else if ((V * l) <= 2e+291) {
tmp = c0 / (sqrt((V * l)) / sqrt(A));
} else {
tmp = c0 * (sqrt((-A / l)) / sqrt(-V));
}
return tmp;
}
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = (c0 / Math.sqrt(l)) * Math.sqrt((A / V));
} else if ((V * l) <= -4e-265) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / Math.sqrt((V * (l / A)));
} else if ((V * l) <= 2e+291) {
tmp = c0 / (Math.sqrt((V * l)) / Math.sqrt(A));
} else {
tmp = c0 * (Math.sqrt((-A / l)) / Math.sqrt(-V));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -math.inf: tmp = (c0 / math.sqrt(l)) * math.sqrt((A / V)) elif (V * l) <= -4e-265: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 0.0: tmp = c0 / math.sqrt((V * (l / A))) elif (V * l) <= 2e+291: tmp = c0 / (math.sqrt((V * l)) / math.sqrt(A)) else: tmp = c0 * (math.sqrt((-A / l)) / math.sqrt(-V)) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(Float64(c0 / sqrt(l)) * sqrt(Float64(A / V))); elseif (Float64(V * l) <= -4e-265) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 0.0) tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); elseif (Float64(V * l) <= 2e+291) tmp = Float64(c0 / Float64(sqrt(Float64(V * l)) / sqrt(A))); else tmp = Float64(c0 * Float64(sqrt(Float64(Float64(-A) / l)) / sqrt(Float64(-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 * l) <= -Inf)
tmp = (c0 / sqrt(l)) * sqrt((A / V));
elseif ((V * l) <= -4e-265)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 0.0)
tmp = c0 / sqrt((V * (l / A)));
elseif ((V * l) <= 2e+291)
tmp = c0 / (sqrt((V * l)) / sqrt(A));
else
tmp = c0 * (sqrt((-A / l)) / 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[N[(V * l), $MachinePrecision], (-Infinity)], N[(N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -4e-265], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e+291], N[(c0 / N[(N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[((-A) / l), $MachinePrecision]], $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 \cdot \ell \leq -\infty:\\
\;\;\;\;\frac{c0}{\sqrt{\ell}} \cdot \sqrt{\frac{A}{V}}\\
\mathbf{elif}\;V \cdot \ell \leq -4 \cdot 10^{-265}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+291}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{-A}{\ell}}}{\sqrt{-V}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 49.0%
*-commutative49.0%
associate-/r*88.4%
sqrt-div47.0%
associate-*l/46.8%
Applied egg-rr46.8%
*-commutative46.8%
*-un-lft-identity46.8%
times-frac47.0%
sqrt-div88.4%
un-div-inv88.4%
*-commutative88.4%
sqrt-prod47.0%
sqrt-div47.0%
metadata-eval47.0%
frac-2neg47.0%
sqrt-div47.0%
times-frac46.9%
*-un-lft-identity46.9%
sqrt-prod49.0%
times-frac49.0%
*-un-lft-identity49.0%
sqrt-prod46.9%
Applied egg-rr47.0%
if -inf.0 < (*.f64 V l) < -3.99999999999999994e-265Initial program 87.3%
frac-2neg87.3%
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 -3.99999999999999994e-265 < (*.f64 V l) < -0.0Initial program 28.2%
*-un-lft-identity28.2%
times-frac58.1%
Applied egg-rr58.1%
Applied egg-rr20.1%
expm1-def20.1%
expm1-log1p28.2%
associate-*r/58.1%
Simplified58.1%
if -0.0 < (*.f64 V l) < 1.9999999999999999e291Initial program 87.3%
*-un-lft-identity87.3%
times-frac76.0%
Applied egg-rr76.0%
Applied egg-rr33.0%
expm1-def60.8%
expm1-log1p87.4%
associate-*r/76.9%
Simplified76.9%
associate-*r/87.4%
sqrt-div98.8%
*-commutative98.8%
Applied egg-rr98.8%
if 1.9999999999999999e291 < (*.f64 V l) Initial program 23.6%
*-un-lft-identity23.6%
times-frac60.4%
Applied egg-rr60.4%
associate-*l/60.4%
*-un-lft-identity60.4%
Applied egg-rr60.4%
frac-2neg60.4%
sqrt-div69.6%
distribute-neg-frac69.6%
Applied egg-rr69.6%
Final simplification88.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)))) (* (/ (/ c0 (sqrt l)) (sqrt V)) (sqrt A))))
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(V)) * sqrt(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 (v <= (-5d-310)) then
tmp = c0 * (sqrt((-a / l)) / sqrt(-v))
else
tmp = ((c0 / sqrt(l)) / sqrt(v)) * sqrt(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 (V <= -5e-310) {
tmp = c0 * (Math.sqrt((-A / l)) / Math.sqrt(-V));
} else {
tmp = ((c0 / Math.sqrt(l)) / Math.sqrt(V)) * Math.sqrt(A);
}
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(V)) * math.sqrt(A) 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(Float64(c0 / sqrt(l)) / sqrt(V)) * sqrt(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 (V <= -5e-310)
tmp = c0 * (sqrt((-A / l)) / sqrt(-V));
else
tmp = ((c0 / sqrt(l)) / sqrt(V)) * sqrt(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[V, -5e-310], N[(c0 * N[(N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[V], $MachinePrecision]), $MachinePrecision] * N[Sqrt[A], $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{\frac{c0}{\sqrt{\ell}}}{\sqrt{V}} \cdot \sqrt{A}\\
\end{array}
\end{array}
if V < -4.999999999999985e-310Initial program 74.8%
*-un-lft-identity74.8%
times-frac75.9%
Applied egg-rr75.9%
associate-*l/75.9%
*-un-lft-identity75.9%
Applied egg-rr75.9%
frac-2neg75.9%
sqrt-div86.7%
distribute-neg-frac86.7%
Applied egg-rr86.7%
if -4.999999999999985e-310 < V Initial program 69.7%
*-un-lft-identity69.7%
times-frac69.9%
Applied egg-rr69.9%
associate-*l/70.0%
*-un-lft-identity70.0%
Applied egg-rr70.0%
div-inv69.9%
associate-*l/71.3%
div-inv71.3%
sqrt-undiv39.4%
clear-num39.4%
div-inv39.5%
associate-/r/39.0%
sqrt-div50.7%
associate-*r/50.0%
Applied egg-rr50.0%
associate-/l*50.7%
associate-/r/48.9%
Simplified48.9%
Final simplification68.7%
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 l) (- INFINITY))
(* (/ c0 (sqrt l)) (sqrt (/ A V)))
(if (<= (* V l) -4e-265)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 0.0)
(/ c0 (sqrt (* V (/ l A))))
(if (<= (* V l) 2e+291)
(/ c0 (/ (sqrt (* V l)) (sqrt A)))
(* c0 (/ (sqrt (/ (- A) V)) (sqrt (- l)))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = (c0 / sqrt(l)) * sqrt((A / V));
} else if ((V * l) <= -4e-265) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / sqrt((V * (l / A)));
} else if ((V * l) <= 2e+291) {
tmp = c0 / (sqrt((V * l)) / sqrt(A));
} else {
tmp = c0 * (sqrt((-A / V)) / sqrt(-l));
}
return tmp;
}
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = (c0 / Math.sqrt(l)) * Math.sqrt((A / V));
} else if ((V * l) <= -4e-265) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / Math.sqrt((V * (l / A)));
} else if ((V * l) <= 2e+291) {
tmp = c0 / (Math.sqrt((V * l)) / Math.sqrt(A));
} else {
tmp = c0 * (Math.sqrt((-A / V)) / Math.sqrt(-l));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -math.inf: tmp = (c0 / math.sqrt(l)) * math.sqrt((A / V)) elif (V * l) <= -4e-265: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 0.0: tmp = c0 / math.sqrt((V * (l / A))) elif (V * l) <= 2e+291: tmp = c0 / (math.sqrt((V * l)) / math.sqrt(A)) else: tmp = c0 * (math.sqrt((-A / V)) / math.sqrt(-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) <= Float64(-Inf)) tmp = Float64(Float64(c0 / sqrt(l)) * sqrt(Float64(A / V))); elseif (Float64(V * l) <= -4e-265) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 0.0) tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); elseif (Float64(V * l) <= 2e+291) tmp = Float64(c0 / Float64(sqrt(Float64(V * l)) / sqrt(A))); else tmp = Float64(c0 * Float64(sqrt(Float64(Float64(-A) / V)) / sqrt(Float64(-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) <= -Inf)
tmp = (c0 / sqrt(l)) * sqrt((A / V));
elseif ((V * l) <= -4e-265)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 0.0)
tmp = c0 / sqrt((V * (l / A)));
elseif ((V * l) <= 2e+291)
tmp = c0 / (sqrt((V * l)) / sqrt(A));
else
tmp = c0 * (sqrt((-A / V)) / sqrt(-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[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -4e-265], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e+291], N[(c0 / N[(N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[((-A) / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-l)], $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 -\infty:\\
\;\;\;\;\frac{c0}{\sqrt{\ell}} \cdot \sqrt{\frac{A}{V}}\\
\mathbf{elif}\;V \cdot \ell \leq -4 \cdot 10^{-265}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+291}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{-A}{V}}}{\sqrt{-\ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 49.0%
*-commutative49.0%
associate-/r*88.4%
sqrt-div47.0%
associate-*l/46.8%
Applied egg-rr46.8%
*-commutative46.8%
*-un-lft-identity46.8%
times-frac47.0%
sqrt-div88.4%
un-div-inv88.4%
*-commutative88.4%
sqrt-prod47.0%
sqrt-div47.0%
metadata-eval47.0%
frac-2neg47.0%
sqrt-div47.0%
times-frac46.9%
*-un-lft-identity46.9%
sqrt-prod49.0%
times-frac49.0%
*-un-lft-identity49.0%
sqrt-prod46.9%
Applied egg-rr47.0%
if -inf.0 < (*.f64 V l) < -3.99999999999999994e-265Initial program 87.3%
frac-2neg87.3%
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 -3.99999999999999994e-265 < (*.f64 V l) < -0.0Initial program 28.2%
*-un-lft-identity28.2%
times-frac58.1%
Applied egg-rr58.1%
Applied egg-rr20.1%
expm1-def20.1%
expm1-log1p28.2%
associate-*r/58.1%
Simplified58.1%
if -0.0 < (*.f64 V l) < 1.9999999999999999e291Initial program 87.3%
*-un-lft-identity87.3%
times-frac76.0%
Applied egg-rr76.0%
Applied egg-rr33.0%
expm1-def60.8%
expm1-log1p87.4%
associate-*r/76.9%
Simplified76.9%
associate-*r/87.4%
sqrt-div98.8%
*-commutative98.8%
Applied egg-rr98.8%
if 1.9999999999999999e291 < (*.f64 V l) Initial program 23.6%
associate-/r*60.4%
frac-2neg60.4%
sqrt-div61.3%
distribute-neg-frac61.3%
Applied egg-rr61.3%
Final simplification87.6%
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 l) -4e+159)
(/ c0 (/ (sqrt l) (sqrt (/ A V))))
(if (<= (* V l) -1e-189)
(* c0 (sqrt (/ A (* V l))))
(if (<= (* V l) 0.0)
(/ c0 (sqrt (* V (/ l A))))
(if (<= (* V l) 2e+291)
(/ c0 (/ (sqrt (* V l)) (sqrt A)))
(* c0 (sqrt (* (/ 1.0 V) (/ A l)))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -4e+159) {
tmp = c0 / (sqrt(l) / sqrt((A / V)));
} else if ((V * l) <= -1e-189) {
tmp = c0 * sqrt((A / (V * l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / sqrt((V * (l / A)));
} else if ((V * l) <= 2e+291) {
tmp = c0 / (sqrt((V * l)) / sqrt(A));
} else {
tmp = c0 * sqrt(((1.0 / V) * (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) :: tmp
if ((v * l) <= (-4d+159)) then
tmp = c0 / (sqrt(l) / sqrt((a / v)))
else if ((v * l) <= (-1d-189)) then
tmp = c0 * sqrt((a / (v * l)))
else if ((v * l) <= 0.0d0) then
tmp = c0 / sqrt((v * (l / a)))
else if ((v * l) <= 2d+291) then
tmp = c0 / (sqrt((v * l)) / sqrt(a))
else
tmp = c0 * sqrt(((1.0d0 / v) * (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 tmp;
if ((V * l) <= -4e+159) {
tmp = c0 / (Math.sqrt(l) / Math.sqrt((A / V)));
} else if ((V * l) <= -1e-189) {
tmp = c0 * Math.sqrt((A / (V * l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / Math.sqrt((V * (l / A)));
} else if ((V * l) <= 2e+291) {
tmp = c0 / (Math.sqrt((V * l)) / Math.sqrt(A));
} else {
tmp = c0 * Math.sqrt(((1.0 / V) * (A / l)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -4e+159: tmp = c0 / (math.sqrt(l) / math.sqrt((A / V))) elif (V * l) <= -1e-189: tmp = c0 * math.sqrt((A / (V * l))) elif (V * l) <= 0.0: tmp = c0 / math.sqrt((V * (l / A))) elif (V * l) <= 2e+291: tmp = c0 / (math.sqrt((V * l)) / math.sqrt(A)) else: tmp = c0 * math.sqrt(((1.0 / V) * (A / 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) <= -4e+159) tmp = Float64(c0 / Float64(sqrt(l) / sqrt(Float64(A / V)))); elseif (Float64(V * l) <= -1e-189) tmp = Float64(c0 * sqrt(Float64(A / Float64(V * l)))); elseif (Float64(V * l) <= 0.0) tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); elseif (Float64(V * l) <= 2e+291) tmp = Float64(c0 / Float64(sqrt(Float64(V * l)) / sqrt(A))); else tmp = Float64(c0 * sqrt(Float64(Float64(1.0 / V) * 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)
tmp = 0.0;
if ((V * l) <= -4e+159)
tmp = c0 / (sqrt(l) / sqrt((A / V)));
elseif ((V * l) <= -1e-189)
tmp = c0 * sqrt((A / (V * l)));
elseif ((V * l) <= 0.0)
tmp = c0 / sqrt((V * (l / A)));
elseif ((V * l) <= 2e+291)
tmp = c0 / (sqrt((V * l)) / sqrt(A));
else
tmp = c0 * sqrt(((1.0 / V) * (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_] := If[LessEqual[N[(V * l), $MachinePrecision], -4e+159], N[(c0 / N[(N[Sqrt[l], $MachinePrecision] / N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-189], N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e+291], N[(c0 / N[(N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] * N[(A / 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 -4 \cdot 10^{+159}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-189}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+291}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -3.9999999999999997e159Initial program 67.4%
associate-/r*82.2%
sqrt-div45.3%
associate-*r/45.1%
Applied egg-rr45.1%
associate-/l*45.2%
Simplified45.2%
if -3.9999999999999997e159 < (*.f64 V l) < -1.00000000000000007e-189Initial program 89.8%
if -1.00000000000000007e-189 < (*.f64 V l) < -0.0Initial program 37.0%
*-un-lft-identity37.0%
times-frac62.2%
Applied egg-rr62.2%
Applied egg-rr22.2%
expm1-def24.7%
expm1-log1p37.1%
associate-*r/62.3%
Simplified62.3%
if -0.0 < (*.f64 V l) < 1.9999999999999999e291Initial program 87.3%
*-un-lft-identity87.3%
times-frac76.0%
Applied egg-rr76.0%
Applied egg-rr33.0%
expm1-def60.8%
expm1-log1p87.4%
associate-*r/76.9%
Simplified76.9%
associate-*r/87.4%
sqrt-div98.8%
*-commutative98.8%
Applied egg-rr98.8%
if 1.9999999999999999e291 < (*.f64 V l) Initial program 23.6%
*-un-lft-identity23.6%
times-frac60.4%
Applied egg-rr60.4%
Final simplification80.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 l) (- INFINITY))
(* (/ c0 (sqrt l)) (sqrt (/ A V)))
(if (<= (* V l) -4e-265)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 0.0)
(/ c0 (sqrt (* V (/ l A))))
(if (<= (* V l) 2e+291)
(/ c0 (/ (sqrt (* V l)) (sqrt A)))
(* c0 (sqrt (* (/ 1.0 V) (/ A l)))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = (c0 / sqrt(l)) * sqrt((A / V));
} else if ((V * l) <= -4e-265) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / sqrt((V * (l / A)));
} else if ((V * l) <= 2e+291) {
tmp = c0 / (sqrt((V * l)) / sqrt(A));
} else {
tmp = c0 * sqrt(((1.0 / V) * (A / l)));
}
return tmp;
}
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = (c0 / Math.sqrt(l)) * Math.sqrt((A / V));
} else if ((V * l) <= -4e-265) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / Math.sqrt((V * (l / A)));
} else if ((V * l) <= 2e+291) {
tmp = c0 / (Math.sqrt((V * l)) / Math.sqrt(A));
} else {
tmp = c0 * Math.sqrt(((1.0 / V) * (A / l)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -math.inf: tmp = (c0 / math.sqrt(l)) * math.sqrt((A / V)) elif (V * l) <= -4e-265: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 0.0: tmp = c0 / math.sqrt((V * (l / A))) elif (V * l) <= 2e+291: tmp = c0 / (math.sqrt((V * l)) / math.sqrt(A)) else: tmp = c0 * math.sqrt(((1.0 / V) * (A / 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) <= Float64(-Inf)) tmp = Float64(Float64(c0 / sqrt(l)) * sqrt(Float64(A / V))); elseif (Float64(V * l) <= -4e-265) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 0.0) tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); elseif (Float64(V * l) <= 2e+291) tmp = Float64(c0 / Float64(sqrt(Float64(V * l)) / sqrt(A))); else tmp = Float64(c0 * sqrt(Float64(Float64(1.0 / V) * 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)
tmp = 0.0;
if ((V * l) <= -Inf)
tmp = (c0 / sqrt(l)) * sqrt((A / V));
elseif ((V * l) <= -4e-265)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 0.0)
tmp = c0 / sqrt((V * (l / A)));
elseif ((V * l) <= 2e+291)
tmp = c0 / (sqrt((V * l)) / sqrt(A));
else
tmp = c0 * sqrt(((1.0 / V) * (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_] := If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -4e-265], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e+291], N[(c0 / N[(N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] * N[(A / 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 -\infty:\\
\;\;\;\;\frac{c0}{\sqrt{\ell}} \cdot \sqrt{\frac{A}{V}}\\
\mathbf{elif}\;V \cdot \ell \leq -4 \cdot 10^{-265}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+291}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 49.0%
*-commutative49.0%
associate-/r*88.4%
sqrt-div47.0%
associate-*l/46.8%
Applied egg-rr46.8%
*-commutative46.8%
*-un-lft-identity46.8%
times-frac47.0%
sqrt-div88.4%
un-div-inv88.4%
*-commutative88.4%
sqrt-prod47.0%
sqrt-div47.0%
metadata-eval47.0%
frac-2neg47.0%
sqrt-div47.0%
times-frac46.9%
*-un-lft-identity46.9%
sqrt-prod49.0%
times-frac49.0%
*-un-lft-identity49.0%
sqrt-prod46.9%
Applied egg-rr47.0%
if -inf.0 < (*.f64 V l) < -3.99999999999999994e-265Initial program 87.3%
frac-2neg87.3%
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 -3.99999999999999994e-265 < (*.f64 V l) < -0.0Initial program 28.2%
*-un-lft-identity28.2%
times-frac58.1%
Applied egg-rr58.1%
Applied egg-rr20.1%
expm1-def20.1%
expm1-log1p28.2%
associate-*r/58.1%
Simplified58.1%
if -0.0 < (*.f64 V l) < 1.9999999999999999e291Initial program 87.3%
*-un-lft-identity87.3%
times-frac76.0%
Applied egg-rr76.0%
Applied egg-rr33.0%
expm1-def60.8%
expm1-log1p87.4%
associate-*r/76.9%
Simplified76.9%
associate-*r/87.4%
sqrt-div98.8%
*-commutative98.8%
Applied egg-rr98.8%
if 1.9999999999999999e291 < (*.f64 V l) Initial program 23.6%
*-un-lft-identity23.6%
times-frac60.4%
Applied egg-rr60.4%
Final simplification87.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 (/ A (* V l))))
(if (<= t_0 0.0)
(* (/ c0 (sqrt l)) (sqrt (/ A V)))
(if (<= t_0 5e+304) (* c0 (sqrt 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 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = (c0 / sqrt(l)) * sqrt((A / V));
} else if (t_0 <= 5e+304) {
tmp = c0 * sqrt(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 = a / (v * l)
if (t_0 <= 0.0d0) then
tmp = (c0 / sqrt(l)) * sqrt((a / v))
else if (t_0 <= 5d+304) then
tmp = c0 * sqrt(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 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = (c0 / Math.sqrt(l)) * Math.sqrt((A / V));
} else if (t_0 <= 5e+304) {
tmp = c0 * Math.sqrt(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 = A / (V * l) tmp = 0 if t_0 <= 0.0: tmp = (c0 / math.sqrt(l)) * math.sqrt((A / V)) elif t_0 <= 5e+304: tmp = c0 * math.sqrt(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(A / Float64(V * l)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(c0 / sqrt(l)) * sqrt(Float64(A / V))); elseif (t_0 <= 5e+304) tmp = Float64(c0 * sqrt(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 = A / (V * l);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = (c0 / sqrt(l)) * sqrt((A / V));
elseif (t_0 <= 5e+304)
tmp = c0 * sqrt(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[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+304], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], 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 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;\frac{c0}{\sqrt{\ell}} \cdot \sqrt{\frac{A}{V}}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+304}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 33.7%
*-commutative33.7%
associate-/r*57.6%
sqrt-div37.0%
associate-*l/36.9%
Applied egg-rr36.9%
*-commutative36.9%
*-un-lft-identity36.9%
times-frac37.0%
sqrt-div57.6%
un-div-inv57.6%
*-commutative57.6%
sqrt-prod37.0%
sqrt-div37.0%
metadata-eval37.0%
frac-2neg37.0%
sqrt-div25.3%
times-frac25.3%
*-un-lft-identity25.3%
sqrt-prod32.7%
times-frac32.6%
*-un-lft-identity32.6%
sqrt-prod25.2%
Applied egg-rr37.1%
if 0.0 < (/.f64 A (*.f64 V l)) < 4.9999999999999997e304Initial program 99.2%
if 4.9999999999999997e304 < (/.f64 A (*.f64 V l)) Initial program 27.5%
*-un-lft-identity27.5%
times-frac50.0%
Applied egg-rr50.0%
Applied egg-rr16.9%
expm1-def16.9%
expm1-log1p29.6%
associate-*r/51.5%
Simplified51.5%
Final simplification77.1%
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))))
(if (or (<= t_0 0.0) (not (<= t_0 5e+280)))
(* c0 (sqrt (/ (/ A V) l)))
(* c0 (sqrt t_0)))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if ((t_0 <= 0.0) || !(t_0 <= 5e+280)) {
tmp = c0 * sqrt(((A / V) / l));
} else {
tmp = c0 * sqrt(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 = a / (v * l)
if ((t_0 <= 0.0d0) .or. (.not. (t_0 <= 5d+280))) then
tmp = c0 * sqrt(((a / v) / l))
else
tmp = c0 * sqrt(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 = A / (V * l);
double tmp;
if ((t_0 <= 0.0) || !(t_0 <= 5e+280)) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else {
tmp = c0 * Math.sqrt(t_0);
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = A / (V * l) tmp = 0 if (t_0 <= 0.0) or not (t_0 <= 5e+280): tmp = c0 * math.sqrt(((A / V) / l)) else: tmp = c0 * math.sqrt(t_0) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(V * l)) tmp = 0.0 if ((t_0 <= 0.0) || !(t_0 <= 5e+280)) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); else tmp = Float64(c0 * sqrt(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 = A / (V * l);
tmp = 0.0;
if ((t_0 <= 0.0) || ~((t_0 <= 5e+280)))
tmp = c0 * sqrt(((A / V) / l));
else
tmp = c0 * sqrt(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[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 5e+280]], $MachinePrecision]], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_0 \leq 0 \lor \neg \left(t_0 \leq 5 \cdot 10^{+280}\right):\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0 or 5.0000000000000002e280 < (/.f64 A (*.f64 V l)) Initial program 33.7%
associate-/r*54.3%
Simplified54.3%
if 0.0 < (/.f64 A (*.f64 V l)) < 5.0000000000000002e280Initial program 99.2%
Final simplification80.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 (/ A (* V l))))
(if (<= t_0 0.0)
(* c0 (sqrt (/ (/ A V) l)))
(if (<= t_0 5e+304) (* c0 (sqrt 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 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * sqrt(((A / V) / l));
} else if (t_0 <= 5e+304) {
tmp = c0 * sqrt(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 = a / (v * l)
if (t_0 <= 0.0d0) then
tmp = c0 * sqrt(((a / v) / l))
else if (t_0 <= 5d+304) then
tmp = c0 * sqrt(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 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else if (t_0 <= 5e+304) {
tmp = c0 * Math.sqrt(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 = A / (V * l) tmp = 0 if t_0 <= 0.0: tmp = c0 * math.sqrt(((A / V) / l)) elif t_0 <= 5e+304: tmp = c0 * math.sqrt(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(A / Float64(V * l)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); elseif (t_0 <= 5e+304) tmp = Float64(c0 * sqrt(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 = A / (V * l);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = c0 * sqrt(((A / V) / l));
elseif (t_0 <= 5e+304)
tmp = c0 * sqrt(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[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+304], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], 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 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+304}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 33.7%
associate-/r*57.6%
Simplified57.6%
if 0.0 < (/.f64 A (*.f64 V l)) < 4.9999999999999997e304Initial program 99.2%
if 4.9999999999999997e304 < (/.f64 A (*.f64 V l)) Initial program 27.5%
*-un-lft-identity27.5%
times-frac50.0%
Applied egg-rr50.0%
Applied egg-rr16.9%
expm1-def16.9%
expm1-log1p29.6%
associate-*r/51.5%
Simplified51.5%
Final simplification81.8%
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 72.4%
Final simplification72.4%
herbie shell --seed 2023322
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))