
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
code = c0 * sqrt((a / (v * l)))
end function
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
function tmp = code(c0, A, V, l) tmp = c0 * sqrt((A / (V * l))); end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
code = c0 * sqrt((a / (v * l)))
end function
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
function tmp = code(c0, A, V, l) tmp = c0 * sqrt((A / (V * l))); end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (* c0 (/ (sqrt (/ (- A) l)) (sqrt (- V))))))
(if (<= (* V l) -1e+306)
t_0
(if (<= (* V l) -1e-287)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 1e-164)
(* c0 (sqrt (/ (/ 1.0 V) (/ l A))))
(if (<= (* V l) 1e+306) (/ (* c0 (sqrt A)) (sqrt (* 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 / l)) / sqrt(-V));
double tmp;
if ((V * l) <= -1e+306) {
tmp = t_0;
} else if ((V * l) <= -1e-287) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 1e-164) {
tmp = c0 * sqrt(((1.0 / V) / (l / A)));
} else if ((V * l) <= 1e+306) {
tmp = (c0 * sqrt(A)) / sqrt((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 / l)) / sqrt(-v))
if ((v * l) <= (-1d+306)) then
tmp = t_0
else if ((v * l) <= (-1d-287)) then
tmp = c0 * (sqrt(-a) / sqrt((v * -l)))
else if ((v * l) <= 1d-164) then
tmp = c0 * sqrt(((1.0d0 / v) / (l / a)))
else if ((v * l) <= 1d+306) then
tmp = (c0 * sqrt(a)) / sqrt((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 / l)) / Math.sqrt(-V));
double tmp;
if ((V * l) <= -1e+306) {
tmp = t_0;
} else if ((V * l) <= -1e-287) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 1e-164) {
tmp = c0 * Math.sqrt(((1.0 / V) / (l / A)));
} else if ((V * l) <= 1e+306) {
tmp = (c0 * Math.sqrt(A)) / Math.sqrt((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 / l)) / math.sqrt(-V)) tmp = 0 if (V * l) <= -1e+306: tmp = t_0 elif (V * l) <= -1e-287: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 1e-164: tmp = c0 * math.sqrt(((1.0 / V) / (l / A))) elif (V * l) <= 1e+306: tmp = (c0 * math.sqrt(A)) / math.sqrt((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 * Float64(sqrt(Float64(Float64(-A) / l)) / sqrt(Float64(-V)))) tmp = 0.0 if (Float64(V * l) <= -1e+306) tmp = t_0; elseif (Float64(V * l) <= -1e-287) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 1e-164) tmp = Float64(c0 * sqrt(Float64(Float64(1.0 / V) / Float64(l / A)))); elseif (Float64(V * l) <= 1e+306) tmp = Float64(Float64(c0 * sqrt(A)) / sqrt(Float64(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 / l)) / sqrt(-V));
tmp = 0.0;
if ((V * l) <= -1e+306)
tmp = t_0;
elseif ((V * l) <= -1e-287)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 1e-164)
tmp = c0 * sqrt(((1.0 / V) / (l / A)));
elseif ((V * l) <= 1e+306)
tmp = (c0 * sqrt(A)) / sqrt((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[(N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -1e+306], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], -1e-287], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e-164], N[(c0 * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] / N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+306], N[(N[(c0 * N[Sqrt[A], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(V * 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 \frac{\sqrt{\frac{-A}{\ell}}}{\sqrt{-V}}\\
\mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+306}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-287}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{-164}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{1}{V}}{\frac{\ell}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+306}:\\
\;\;\;\;\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (*.f64 V l) < -1.00000000000000002e306 or 1.00000000000000002e306 < (*.f64 V l) Initial program 36.1%
associate-/r*58.7%
div-inv58.8%
Applied egg-rr58.8%
*-commutative58.8%
clear-num58.8%
un-div-inv58.9%
Applied egg-rr58.9%
associate-/l/58.8%
associate-*l/36.1%
clear-num36.1%
associate-/l/58.8%
frac-2neg58.8%
sqrt-div51.6%
distribute-neg-frac51.6%
Applied egg-rr51.6%
if -1.00000000000000002e306 < (*.f64 V l) < -1.00000000000000002e-287Initial 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 -1.00000000000000002e-287 < (*.f64 V l) < 9.99999999999999962e-165Initial program 60.0%
associate-/r*78.5%
div-inv78.5%
Applied egg-rr78.5%
*-un-lft-identity78.5%
associate-*l/78.5%
div-inv78.5%
associate-/l*80.3%
Applied egg-rr80.3%
if 9.99999999999999962e-165 < (*.f64 V l) < 1.00000000000000002e306Initial program 89.1%
*-commutative89.1%
sqrt-div99.3%
associate-*l/97.9%
Applied egg-rr97.9%
Final simplification89.8%
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 -5e-310) (* c0 (* (/ (sqrt (- A)) (sqrt (- V))) (/ 1.0 (sqrt l)))) (* (sqrt A) (/ c0 (sqrt (* V l))))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (A <= -5e-310) {
tmp = c0 * ((sqrt(-A) / sqrt(-V)) * (1.0 / sqrt(l)));
} else {
tmp = sqrt(A) * (c0 / 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 <= (-5d-310)) then
tmp = c0 * ((sqrt(-a) / sqrt(-v)) * (1.0d0 / sqrt(l)))
else
tmp = sqrt(a) * (c0 / 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 <= -5e-310) {
tmp = c0 * ((Math.sqrt(-A) / Math.sqrt(-V)) * (1.0 / Math.sqrt(l)));
} else {
tmp = Math.sqrt(A) * (c0 / 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 <= -5e-310: tmp = c0 * ((math.sqrt(-A) / math.sqrt(-V)) * (1.0 / math.sqrt(l))) else: tmp = math.sqrt(A) * (c0 / 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 <= -5e-310) tmp = Float64(c0 * Float64(Float64(sqrt(Float64(-A)) / sqrt(Float64(-V))) * Float64(1.0 / sqrt(l)))); else tmp = Float64(sqrt(A) * Float64(c0 / 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 <= -5e-310)
tmp = c0 * ((sqrt(-A) / sqrt(-V)) * (1.0 / sqrt(l)));
else
tmp = sqrt(A) * (c0 / 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, -5e-310], N[(c0 * N[(N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[A], $MachinePrecision] * N[(c0 / 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 -5 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \left(\frac{\sqrt{-A}}{\sqrt{-V}} \cdot \frac{1}{\sqrt{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{A} \cdot \frac{c0}{\sqrt{V \cdot \ell}}\\
\end{array}
\end{array}
if A < -4.999999999999985e-310Initial program 75.9%
associate-/r*77.3%
sqrt-div50.9%
div-inv50.8%
Applied egg-rr50.8%
frac-2neg50.8%
sqrt-div56.2%
Applied egg-rr56.2%
if -4.999999999999985e-310 < A Initial program 77.4%
associate-/r*76.0%
div-inv76.0%
Applied egg-rr76.0%
un-div-inv76.0%
sqrt-div46.6%
associate-*r/45.0%
sqrt-div49.8%
associate-*r/48.7%
*-commutative48.7%
associate-/r*48.7%
sqrt-prod80.9%
clear-num80.9%
*-commutative80.9%
Applied egg-rr80.9%
associate-/r/80.9%
associate-*l/80.9%
*-lft-identity80.9%
associate-*l/81.6%
*-commutative81.6%
Simplified81.6%
Final simplification67.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 (<= (* V l) -1e+306)
(/ (* c0 (sqrt (/ A V))) (sqrt l))
(if (<= (* V l) -1e-287)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 2e-274)
(* c0 (/ 1.0 (sqrt (/ V (/ A l)))))
(* (sqrt A) (/ c0 (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) <= -1e+306) {
tmp = (c0 * sqrt((A / V))) / sqrt(l);
} else if ((V * l) <= -1e-287) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 2e-274) {
tmp = c0 * (1.0 / sqrt((V / (A / l))));
} else {
tmp = sqrt(A) * (c0 / 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) <= (-1d+306)) then
tmp = (c0 * sqrt((a / v))) / sqrt(l)
else if ((v * l) <= (-1d-287)) then
tmp = c0 * (sqrt(-a) / sqrt((v * -l)))
else if ((v * l) <= 2d-274) then
tmp = c0 * (1.0d0 / sqrt((v / (a / l))))
else
tmp = sqrt(a) * (c0 / 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) <= -1e+306) {
tmp = (c0 * Math.sqrt((A / V))) / Math.sqrt(l);
} else if ((V * l) <= -1e-287) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 2e-274) {
tmp = c0 * (1.0 / Math.sqrt((V / (A / l))));
} else {
tmp = Math.sqrt(A) * (c0 / 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) <= -1e+306: tmp = (c0 * math.sqrt((A / V))) / math.sqrt(l) elif (V * l) <= -1e-287: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 2e-274: tmp = c0 * (1.0 / math.sqrt((V / (A / l)))) else: tmp = math.sqrt(A) * (c0 / 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) <= -1e+306) tmp = Float64(Float64(c0 * sqrt(Float64(A / V))) / sqrt(l)); elseif (Float64(V * l) <= -1e-287) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 2e-274) tmp = Float64(c0 * Float64(1.0 / sqrt(Float64(V / Float64(A / l))))); else tmp = Float64(sqrt(A) * Float64(c0 / 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) <= -1e+306)
tmp = (c0 * sqrt((A / V))) / sqrt(l);
elseif ((V * l) <= -1e-287)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 2e-274)
tmp = c0 * (1.0 / sqrt((V / (A / l))));
else
tmp = sqrt(A) * (c0 / 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[N[(V * l), $MachinePrecision], -1e+306], N[(N[(c0 * N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-287], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e-274], N[(c0 * N[(1.0 / N[Sqrt[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[A], $MachinePrecision] * N[(c0 / 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 -1 \cdot 10^{+306}:\\
\;\;\;\;\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-287}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-274}:\\
\;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{A} \cdot \frac{c0}{\sqrt{V \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -1.00000000000000002e306Initial program 43.7%
*-commutative43.7%
associate-/r*66.5%
sqrt-div47.4%
associate-*l/47.5%
Applied egg-rr47.5%
if -1.00000000000000002e306 < (*.f64 V l) < -1.00000000000000002e-287Initial 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 -1.00000000000000002e-287 < (*.f64 V l) < 1.99999999999999993e-274Initial program 48.3%
associate-/r*76.0%
div-inv75.9%
Applied egg-rr75.9%
*-commutative75.9%
clear-num75.9%
un-div-inv75.9%
Applied egg-rr75.9%
clear-num75.9%
sqrt-div75.9%
metadata-eval75.9%
clear-num75.9%
associate-/l/75.9%
associate-*l/48.3%
clear-num48.3%
associate-/l/76.0%
clear-num76.0%
div-inv76.0%
clear-num75.9%
Applied egg-rr75.9%
associate-*r/48.3%
associate-/l*76.0%
Simplified76.0%
if 1.99999999999999993e-274 < (*.f64 V l) Initial program 81.1%
associate-/r*75.0%
div-inv75.0%
Applied egg-rr75.0%
un-div-inv75.0%
sqrt-div44.9%
associate-*r/43.9%
sqrt-div48.7%
associate-*r/47.3%
*-commutative47.3%
associate-/r*47.4%
sqrt-prod85.4%
clear-num85.4%
*-commutative85.4%
Applied egg-rr85.4%
associate-/r/85.4%
associate-*l/85.4%
*-lft-identity85.4%
associate-*l/87.1%
*-commutative87.1%
Simplified87.1%
Final simplification88.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 (<= l -2e-310) (* (sqrt A) (/ c0 (sqrt (* 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 (l <= -2e-310) {
tmp = sqrt(A) * (c0 / sqrt((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 (l <= (-2d-310)) then
tmp = sqrt(a) * (c0 / sqrt((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 (l <= -2e-310) {
tmp = Math.sqrt(A) * (c0 / Math.sqrt((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 l <= -2e-310: tmp = math.sqrt(A) * (c0 / math.sqrt((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 (l <= -2e-310) tmp = Float64(sqrt(A) * Float64(c0 / sqrt(Float64(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 (l <= -2e-310)
tmp = sqrt(A) * (c0 / sqrt((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[l, -2e-310], N[(N[Sqrt[A], $MachinePrecision] * N[(c0 / N[Sqrt[N[(V * 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}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{A} \cdot \frac{c0}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 73.9%
associate-/r*72.1%
div-inv72.1%
Applied egg-rr72.1%
un-div-inv72.1%
sqrt-div0.0%
associate-*r/0.0%
sqrt-div0.0%
associate-*r/0.0%
*-commutative0.0%
associate-/r*0.0%
sqrt-prod36.0%
clear-num35.9%
*-commutative35.9%
Applied egg-rr35.9%
associate-/r/35.9%
associate-*l/36.0%
*-lft-identity36.0%
associate-*l/37.7%
*-commutative37.7%
Simplified37.7%
if -1.999999999999994e-310 < l Initial program 78.8%
associate-/r*80.5%
sqrt-div90.1%
associate-*r/88.4%
Applied egg-rr88.4%
associate-/l*90.1%
Simplified90.1%
Final simplification66.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 (* V (/ l A))) (t_1 (/ A (* V l))))
(if (<= t_1 0.0)
(* c0 (sqrt (/ 1.0 t_0)))
(if (<= t_1 5e+247) (* c0 (sqrt t_1)) (* c0 (/ 1.0 (sqrt t_0)))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = V * (l / A);
double t_1 = A / (V * l);
double tmp;
if (t_1 <= 0.0) {
tmp = c0 * sqrt((1.0 / t_0));
} else if (t_1 <= 5e+247) {
tmp = c0 * sqrt(t_1);
} else {
tmp = c0 * (1.0 / 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) :: t_1
real(8) :: tmp
t_0 = v * (l / a)
t_1 = a / (v * l)
if (t_1 <= 0.0d0) then
tmp = c0 * sqrt((1.0d0 / t_0))
else if (t_1 <= 5d+247) then
tmp = c0 * sqrt(t_1)
else
tmp = c0 * (1.0d0 / 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 = V * (l / A);
double t_1 = A / (V * l);
double tmp;
if (t_1 <= 0.0) {
tmp = c0 * Math.sqrt((1.0 / t_0));
} else if (t_1 <= 5e+247) {
tmp = c0 * Math.sqrt(t_1);
} else {
tmp = c0 * (1.0 / Math.sqrt(t_0));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = V * (l / A) t_1 = A / (V * l) tmp = 0 if t_1 <= 0.0: tmp = c0 * math.sqrt((1.0 / t_0)) elif t_1 <= 5e+247: tmp = c0 * math.sqrt(t_1) else: tmp = c0 * (1.0 / math.sqrt(t_0)) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(V * Float64(l / A)) t_1 = Float64(A / Float64(V * l)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(c0 * sqrt(Float64(1.0 / t_0))); elseif (t_1 <= 5e+247) tmp = Float64(c0 * sqrt(t_1)); else tmp = Float64(c0 * Float64(1.0 / 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 = V * (l / A);
t_1 = A / (V * l);
tmp = 0.0;
if (t_1 <= 0.0)
tmp = c0 * sqrt((1.0 / t_0));
elseif (t_1 <= 5e+247)
tmp = c0 * sqrt(t_1);
else
tmp = c0 * (1.0 / 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[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(c0 * N[Sqrt[N[(1.0 / t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+247], N[(c0 * N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision], N[(c0 * N[(1.0 / N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := V \cdot \frac{\ell}{A}\\
t_1 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{t_0}}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+247}:\\
\;\;\;\;c0 \cdot \sqrt{t_1}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{1}{\sqrt{t_0}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 38.0%
associate-/r*53.8%
div-inv53.8%
Applied egg-rr53.8%
*-commutative53.8%
div-inv53.8%
associate-*r*53.8%
associate-/r/53.8%
frac-times53.8%
metadata-eval53.8%
Applied egg-rr53.8%
if 0.0 < (/.f64 A (*.f64 V l)) < 5.00000000000000023e247Initial program 97.5%
if 5.00000000000000023e247 < (/.f64 A (*.f64 V l)) Initial program 47.4%
associate-/r*62.3%
clear-num62.3%
sqrt-div63.7%
metadata-eval63.7%
div-inv63.7%
clear-num65.4%
Applied egg-rr65.4%
associate-*r/48.9%
*-commutative48.9%
*-lft-identity48.9%
times-frac60.6%
remove-double-div60.6%
associate-/r*60.6%
*-rgt-identity60.6%
remove-double-div60.6%
Simplified60.6%
Final simplification82.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 (<= t_0 0.0)
(* c0 (sqrt (/ 1.0 (* V (/ l A)))))
(if (<= t_0 5e+247)
(* c0 (sqrt t_0))
(* c0 (/ 1.0 (sqrt (/ V (/ A l)))))))))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((1.0 / (V * (l / A))));
} else if (t_0 <= 5e+247) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 * (1.0 / sqrt((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) :: t_0
real(8) :: tmp
t_0 = a / (v * l)
if (t_0 <= 0.0d0) then
tmp = c0 * sqrt((1.0d0 / (v * (l / a))))
else if (t_0 <= 5d+247) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 * (1.0d0 / sqrt((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 t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * Math.sqrt((1.0 / (V * (l / A))));
} else if (t_0 <= 5e+247) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 * (1.0 / Math.sqrt((V / (A / l))));
}
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((1.0 / (V * (l / A)))) elif t_0 <= 5e+247: tmp = c0 * math.sqrt(t_0) else: tmp = c0 * (1.0 / math.sqrt((V / (A / l)))) 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(1.0 / Float64(V * Float64(l / A))))); elseif (t_0 <= 5e+247) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 * Float64(1.0 / sqrt(Float64(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)
t_0 = A / (V * l);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = c0 * sqrt((1.0 / (V * (l / A))));
elseif (t_0 <= 5e+247)
tmp = c0 * sqrt(t_0);
else
tmp = c0 * (1.0 / sqrt((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_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(c0 * N[Sqrt[N[(1.0 / N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+247], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 * N[(1.0 / N[Sqrt[N[(V / N[(A / l), $MachinePrecision]), $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{1}{V \cdot \frac{\ell}{A}}}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+247}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 38.0%
associate-/r*53.8%
div-inv53.8%
Applied egg-rr53.8%
*-commutative53.8%
div-inv53.8%
associate-*r*53.8%
associate-/r/53.8%
frac-times53.8%
metadata-eval53.8%
Applied egg-rr53.8%
if 0.0 < (/.f64 A (*.f64 V l)) < 5.00000000000000023e247Initial program 97.5%
if 5.00000000000000023e247 < (/.f64 A (*.f64 V l)) Initial program 47.4%
associate-/r*62.3%
div-inv62.3%
Applied egg-rr62.3%
*-commutative62.3%
clear-num62.3%
un-div-inv63.9%
Applied egg-rr63.9%
clear-num63.9%
sqrt-div65.4%
metadata-eval65.4%
clear-num63.9%
associate-/l/63.9%
associate-*l/47.4%
clear-num47.4%
associate-/l/60.6%
clear-num60.6%
div-inv60.6%
clear-num60.6%
Applied egg-rr60.6%
associate-*r/48.9%
associate-/l*60.6%
Simplified60.6%
Final simplification82.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 2e+281)))
(* 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 <= 2e+281)) {
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 <= 2d+281))) 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 <= 2e+281)) {
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 <= 2e+281): 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 <= 2e+281)) 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 <= 2e+281)))
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, 2e+281]], $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 2 \cdot 10^{+281}\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 2.0000000000000001e281 < (/.f64 A (*.f64 V l)) Initial program 40.5%
associate-/r*57.4%
Simplified57.4%
if 0.0 < (/.f64 A (*.f64 V l)) < 2.0000000000000001e281Initial program 97.5%
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 (/ A (* V l))))
(if (<= t_0 0.0)
(* c0 (sqrt (/ (/ A V) l)))
(if (<= t_0 5e+247) (* c0 (sqrt t_0)) (* c0 (sqrt (/ (/ A l) V)))))))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+247) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 * sqrt(((A / l) / V));
}
return tmp;
}
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = a / (v * l)
if (t_0 <= 0.0d0) then
tmp = c0 * sqrt(((a / v) / l))
else if (t_0 <= 5d+247) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 * sqrt(((a / l) / v))
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else if (t_0 <= 5e+247) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 * Math.sqrt(((A / l) / V));
}
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+247: tmp = c0 * math.sqrt(t_0) else: tmp = c0 * math.sqrt(((A / l) / V)) 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+247) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V))); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (V * l);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = c0 * sqrt(((A / V) / l));
elseif (t_0 <= 5e+247)
tmp = c0 * sqrt(t_0);
else
tmp = c0 * sqrt(((A / l) / V));
end
tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(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+247], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $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^{+247}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 38.0%
associate-/r*53.8%
Simplified53.8%
if 0.0 < (/.f64 A (*.f64 V l)) < 5.00000000000000023e247Initial program 97.5%
if 5.00000000000000023e247 < (/.f64 A (*.f64 V l)) Initial program 47.4%
associate-/r*62.3%
div-inv62.3%
Applied egg-rr62.3%
associate-*l/60.6%
div-inv60.6%
Applied egg-rr60.6%
Final simplification82.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 (<= t_0 0.0)
(* c0 (sqrt (/ 1.0 (* V (/ l A)))))
(if (<= t_0 5e+247) (* c0 (sqrt t_0)) (* c0 (sqrt (/ (/ A l) V)))))))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((1.0 / (V * (l / A))));
} else if (t_0 <= 5e+247) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 * sqrt(((A / l) / V));
}
return tmp;
}
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = a / (v * l)
if (t_0 <= 0.0d0) then
tmp = c0 * sqrt((1.0d0 / (v * (l / a))))
else if (t_0 <= 5d+247) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 * sqrt(((a / l) / v))
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * Math.sqrt((1.0 / (V * (l / A))));
} else if (t_0 <= 5e+247) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 * Math.sqrt(((A / l) / V));
}
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((1.0 / (V * (l / A)))) elif t_0 <= 5e+247: tmp = c0 * math.sqrt(t_0) else: tmp = c0 * math.sqrt(((A / l) / V)) 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(1.0 / Float64(V * Float64(l / A))))); elseif (t_0 <= 5e+247) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V))); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (V * l);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = c0 * sqrt((1.0 / (V * (l / A))));
elseif (t_0 <= 5e+247)
tmp = c0 * sqrt(t_0);
else
tmp = c0 * sqrt(((A / l) / V));
end
tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(c0 * N[Sqrt[N[(1.0 / N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+247], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $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{1}{V \cdot \frac{\ell}{A}}}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+247}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 38.0%
associate-/r*53.8%
div-inv53.8%
Applied egg-rr53.8%
*-commutative53.8%
div-inv53.8%
associate-*r*53.8%
associate-/r/53.8%
frac-times53.8%
metadata-eval53.8%
Applied egg-rr53.8%
if 0.0 < (/.f64 A (*.f64 V l)) < 5.00000000000000023e247Initial program 97.5%
if 5.00000000000000023e247 < (/.f64 A (*.f64 V l)) Initial program 47.4%
associate-/r*62.3%
div-inv62.3%
Applied egg-rr62.3%
associate-*l/60.6%
div-inv60.6%
Applied egg-rr60.6%
Final simplification82.1%
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.6%
Final simplification76.6%
herbie shell --seed 2023333
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))