
(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: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* l V) (- INFINITY))
(* c0 (/ (sqrt (/ A V)) (sqrt l)))
(if (<= (* l V) -5e-211)
(* c0 (/ (sqrt (- A)) (sqrt (* l (- V)))))
(if (<= (* l V) 2e-314)
(/ c0 (sqrt (/ V (/ A l))))
(if (<= (* l V) 1e+175)
(/ c0 (/ (sqrt (* l V)) (sqrt A)))
(* c0 (sqrt (/ (/ A V) l))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((l * V) <= -((double) INFINITY)) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else if ((l * V) <= -5e-211) {
tmp = c0 * (sqrt(-A) / sqrt((l * -V)));
} else if ((l * V) <= 2e-314) {
tmp = c0 / sqrt((V / (A / l)));
} else if ((l * V) <= 1e+175) {
tmp = c0 / (sqrt((l * V)) / sqrt(A));
} else {
tmp = c0 * sqrt(((A / V) / l));
}
return tmp;
}
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((l * V) <= -Double.POSITIVE_INFINITY) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else if ((l * V) <= -5e-211) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((l * -V)));
} else if ((l * V) <= 2e-314) {
tmp = c0 / Math.sqrt((V / (A / l)));
} else if ((l * V) <= 1e+175) {
tmp = c0 / (Math.sqrt((l * V)) / Math.sqrt(A));
} else {
tmp = c0 * Math.sqrt(((A / V) / l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (l * V) <= -math.inf: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) elif (l * V) <= -5e-211: tmp = c0 * (math.sqrt(-A) / math.sqrt((l * -V))) elif (l * V) <= 2e-314: tmp = c0 / math.sqrt((V / (A / l))) elif (l * V) <= 1e+175: tmp = c0 / (math.sqrt((l * V)) / math.sqrt(A)) else: tmp = c0 * math.sqrt(((A / V) / l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(l * V) <= Float64(-Inf)) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); elseif (Float64(l * V) <= -5e-211) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(l * Float64(-V))))); elseif (Float64(l * V) <= 2e-314) tmp = Float64(c0 / sqrt(Float64(V / Float64(A / l)))); elseif (Float64(l * V) <= 1e+175) tmp = Float64(c0 / Float64(sqrt(Float64(l * V)) / sqrt(A))); else tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if ((l * V) <= -Inf)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
elseif ((l * V) <= -5e-211)
tmp = c0 * (sqrt(-A) / sqrt((l * -V)));
elseif ((l * V) <= 2e-314)
tmp = c0 / sqrt((V / (A / l)));
elseif ((l * V) <= 1e+175)
tmp = c0 / (sqrt((l * V)) / sqrt(A));
else
tmp = c0 * sqrt(((A / V) / l));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[N[(l * V), $MachinePrecision], (-Infinity)], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(l * V), $MachinePrecision], -5e-211], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(l * (-V)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(l * V), $MachinePrecision], 2e-314], N[(c0 / N[Sqrt[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(l * V), $MachinePrecision], 1e+175], N[(c0 / N[(N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot V \leq -\infty:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;\ell \cdot V \leq -5 \cdot 10^{-211}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{\ell \cdot \left(-V\right)}}\\
\mathbf{elif}\;\ell \cdot V \leq 2 \cdot 10^{-314}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\
\mathbf{elif}\;\ell \cdot V \leq 10^{+175}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{\ell \cdot V}}{\sqrt{A}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 34.0%
associate-/r*57.1%
sqrt-div40.9%
Applied egg-rr40.9%
if -inf.0 < (*.f64 V l) < -5.0000000000000002e-211Initial program 89.0%
frac-2neg89.0%
sqrt-div99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
Applied egg-rr99.3%
if -5.0000000000000002e-211 < (*.f64 V l) < 1.9999999999e-314Initial program 37.2%
associate-/r*68.8%
div-inv68.8%
Applied egg-rr68.8%
associate-*l/68.7%
div-inv68.8%
*-un-lft-identity68.8%
associate-*l/68.8%
expm1-log1p-u39.4%
expm1-udef29.9%
Applied egg-rr16.2%
expm1-def16.2%
expm1-log1p37.2%
associate-*l/68.8%
*-commutative68.8%
Simplified68.8%
*-commutative68.8%
associate-/r/68.8%
Applied egg-rr68.8%
if 1.9999999999e-314 < (*.f64 V l) < 9.9999999999999994e174Initial program 88.1%
sqrt-div99.2%
associate-*r/96.3%
Applied egg-rr96.3%
associate-/l*99.2%
Simplified99.2%
if 9.9999999999999994e174 < (*.f64 V l) Initial program 57.9%
associate-/r*80.4%
div-inv80.3%
Applied egg-rr80.3%
un-div-inv80.4%
Applied egg-rr80.4%
Final simplification88.1%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= l -2e-311) (* c0 (exp (* -0.5 (- (- (- (log A)) (log (/ -1.0 V))) (log (/ -1.0 l)))))) (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -2e-311) {
tmp = c0 * exp((-0.5 * ((-log(A) - log((-1.0 / V))) - log((-1.0 / l)))));
} else {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
}
return tmp;
}
NOTE: 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-311)) then
tmp = c0 * exp(((-0.5d0) * ((-log(a) - log(((-1.0d0) / v))) - log(((-1.0d0) / l)))))
else
tmp = c0 * (sqrt((a / v)) / sqrt(l))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -2e-311) {
tmp = c0 * Math.exp((-0.5 * ((-Math.log(A) - Math.log((-1.0 / V))) - Math.log((-1.0 / l)))));
} else {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if l <= -2e-311: tmp = c0 * math.exp((-0.5 * ((-math.log(A) - math.log((-1.0 / V))) - math.log((-1.0 / l))))) else: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (l <= -2e-311) tmp = Float64(c0 * exp(Float64(-0.5 * Float64(Float64(Float64(-log(A)) - log(Float64(-1.0 / V))) - log(Float64(-1.0 / l)))))); else tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (l <= -2e-311)
tmp = c0 * exp((-0.5 * ((-log(A) - log((-1.0 / V))) - log((-1.0 / l)))));
else
tmp = c0 * (sqrt((A / V)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[l, -2e-311], N[(c0 * N[Exp[N[(-0.5 * N[(N[((-N[Log[A], $MachinePrecision]) - N[Log[N[(-1.0 / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Log[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-311}:\\
\;\;\;\;c0 \cdot e^{-0.5 \cdot \left(\left(\left(-\log A\right) - \log \left(\frac{-1}{V}\right)\right) - \log \left(\frac{-1}{\ell}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.9999999999999e-311Initial program 71.8%
pow1/271.8%
clear-num70.8%
inv-pow70.8%
pow-pow71.9%
associate-/l*74.9%
metadata-eval74.9%
Applied egg-rr74.9%
associate-/l*71.9%
*-lft-identity71.9%
times-frac75.2%
/-rgt-identity75.2%
Simplified75.2%
Taylor expanded in V around -inf 42.2%
Taylor expanded in l around -inf 46.1%
associate-+r+46.1%
mul-1-neg46.1%
unsub-neg46.1%
mul-1-neg46.1%
unsub-neg46.1%
log-rec46.1%
Simplified46.1%
if -1.9999999999999e-311 < l Initial program 73.5%
associate-/r*79.4%
sqrt-div88.6%
Applied egg-rr88.6%
Final simplification67.2%
NOTE: 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)) (sqrt l)))))
(if (<= (* l V) -1e+162)
t_0
(if (<= (* l V) -4e-149)
(* c0 (sqrt (/ A (* l V))))
(if (<= (* l V) 5e-324)
t_0
(if (<= (* l V) 1e+175)
(/ c0 (/ (sqrt (* l V)) (sqrt A)))
(* c0 (sqrt (/ (/ A V) l)))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 * (sqrt((A / V)) / sqrt(l));
double tmp;
if ((l * V) <= -1e+162) {
tmp = t_0;
} else if ((l * V) <= -4e-149) {
tmp = c0 * sqrt((A / (l * V)));
} else if ((l * V) <= 5e-324) {
tmp = t_0;
} else if ((l * V) <= 1e+175) {
tmp = c0 / (sqrt((l * V)) / sqrt(A));
} else {
tmp = c0 * sqrt(((A / V) / l));
}
return tmp;
}
NOTE: 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)) / sqrt(l))
if ((l * v) <= (-1d+162)) then
tmp = t_0
else if ((l * v) <= (-4d-149)) then
tmp = c0 * sqrt((a / (l * v)))
else if ((l * v) <= 5d-324) then
tmp = t_0
else if ((l * v) <= 1d+175) then
tmp = c0 / (sqrt((l * v)) / sqrt(a))
else
tmp = c0 * sqrt(((a / v) / l))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
double tmp;
if ((l * V) <= -1e+162) {
tmp = t_0;
} else if ((l * V) <= -4e-149) {
tmp = c0 * Math.sqrt((A / (l * V)));
} else if ((l * V) <= 5e-324) {
tmp = t_0;
} else if ((l * V) <= 1e+175) {
tmp = c0 / (Math.sqrt((l * V)) / Math.sqrt(A));
} else {
tmp = c0 * Math.sqrt(((A / V) / l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = c0 * (math.sqrt((A / V)) / math.sqrt(l)) tmp = 0 if (l * V) <= -1e+162: tmp = t_0 elif (l * V) <= -4e-149: tmp = c0 * math.sqrt((A / (l * V))) elif (l * V) <= 5e-324: tmp = t_0 elif (l * V) <= 1e+175: tmp = c0 / (math.sqrt((l * V)) / math.sqrt(A)) else: tmp = c0 * math.sqrt(((A / V) / l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))) tmp = 0.0 if (Float64(l * V) <= -1e+162) tmp = t_0; elseif (Float64(l * V) <= -4e-149) tmp = Float64(c0 * sqrt(Float64(A / Float64(l * V)))); elseif (Float64(l * V) <= 5e-324) tmp = t_0; elseif (Float64(l * V) <= 1e+175) tmp = Float64(c0 / Float64(sqrt(Float64(l * V)) / sqrt(A))); else tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = c0 * (sqrt((A / V)) / sqrt(l));
tmp = 0.0;
if ((l * V) <= -1e+162)
tmp = t_0;
elseif ((l * V) <= -4e-149)
tmp = c0 * sqrt((A / (l * V)));
elseif ((l * V) <= 5e-324)
tmp = t_0;
elseif ((l * V) <= 1e+175)
tmp = c0 / (sqrt((l * V)) / sqrt(A));
else
tmp = c0 * sqrt(((A / V) / l));
end
tmp_2 = tmp;
end
NOTE: 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 / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(l * V), $MachinePrecision], -1e+162], t$95$0, If[LessEqual[N[(l * V), $MachinePrecision], -4e-149], N[(c0 * N[Sqrt[N[(A / N[(l * V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(l * V), $MachinePrecision], 5e-324], t$95$0, If[LessEqual[N[(l * V), $MachinePrecision], 1e+175], N[(c0 / N[(N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{if}\;\ell \cdot V \leq -1 \cdot 10^{+162}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \cdot V \leq -4 \cdot 10^{-149}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{A}{\ell \cdot V}}\\
\mathbf{elif}\;\ell \cdot V \leq 5 \cdot 10^{-324}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \cdot V \leq 10^{+175}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{\ell \cdot V}}{\sqrt{A}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -9.9999999999999994e161 or -3.99999999999999992e-149 < (*.f64 V l) < 4.94066e-324Initial program 50.8%
associate-/r*67.5%
sqrt-div44.4%
Applied egg-rr44.4%
if -9.9999999999999994e161 < (*.f64 V l) < -3.99999999999999992e-149Initial program 96.1%
if 4.94066e-324 < (*.f64 V l) < 9.9999999999999994e174Initial program 87.1%
sqrt-div97.8%
associate-*r/95.0%
Applied egg-rr95.0%
associate-/l*97.9%
Simplified97.9%
if 9.9999999999999994e174 < (*.f64 V l) Initial program 57.9%
associate-/r*80.4%
div-inv80.3%
Applied egg-rr80.3%
un-div-inv80.4%
Applied egg-rr80.4%
Final simplification76.7%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= l -4.2e+54)
(* c0 (sqrt (/ (/ A V) l)))
(if (<= l -1.45e-210)
(* (sqrt A) (/ c0 (sqrt (* l V))))
(if (<= l -2e-311)
(/ c0 (sqrt (/ V (/ A l))))
(* c0 (/ (sqrt (/ A V)) (sqrt l)))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -4.2e+54) {
tmp = c0 * sqrt(((A / V) / l));
} else if (l <= -1.45e-210) {
tmp = sqrt(A) * (c0 / sqrt((l * V)));
} else if (l <= -2e-311) {
tmp = c0 / sqrt((V / (A / l)));
} else {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
}
return tmp;
}
NOTE: 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 <= (-4.2d+54)) then
tmp = c0 * sqrt(((a / v) / l))
else if (l <= (-1.45d-210)) then
tmp = sqrt(a) * (c0 / sqrt((l * v)))
else if (l <= (-2d-311)) then
tmp = c0 / sqrt((v / (a / l)))
else
tmp = c0 * (sqrt((a / v)) / sqrt(l))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -4.2e+54) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else if (l <= -1.45e-210) {
tmp = Math.sqrt(A) * (c0 / Math.sqrt((l * V)));
} else if (l <= -2e-311) {
tmp = c0 / Math.sqrt((V / (A / l)));
} else {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if l <= -4.2e+54: tmp = c0 * math.sqrt(((A / V) / l)) elif l <= -1.45e-210: tmp = math.sqrt(A) * (c0 / math.sqrt((l * V))) elif l <= -2e-311: tmp = c0 / math.sqrt((V / (A / l))) else: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (l <= -4.2e+54) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); elseif (l <= -1.45e-210) tmp = Float64(sqrt(A) * Float64(c0 / sqrt(Float64(l * V)))); elseif (l <= -2e-311) tmp = Float64(c0 / sqrt(Float64(V / Float64(A / l)))); else tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (l <= -4.2e+54)
tmp = c0 * sqrt(((A / V) / l));
elseif (l <= -1.45e-210)
tmp = sqrt(A) * (c0 / sqrt((l * V)));
elseif (l <= -2e-311)
tmp = c0 / sqrt((V / (A / l)));
else
tmp = c0 * (sqrt((A / V)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[l, -4.2e+54], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.45e-210], N[(N[Sqrt[A], $MachinePrecision] * N[(c0 / N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-311], N[(c0 / N[Sqrt[N[(V / N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{+54}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{elif}\;\ell \leq -1.45 \cdot 10^{-210}:\\
\;\;\;\;\sqrt{A} \cdot \frac{c0}{\sqrt{\ell \cdot V}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-311}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.19999999999999972e54Initial program 71.4%
associate-/r*71.4%
div-inv71.4%
Applied egg-rr71.4%
un-div-inv71.4%
Applied egg-rr71.4%
if -4.19999999999999972e54 < l < -1.45000000000000003e-210Initial program 78.9%
sqrt-div40.1%
associate-*r/38.4%
Applied egg-rr38.4%
associate-*l/40.1%
Simplified40.1%
if -1.45000000000000003e-210 < l < -1.9999999999999e-311Initial program 49.2%
associate-/r*49.3%
div-inv49.4%
Applied egg-rr49.4%
associate-*l/49.3%
div-inv49.3%
*-un-lft-identity49.3%
associate-*l/49.3%
expm1-log1p-u35.6%
expm1-udef30.0%
Applied egg-rr24.7%
expm1-def30.3%
expm1-log1p49.2%
associate-*l/49.3%
*-commutative49.3%
Simplified49.3%
*-commutative49.3%
associate-/r/49.3%
Applied egg-rr49.3%
if -1.9999999999999e-311 < l Initial program 73.5%
associate-/r*79.4%
sqrt-div88.6%
Applied egg-rr88.6%
Final simplification71.5%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= l -2e-311) (* c0 (/ (sqrt (/ (- A) l)) (sqrt (- V)))) (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -2e-311) {
tmp = c0 * (sqrt((-A / l)) / sqrt(-V));
} else {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
}
return tmp;
}
NOTE: 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-311)) then
tmp = c0 * (sqrt((-a / l)) / sqrt(-v))
else
tmp = c0 * (sqrt((a / v)) / sqrt(l))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -2e-311) {
tmp = c0 * (Math.sqrt((-A / l)) / Math.sqrt(-V));
} else {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if l <= -2e-311: tmp = c0 * (math.sqrt((-A / l)) / math.sqrt(-V)) else: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (l <= -2e-311) tmp = Float64(c0 * Float64(sqrt(Float64(Float64(-A) / l)) / sqrt(Float64(-V)))); else tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (l <= -2e-311)
tmp = c0 * (sqrt((-A / l)) / sqrt(-V));
else
tmp = c0 * (sqrt((A / V)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[l, -2e-311], N[(c0 * N[(N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-311}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{-A}{\ell}}}{\sqrt{-V}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.9999999999999e-311Initial program 71.8%
associate-/r*72.6%
div-inv72.6%
Applied egg-rr72.6%
un-div-inv72.6%
Applied egg-rr72.6%
associate-/r*71.8%
associate-/l/75.5%
frac-2neg75.5%
sqrt-div45.5%
Applied egg-rr45.5%
distribute-neg-frac45.5%
Simplified45.5%
if -1.9999999999999e-311 < l Initial program 73.5%
associate-/r*79.4%
sqrt-div88.6%
Applied egg-rr88.6%
Final simplification66.9%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= l -2e-311) (* c0 (pow (* V (/ l A)) -0.5)) (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -2e-311) {
tmp = c0 * pow((V * (l / A)), -0.5);
} else {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
}
return tmp;
}
NOTE: 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-311)) then
tmp = c0 * ((v * (l / a)) ** (-0.5d0))
else
tmp = c0 * (sqrt((a / v)) / sqrt(l))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -2e-311) {
tmp = c0 * Math.pow((V * (l / A)), -0.5);
} else {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if l <= -2e-311: tmp = c0 * math.pow((V * (l / A)), -0.5) else: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (l <= -2e-311) tmp = Float64(c0 * (Float64(V * Float64(l / A)) ^ -0.5)); else tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (l <= -2e-311)
tmp = c0 * ((V * (l / A)) ^ -0.5);
else
tmp = c0 * (sqrt((A / V)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[l, -2e-311], N[(c0 * N[Power[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-311}:\\
\;\;\;\;c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.9999999999999e-311Initial program 71.8%
pow1/271.8%
clear-num70.8%
inv-pow70.8%
pow-pow71.9%
associate-/l*74.9%
metadata-eval74.9%
Applied egg-rr74.9%
associate-/l*71.9%
*-lft-identity71.9%
times-frac75.2%
/-rgt-identity75.2%
Simplified75.2%
if -1.9999999999999e-311 < l Initial program 73.5%
associate-/r*79.4%
sqrt-div88.6%
Applied egg-rr88.6%
Final simplification81.8%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (/ A (* l V))))
(if (<= t_0 0.0)
(* c0 (sqrt (/ (/ A V) l)))
(if (<= t_0 5e+278) (* c0 (sqrt t_0)) (* c0 (pow (/ l (/ A V)) -0.5))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (l * V);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * sqrt(((A / V) / l));
} else if (t_0 <= 5e+278) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 * pow((l / (A / V)), -0.5);
}
return tmp;
}
NOTE: 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 / (l * v)
if (t_0 <= 0.0d0) then
tmp = c0 * sqrt(((a / v) / l))
else if (t_0 <= 5d+278) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 * ((l / (a / v)) ** (-0.5d0))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = A / (l * V);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else if (t_0 <= 5e+278) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 * Math.pow((l / (A / V)), -0.5);
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = A / (l * V) tmp = 0 if t_0 <= 0.0: tmp = c0 * math.sqrt(((A / V) / l)) elif t_0 <= 5e+278: tmp = c0 * math.sqrt(t_0) else: tmp = c0 * math.pow((l / (A / V)), -0.5) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(l * V)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); elseif (t_0 <= 5e+278) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 * (Float64(l / Float64(A / V)) ^ -0.5)); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (l * V);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = c0 * sqrt(((A / V) / l));
elseif (t_0 <= 5e+278)
tmp = c0 * sqrt(t_0);
else
tmp = c0 * ((l / (A / V)) ^ -0.5);
end
tmp_2 = tmp;
end
NOTE: 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[(l * V), $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+278], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Power[N[(l / N[(A / V), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{\ell \cdot V}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+278}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot {\left(\frac{\ell}{\frac{A}{V}}\right)}^{-0.5}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 37.8%
associate-/r*62.3%
div-inv62.2%
Applied egg-rr62.2%
un-div-inv62.3%
Applied egg-rr62.3%
if 0.0 < (/.f64 A (*.f64 V l)) < 5.00000000000000029e278Initial program 98.4%
if 5.00000000000000029e278 < (/.f64 A (*.f64 V l)) Initial program 40.7%
pow1/240.7%
clear-num40.7%
inv-pow40.7%
pow-pow43.0%
associate-/l*58.8%
metadata-eval58.8%
Applied egg-rr58.8%
associate-/l*43.0%
*-lft-identity43.0%
times-frac58.7%
/-rgt-identity58.7%
Simplified58.7%
associate-*r/43.0%
*-commutative43.0%
associate-/l*58.8%
Applied egg-rr58.8%
Final simplification81.8%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (/ A (* l V))))
(if (or (<= t_0 0.0) (not (<= t_0 5e+278)))
(* c0 (sqrt (/ (/ A V) l)))
(* c0 (sqrt t_0)))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (l * V);
double tmp;
if ((t_0 <= 0.0) || !(t_0 <= 5e+278)) {
tmp = c0 * sqrt(((A / V) / l));
} else {
tmp = c0 * sqrt(t_0);
}
return tmp;
}
NOTE: 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 / (l * v)
if ((t_0 <= 0.0d0) .or. (.not. (t_0 <= 5d+278))) then
tmp = c0 * sqrt(((a / v) / l))
else
tmp = c0 * sqrt(t_0)
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = A / (l * V);
double tmp;
if ((t_0 <= 0.0) || !(t_0 <= 5e+278)) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else {
tmp = c0 * Math.sqrt(t_0);
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = A / (l * V) tmp = 0 if (t_0 <= 0.0) or not (t_0 <= 5e+278): tmp = c0 * math.sqrt(((A / V) / l)) else: tmp = c0 * math.sqrt(t_0) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(l * V)) tmp = 0.0 if ((t_0 <= 0.0) || !(t_0 <= 5e+278)) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); else tmp = Float64(c0 * sqrt(t_0)); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (l * V);
tmp = 0.0;
if ((t_0 <= 0.0) || ~((t_0 <= 5e+278)))
tmp = c0 * sqrt(((A / V) / l));
else
tmp = c0 * sqrt(t_0);
end
tmp_2 = tmp;
end
NOTE: 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[(l * V), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 5e+278]], $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}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{\ell \cdot V}\\
\mathbf{if}\;t_0 \leq 0 \lor \neg \left(t_0 \leq 5 \cdot 10^{+278}\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.00000000000000029e278 < (/.f64 A (*.f64 V l)) Initial program 39.4%
associate-/r*59.1%
div-inv59.1%
Applied egg-rr59.1%
un-div-inv59.1%
Applied egg-rr59.1%
if 0.0 < (/.f64 A (*.f64 V l)) < 5.00000000000000029e278Initial program 98.4%
Final simplification81.2%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (/ A (* l V))))
(if (<= t_0 0.0)
(* c0 (sqrt (/ (/ A V) l)))
(if (<= t_0 5e+278) (* c0 (sqrt t_0)) (/ c0 (sqrt (* l (/ V A))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (l * V);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * sqrt(((A / V) / l));
} else if (t_0 <= 5e+278) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 / sqrt((l * (V / A)));
}
return tmp;
}
NOTE: 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 / (l * v)
if (t_0 <= 0.0d0) then
tmp = c0 * sqrt(((a / v) / l))
else if (t_0 <= 5d+278) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 / sqrt((l * (v / a)))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = A / (l * V);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else if (t_0 <= 5e+278) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 / Math.sqrt((l * (V / A)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = A / (l * V) tmp = 0 if t_0 <= 0.0: tmp = c0 * math.sqrt(((A / V) / l)) elif t_0 <= 5e+278: tmp = c0 * math.sqrt(t_0) else: tmp = c0 / math.sqrt((l * (V / A))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(l * V)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); elseif (t_0 <= 5e+278) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 / sqrt(Float64(l * Float64(V / A)))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (l * V);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = c0 * sqrt(((A / V) / l));
elseif (t_0 <= 5e+278)
tmp = c0 * sqrt(t_0);
else
tmp = c0 / sqrt((l * (V / A)));
end
tmp_2 = tmp;
end
NOTE: 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[(l * V), $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+278], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{\ell \cdot V}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+278}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 37.8%
associate-/r*62.3%
div-inv62.2%
Applied egg-rr62.2%
un-div-inv62.3%
Applied egg-rr62.3%
if 0.0 < (/.f64 A (*.f64 V l)) < 5.00000000000000029e278Initial program 98.4%
if 5.00000000000000029e278 < (/.f64 A (*.f64 V l)) Initial program 40.7%
associate-/r*56.5%
div-inv56.5%
Applied egg-rr56.5%
associate-*l/56.4%
div-inv56.5%
*-un-lft-identity56.5%
associate-*l/56.5%
expm1-log1p-u32.2%
expm1-udef24.6%
Applied egg-rr18.6%
expm1-def21.6%
expm1-log1p43.0%
associate-*l/58.7%
*-commutative58.7%
Simplified58.7%
Final simplification81.8%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (/ A (* l V))))
(if (<= t_0 0.0)
(* c0 (sqrt (/ (/ A V) l)))
(if (<= t_0 5e+278) (* c0 (sqrt t_0)) (/ c0 (sqrt (/ l (/ A V))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (l * V);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * sqrt(((A / V) / l));
} else if (t_0 <= 5e+278) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 / sqrt((l / (A / V)));
}
return tmp;
}
NOTE: 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 / (l * v)
if (t_0 <= 0.0d0) then
tmp = c0 * sqrt(((a / v) / l))
else if (t_0 <= 5d+278) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 / sqrt((l / (a / v)))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = A / (l * V);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else if (t_0 <= 5e+278) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 / Math.sqrt((l / (A / V)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = A / (l * V) tmp = 0 if t_0 <= 0.0: tmp = c0 * math.sqrt(((A / V) / l)) elif t_0 <= 5e+278: tmp = c0 * math.sqrt(t_0) else: tmp = c0 / math.sqrt((l / (A / V))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(l * V)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); elseif (t_0 <= 5e+278) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 / sqrt(Float64(l / Float64(A / V)))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (l * V);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = c0 * sqrt(((A / V) / l));
elseif (t_0 <= 5e+278)
tmp = c0 * sqrt(t_0);
else
tmp = c0 / sqrt((l / (A / V)));
end
tmp_2 = tmp;
end
NOTE: 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[(l * V), $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+278], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l / N[(A / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{\ell \cdot V}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+278}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 37.8%
associate-/r*62.3%
div-inv62.2%
Applied egg-rr62.2%
un-div-inv62.3%
Applied egg-rr62.3%
if 0.0 < (/.f64 A (*.f64 V l)) < 5.00000000000000029e278Initial program 98.4%
if 5.00000000000000029e278 < (/.f64 A (*.f64 V l)) Initial program 40.7%
associate-/r*56.5%
div-inv56.5%
Applied egg-rr56.5%
associate-*l/56.4%
div-inv56.5%
*-un-lft-identity56.5%
associate-*l/56.5%
expm1-log1p-u32.2%
expm1-udef24.6%
Applied egg-rr18.6%
expm1-def21.6%
expm1-log1p43.0%
associate-*l/58.7%
*-commutative58.7%
Simplified58.7%
clear-num58.9%
un-div-inv58.9%
Applied egg-rr58.9%
Final simplification81.8%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* l V)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (l * V)));
}
NOTE: 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 / (l * v)))
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (l * V)));
}
[V, l] = sort([V, l]) def code(c0, A, V, l): return c0 * math.sqrt((A / (l * V)))
V, l = sort([V, l]) function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(l * V)))) end
V, l = num2cell(sort([V, l])){:}
function tmp = code(c0, A, V, l)
tmp = c0 * sqrt((A / (l * V)));
end
NOTE: 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[(l * V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
c0 \cdot \sqrt{\frac{A}{\ell \cdot V}}
\end{array}
Initial program 72.6%
Final simplification72.6%
herbie shell --seed 2023257
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))