
(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 11 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 (<= A -1e-310) (* c0 (* (/ (sqrt (- A)) (sqrt (- V))) (sqrt (/ 1.0 l)))) (* 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 (A <= -1e-310) {
tmp = c0 * ((sqrt(-A) / sqrt(-V)) * sqrt((1.0 / l)));
} 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 (a <= (-1d-310)) then
tmp = c0 * ((sqrt(-a) / sqrt(-v)) * sqrt((1.0d0 / l)))
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 (A <= -1e-310) {
tmp = c0 * ((Math.sqrt(-A) / Math.sqrt(-V)) * Math.sqrt((1.0 / l)));
} 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 A <= -1e-310: tmp = c0 * ((math.sqrt(-A) / math.sqrt(-V)) * math.sqrt((1.0 / l))) 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 (A <= -1e-310) tmp = Float64(c0 * Float64(Float64(sqrt(Float64(-A)) / sqrt(Float64(-V))) * sqrt(Float64(1.0 / l)))); 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 (A <= -1e-310)
tmp = c0 * ((sqrt(-A) / sqrt(-V)) * sqrt((1.0 / l)));
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[LessEqual[A, -1e-310], N[(c0 * N[(N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / l), $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}\;A \leq -1 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \left(\frac{\sqrt{-A}}{\sqrt{-V}} \cdot \sqrt{\frac{1}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\end{array}
\end{array}
if A < -9.999999999999969e-311Initial program 79.8%
pow1/279.8%
associate-/r*76.5%
div-inv76.5%
unpow-prod-down39.9%
pow1/239.9%
Applied egg-rr39.9%
unpow1/239.9%
Simplified39.9%
frac-2neg39.9%
sqrt-div45.0%
Applied egg-rr45.0%
if -9.999999999999969e-311 < A Initial program 72.7%
sqrt-div83.9%
associate-*r/82.0%
Applied egg-rr82.0%
*-commutative82.0%
associate-/l*81.8%
associate-/r/83.9%
Simplified83.9%
Final simplification64.5%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= A -1e-310) (* (/ (sqrt (- A)) (sqrt (- V))) (/ c0 (sqrt l))) (* 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 (A <= -1e-310) {
tmp = (sqrt(-A) / sqrt(-V)) * (c0 / sqrt(l));
} 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 (a <= (-1d-310)) then
tmp = (sqrt(-a) / sqrt(-v)) * (c0 / sqrt(l))
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 (A <= -1e-310) {
tmp = (Math.sqrt(-A) / Math.sqrt(-V)) * (c0 / Math.sqrt(l));
} 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 A <= -1e-310: tmp = (math.sqrt(-A) / math.sqrt(-V)) * (c0 / math.sqrt(l)) 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 (A <= -1e-310) tmp = Float64(Float64(sqrt(Float64(-A)) / sqrt(Float64(-V))) * Float64(c0 / sqrt(l))); 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 (A <= -1e-310)
tmp = (sqrt(-A) / sqrt(-V)) * (c0 / sqrt(l));
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[LessEqual[A, -1e-310], N[(N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision] * N[(c0 / N[Sqrt[l], $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}\;A \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-A}}{\sqrt{-V}} \cdot \frac{c0}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\end{array}
\end{array}
if A < -9.999999999999969e-311Initial program 79.8%
associate-/r*76.5%
clear-num76.2%
sqrt-div76.1%
metadata-eval76.1%
div-inv75.7%
clear-num76.1%
Applied egg-rr76.1%
associate-*r/80.0%
*-commutative80.0%
*-lft-identity80.0%
times-frac76.3%
remove-double-div76.3%
associate-/r*76.3%
*-rgt-identity76.3%
remove-double-div76.3%
Simplified76.3%
un-div-inv76.3%
associate-*r/80.1%
sqrt-div0.0%
associate-/l*0.0%
*-commutative0.0%
sqrt-prod0.0%
associate-/r*0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div40.0%
Applied egg-rr40.0%
*-commutative40.0%
associate-*r/38.5%
Simplified38.5%
frac-2neg39.9%
sqrt-div45.0%
Applied egg-rr45.2%
if -9.999999999999969e-311 < A Initial program 72.7%
sqrt-div83.9%
associate-*r/82.0%
Applied egg-rr82.0%
*-commutative82.0%
associate-/l*81.8%
associate-/r/83.9%
Simplified83.9%
Final simplification64.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)) (sqrt (/ A V)))))
(if (<= (* V l) -2e+183)
t_0
(if (<= (* V l) -1e-139)
(/ c0 (sqrt (/ (* V l) A)))
(if (<= (* V l) 2e-318)
t_0
(if (<= (* V l) 1e+226)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(* c0 (sqrt (/ (/ 1.0 l) (/ V A))))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = (c0 / sqrt(l)) * sqrt((A / V));
double tmp;
if ((V * l) <= -2e+183) {
tmp = t_0;
} else if ((V * l) <= -1e-139) {
tmp = c0 / sqrt(((V * l) / A));
} else if ((V * l) <= 2e-318) {
tmp = t_0;
} else if ((V * l) <= 1e+226) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} else {
tmp = c0 * sqrt(((1.0 / l) / (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) :: t_0
real(8) :: tmp
t_0 = (c0 / sqrt(l)) * sqrt((a / v))
if ((v * l) <= (-2d+183)) then
tmp = t_0
else if ((v * l) <= (-1d-139)) then
tmp = c0 / sqrt(((v * l) / a))
else if ((v * l) <= 2d-318) then
tmp = t_0
else if ((v * l) <= 1d+226) then
tmp = c0 * (sqrt(a) / sqrt((v * l)))
else
tmp = c0 * sqrt(((1.0d0 / l) / (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 t_0 = (c0 / Math.sqrt(l)) * Math.sqrt((A / V));
double tmp;
if ((V * l) <= -2e+183) {
tmp = t_0;
} else if ((V * l) <= -1e-139) {
tmp = c0 / Math.sqrt(((V * l) / A));
} else if ((V * l) <= 2e-318) {
tmp = t_0;
} else if ((V * l) <= 1e+226) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} else {
tmp = c0 * Math.sqrt(((1.0 / l) / (V / A)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = (c0 / math.sqrt(l)) * math.sqrt((A / V)) tmp = 0 if (V * l) <= -2e+183: tmp = t_0 elif (V * l) <= -1e-139: tmp = c0 / math.sqrt(((V * l) / A)) elif (V * l) <= 2e-318: tmp = t_0 elif (V * l) <= 1e+226: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) else: tmp = c0 * math.sqrt(((1.0 / l) / (V / A))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(Float64(c0 / sqrt(l)) * sqrt(Float64(A / V))) tmp = 0.0 if (Float64(V * l) <= -2e+183) tmp = t_0; elseif (Float64(V * l) <= -1e-139) tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / A))); elseif (Float64(V * l) <= 2e-318) tmp = t_0; elseif (Float64(V * l) <= 1e+226) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); else tmp = Float64(c0 * sqrt(Float64(Float64(1.0 / l) / 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)
t_0 = (c0 / sqrt(l)) * sqrt((A / V));
tmp = 0.0;
if ((V * l) <= -2e+183)
tmp = t_0;
elseif ((V * l) <= -1e-139)
tmp = c0 / sqrt(((V * l) / A));
elseif ((V * l) <= 2e-318)
tmp = t_0;
elseif ((V * l) <= 1e+226)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
else
tmp = c0 * sqrt(((1.0 / l) / (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_] := Block[{t$95$0 = N[(N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -2e+183], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], -1e-139], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e-318], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 1e+226], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / N[(V / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{c0}{\sqrt{\ell}} \cdot \sqrt{\frac{A}{V}}\\
\mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+183}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-139}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-318}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+226}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{1}{\ell}}{\frac{V}{A}}}\\
\end{array}
\end{array}
if (*.f64 V l) < -1.99999999999999989e183 or -1.00000000000000003e-139 < (*.f64 V l) < 2.0000024e-318Initial program 66.5%
associate-/r*71.2%
clear-num70.8%
sqrt-div70.7%
metadata-eval70.7%
div-inv70.7%
clear-num70.7%
Applied egg-rr70.7%
associate-*r/66.0%
*-commutative66.0%
*-lft-identity66.0%
times-frac70.6%
remove-double-div70.6%
associate-/r*70.6%
*-rgt-identity70.6%
remove-double-div70.6%
Simplified70.6%
un-div-inv70.7%
associate-*r/66.0%
sqrt-div12.7%
associate-/l*12.7%
*-commutative12.7%
sqrt-prod7.8%
associate-/r*7.8%
*-commutative7.8%
associate-*r/7.8%
sqrt-div39.5%
Applied egg-rr39.5%
*-commutative39.5%
associate-*r/39.4%
Simplified39.4%
if -1.99999999999999989e183 < (*.f64 V l) < -1.00000000000000003e-139Initial program 94.5%
associate-/r*82.2%
clear-num82.2%
sqrt-div82.1%
metadata-eval82.1%
div-inv81.2%
clear-num82.1%
Applied egg-rr82.1%
associate-*r/95.8%
*-commutative95.8%
*-lft-identity95.8%
times-frac82.6%
remove-double-div82.5%
associate-/r*82.5%
*-rgt-identity82.5%
remove-double-div82.6%
Simplified82.6%
inv-pow82.6%
sqrt-pow282.6%
metadata-eval82.6%
Applied egg-rr82.6%
expm1-log1p-u60.3%
expm1-udef24.2%
metadata-eval24.2%
pow-flip24.2%
pow1/224.2%
div-inv24.2%
sqrt-prod12.5%
associate-/l/12.5%
div-inv12.5%
div-inv12.5%
associate-/l/12.5%
sqrt-prod24.2%
Applied egg-rr24.2%
expm1-def60.3%
expm1-log1p82.6%
associate-*r/95.9%
Simplified95.9%
if 2.0000024e-318 < (*.f64 V l) < 9.99999999999999961e225Initial program 82.3%
sqrt-div99.4%
associate-*r/97.6%
Applied egg-rr97.6%
*-commutative97.6%
associate-/l*97.2%
associate-/r/99.4%
Simplified99.4%
if 9.99999999999999961e225 < (*.f64 V l) Initial program 52.3%
*-un-lft-identity52.3%
times-frac79.7%
Applied egg-rr79.7%
frac-times52.3%
*-commutative52.3%
frac-times79.6%
clear-num79.7%
associate-*l/79.8%
*-un-lft-identity79.8%
Applied egg-rr79.8%
Final simplification75.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) -2e-313)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 5e-322)
(sqrt (* (/ A V) (/ (pow c0 2.0) l)))
(if (<= (* V l) 1e+226)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(* c0 (sqrt (/ (/ 1.0 l) (/ V A))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -2e-313) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 5e-322) {
tmp = sqrt(((A / V) * (pow(c0, 2.0) / l)));
} else if ((V * l) <= 1e+226) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} else {
tmp = c0 * sqrt(((1.0 / l) / (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 ((v * l) <= (-2d-313)) then
tmp = c0 * (sqrt(-a) / sqrt((v * -l)))
else if ((v * l) <= 5d-322) then
tmp = sqrt(((a / v) * ((c0 ** 2.0d0) / l)))
else if ((v * l) <= 1d+226) then
tmp = c0 * (sqrt(a) / sqrt((v * l)))
else
tmp = c0 * sqrt(((1.0d0 / l) / (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 ((V * l) <= -2e-313) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 5e-322) {
tmp = Math.sqrt(((A / V) * (Math.pow(c0, 2.0) / l)));
} else if ((V * l) <= 1e+226) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} else {
tmp = c0 * Math.sqrt(((1.0 / l) / (V / A)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -2e-313: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 5e-322: tmp = math.sqrt(((A / V) * (math.pow(c0, 2.0) / l))) elif (V * l) <= 1e+226: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) else: tmp = c0 * math.sqrt(((1.0 / l) / (V / A))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= -2e-313) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 5e-322) tmp = sqrt(Float64(Float64(A / V) * Float64((c0 ^ 2.0) / l))); elseif (Float64(V * l) <= 1e+226) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); else tmp = Float64(c0 * sqrt(Float64(Float64(1.0 / l) / 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 ((V * l) <= -2e-313)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 5e-322)
tmp = sqrt(((A / V) * ((c0 ^ 2.0) / l)));
elseif ((V * l) <= 1e+226)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
else
tmp = c0 * sqrt(((1.0 / l) / (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[N[(V * l), $MachinePrecision], -2e-313], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-322], N[Sqrt[N[(N[(A / V), $MachinePrecision] * N[(N[Power[c0, 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+226], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / 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}\;V \cdot \ell \leq -2 \cdot 10^{-313}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-322}:\\
\;\;\;\;\sqrt{\frac{A}{V} \cdot \frac{{c0}^{2}}{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+226}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{1}{\ell}}{\frac{V}{A}}}\\
\end{array}
\end{array}
if (*.f64 V l) < -1.99999999998e-313Initial program 85.1%
frac-2neg85.1%
sqrt-div94.2%
distribute-rgt-neg-in94.2%
Applied egg-rr94.2%
distribute-rgt-neg-out94.2%
*-commutative94.2%
distribute-rgt-neg-in94.2%
Simplified94.2%
if -1.99999999998e-313 < (*.f64 V l) < 4.99006e-322Initial program 48.9%
associate-/r*60.1%
clear-num60.1%
sqrt-div60.1%
metadata-eval60.1%
div-inv60.1%
clear-num60.1%
Applied egg-rr60.1%
associate-*r/48.9%
*-commutative48.9%
*-lft-identity48.9%
times-frac60.1%
remove-double-div60.1%
associate-/r*60.1%
*-rgt-identity60.1%
remove-double-div60.1%
Simplified60.1%
inv-pow60.1%
sqrt-pow260.1%
metadata-eval60.1%
Applied egg-rr60.1%
metadata-eval60.1%
pow-flip60.1%
pow1/260.1%
div-inv60.1%
sqrt-prod38.0%
associate-/l/37.9%
sqrt-div20.7%
associate-/r/20.7%
associate-*r/20.7%
sqrt-div31.4%
*-commutative31.4%
add-sqr-sqrt10.4%
sqrt-unprod10.6%
swap-sqr10.5%
add-sqr-sqrt10.5%
frac-times10.5%
pow210.5%
add-sqr-sqrt28.7%
Applied egg-rr28.7%
if 4.99006e-322 < (*.f64 V l) < 9.99999999999999961e225Initial program 81.4%
sqrt-div98.9%
associate-*r/97.0%
Applied egg-rr97.0%
*-commutative97.0%
associate-/l*96.6%
associate-/r/98.9%
Simplified98.9%
if 9.99999999999999961e225 < (*.f64 V l) Initial program 52.3%
*-un-lft-identity52.3%
times-frac79.7%
Applied egg-rr79.7%
frac-times52.3%
*-commutative52.3%
frac-times79.6%
clear-num79.7%
associate-*l/79.8%
*-un-lft-identity79.8%
Applied egg-rr79.8%
Final simplification86.7%
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 0.0) (* 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 <= 0.0) {
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 <= 0.0d0) 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 <= 0.0) {
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 <= 0.0: 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 <= 0.0) 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 <= 0.0)
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, 0.0], 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 0:\\
\;\;\;\;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)))) < 0.0Initial program 70.9%
*-commutative70.9%
associate-/l/69.5%
Simplified69.5%
if 0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) Initial program 84.3%
Final simplification75.4%
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-305) (/ c0 (sqrt (* V (/ l A)))) 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-305) {
tmp = c0 / sqrt((V * (l / A)));
} 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-305) then
tmp = c0 / sqrt((v * (l / a)))
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-305) {
tmp = c0 / Math.sqrt((V * (l / A)));
} 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-305: tmp = c0 / math.sqrt((V * (l / A))) 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-305) tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); 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-305)
tmp = c0 / sqrt((V * (l / A)));
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-305], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $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^{-305}:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 9.99999999999999996e-306Initial program 71.0%
associate-/r*69.7%
clear-num69.7%
sqrt-div70.0%
metadata-eval70.0%
div-inv70.0%
clear-num70.3%
Applied egg-rr70.3%
associate-*r/71.2%
*-commutative71.2%
*-lft-identity71.2%
times-frac73.2%
remove-double-div73.2%
associate-/r*73.2%
*-rgt-identity73.2%
remove-double-div73.2%
Simplified73.2%
un-div-inv73.3%
Applied egg-rr73.3%
if 9.99999999999999996e-306 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) Initial program 84.2%
Final simplification77.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 (<= (/ A (* V l)) 2e-310) (* (/ c0 (sqrt l)) (sqrt (/ A V))) (/ c0 (sqrt (/ (* V l) A)))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((A / (V * l)) <= 2e-310) {
tmp = (c0 / sqrt(l)) * sqrt((A / V));
} 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) :: tmp
if ((a / (v * l)) <= 2d-310) then
tmp = (c0 / sqrt(l)) * sqrt((a / v))
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 tmp;
if ((A / (V * l)) <= 2e-310) {
tmp = (c0 / Math.sqrt(l)) * Math.sqrt((A / V));
} 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): tmp = 0 if (A / (V * l)) <= 2e-310: tmp = (c0 / math.sqrt(l)) * math.sqrt((A / V)) 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) tmp = 0.0 if (Float64(A / Float64(V * l)) <= 2e-310) tmp = Float64(Float64(c0 / sqrt(l)) * sqrt(Float64(A / V))); else tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / 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 ((A / (V * l)) <= 2e-310)
tmp = (c0 / sqrt(l)) * sqrt((A / V));
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_] := If[LessEqual[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision], 2e-310], N[(N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{A}{V \cdot \ell} \leq 2 \cdot 10^{-310}:\\
\;\;\;\;\frac{c0}{\sqrt{\ell}} \cdot \sqrt{\frac{A}{V}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 1.999999999999994e-310Initial program 38.9%
associate-/r*54.1%
clear-num53.4%
sqrt-div53.4%
metadata-eval53.4%
div-inv53.4%
clear-num53.4%
Applied egg-rr53.4%
associate-*r/36.4%
*-commutative36.4%
*-lft-identity36.4%
times-frac53.4%
remove-double-div53.4%
associate-/r*53.4%
*-rgt-identity53.4%
remove-double-div53.4%
Simplified53.4%
un-div-inv53.4%
associate-*r/36.4%
sqrt-div24.7%
associate-/l*24.6%
*-commutative24.6%
sqrt-prod31.2%
associate-/r*29.5%
*-commutative29.5%
associate-*r/31.3%
sqrt-div51.4%
Applied egg-rr51.4%
*-commutative51.4%
associate-*r/51.3%
Simplified51.3%
if 1.999999999999994e-310 < (/.f64 A (*.f64 V l)) Initial program 85.5%
associate-/r*77.4%
clear-num77.3%
sqrt-div77.7%
metadata-eval77.7%
div-inv76.8%
clear-num77.0%
Applied egg-rr77.0%
associate-*r/87.0%
*-commutative87.0%
*-lft-identity87.0%
times-frac82.6%
remove-double-div82.6%
associate-/r*82.6%
*-rgt-identity82.6%
remove-double-div82.6%
Simplified82.6%
inv-pow82.6%
sqrt-pow282.7%
metadata-eval82.7%
Applied egg-rr82.7%
expm1-log1p-u57.8%
expm1-udef29.9%
metadata-eval29.9%
pow-flip29.9%
pow1/229.9%
div-inv29.9%
sqrt-prod17.4%
associate-/l/17.4%
div-inv17.4%
div-inv17.4%
associate-/l/17.4%
sqrt-prod29.9%
Applied egg-rr29.9%
expm1-def57.8%
expm1-log1p82.7%
associate-*r/87.0%
Simplified87.0%
Final simplification79.9%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= A -1e-310) (* c0 (/ (sqrt (/ A V)) (sqrt l))) (* 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 (A <= -1e-310) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} 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 (a <= (-1d-310)) then
tmp = c0 * (sqrt((a / v)) / sqrt(l))
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 (A <= -1e-310) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} 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 A <= -1e-310: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) 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 (A <= -1e-310) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); 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 (A <= -1e-310)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
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[LessEqual[A, -1e-310], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $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}\;A \leq -1 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\end{array}
\end{array}
if A < -9.999999999999969e-311Initial program 79.8%
associate-/r*76.5%
sqrt-div39.9%
associate-*r/40.0%
Applied egg-rr40.0%
*-commutative40.0%
associate-/l*38.6%
associate-/r/39.9%
Simplified39.9%
if -9.999999999999969e-311 < A Initial program 72.7%
sqrt-div83.9%
associate-*r/82.0%
Applied egg-rr82.0%
*-commutative82.0%
associate-/l*81.8%
associate-/r/83.9%
Simplified83.9%
Final simplification61.9%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= (/ A (* V l)) 2e-310) (* c0 (sqrt (/ (/ 1.0 l) (/ V A)))) (/ c0 (sqrt (/ (* V l) A)))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((A / (V * l)) <= 2e-310) {
tmp = c0 * sqrt(((1.0 / l) / (V / A)));
} 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) :: tmp
if ((a / (v * l)) <= 2d-310) then
tmp = c0 * sqrt(((1.0d0 / l) / (v / a)))
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 tmp;
if ((A / (V * l)) <= 2e-310) {
tmp = c0 * Math.sqrt(((1.0 / l) / (V / A)));
} 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): tmp = 0 if (A / (V * l)) <= 2e-310: tmp = c0 * math.sqrt(((1.0 / l) / (V / A))) 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) tmp = 0.0 if (Float64(A / Float64(V * l)) <= 2e-310) tmp = Float64(c0 * sqrt(Float64(Float64(1.0 / l) / Float64(V / A)))); else tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / 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 ((A / (V * l)) <= 2e-310)
tmp = c0 * sqrt(((1.0 / l) / (V / A)));
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_] := If[LessEqual[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision], 2e-310], N[(c0 * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / N[(V / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{A}{V \cdot \ell} \leq 2 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{1}{\ell}}{\frac{V}{A}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 1.999999999999994e-310Initial program 38.9%
*-un-lft-identity38.9%
times-frac55.8%
Applied egg-rr55.8%
frac-times38.9%
*-commutative38.9%
frac-times54.1%
clear-num54.1%
associate-*l/54.1%
*-un-lft-identity54.1%
Applied egg-rr54.1%
if 1.999999999999994e-310 < (/.f64 A (*.f64 V l)) Initial program 85.5%
associate-/r*77.4%
clear-num77.3%
sqrt-div77.7%
metadata-eval77.7%
div-inv76.8%
clear-num77.0%
Applied egg-rr77.0%
associate-*r/87.0%
*-commutative87.0%
*-lft-identity87.0%
times-frac82.6%
remove-double-div82.6%
associate-/r*82.6%
*-rgt-identity82.6%
remove-double-div82.6%
Simplified82.6%
inv-pow82.6%
sqrt-pow282.7%
metadata-eval82.7%
Applied egg-rr82.7%
expm1-log1p-u57.8%
expm1-udef29.9%
metadata-eval29.9%
pow-flip29.9%
pow1/229.9%
div-inv29.9%
sqrt-prod17.4%
associate-/l/17.4%
div-inv17.4%
div-inv17.4%
associate-/l/17.4%
sqrt-prod29.9%
Applied egg-rr29.9%
expm1-def57.8%
expm1-log1p82.7%
associate-*r/87.0%
Simplified87.0%
Final simplification80.5%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= (/ A (* V l)) 2e-310) (* c0 (sqrt (/ (/ A V) l))) (/ c0 (sqrt (/ (* V l) A)))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((A / (V * l)) <= 2e-310) {
tmp = c0 * sqrt(((A / V) / l));
} 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) :: tmp
if ((a / (v * l)) <= 2d-310) then
tmp = c0 * sqrt(((a / v) / l))
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 tmp;
if ((A / (V * l)) <= 2e-310) {
tmp = c0 * Math.sqrt(((A / V) / l));
} 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): tmp = 0 if (A / (V * l)) <= 2e-310: tmp = c0 * math.sqrt(((A / V) / l)) 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) tmp = 0.0 if (Float64(A / Float64(V * l)) <= 2e-310) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); else tmp = Float64(c0 / sqrt(Float64(Float64(V * l) / 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 ((A / (V * l)) <= 2e-310)
tmp = c0 * sqrt(((A / V) / l));
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_] := If[LessEqual[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision], 2e-310], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{A}{V \cdot \ell} \leq 2 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 1.999999999999994e-310Initial program 38.9%
*-commutative38.9%
associate-/l/54.1%
Simplified54.1%
if 1.999999999999994e-310 < (/.f64 A (*.f64 V l)) Initial program 85.5%
associate-/r*77.4%
clear-num77.3%
sqrt-div77.7%
metadata-eval77.7%
div-inv76.8%
clear-num77.0%
Applied egg-rr77.0%
associate-*r/87.0%
*-commutative87.0%
*-lft-identity87.0%
times-frac82.6%
remove-double-div82.6%
associate-/r*82.6%
*-rgt-identity82.6%
remove-double-div82.6%
Simplified82.6%
inv-pow82.6%
sqrt-pow282.7%
metadata-eval82.7%
Applied egg-rr82.7%
expm1-log1p-u57.8%
expm1-udef29.9%
metadata-eval29.9%
pow-flip29.9%
pow1/229.9%
div-inv29.9%
sqrt-prod17.4%
associate-/l/17.4%
div-inv17.4%
div-inv17.4%
associate-/l/17.4%
sqrt-prod29.9%
Applied egg-rr29.9%
expm1-def57.8%
expm1-log1p82.7%
associate-*r/87.0%
Simplified87.0%
Final simplification80.5%
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 76.2%
Final simplification76.2%
herbie shell --seed 2024041
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))