
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
code = c0 * sqrt((a / (v * l)))
end function
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
function tmp = code(c0, A, V, l) tmp = c0 * sqrt((A / (V * l))); end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
code = c0 * sqrt((a / (v * l)))
end function
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
function tmp = code(c0, A, V, l) tmp = c0 * sqrt((A / (V * l))); end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= l -2e-310) (* c0 (/ (sqrt (/ (- A) V)) (sqrt (- l)))) (/ c0 (* (sqrt (/ V A)) (sqrt l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -2e-310) {
tmp = c0 * (sqrt((-A / V)) / sqrt(-l));
} else {
tmp = c0 / (sqrt((V / A)) * 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-310)) then
tmp = c0 * (sqrt((-a / v)) / sqrt(-l))
else
tmp = c0 / (sqrt((v / a)) * 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-310) {
tmp = c0 * (Math.sqrt((-A / V)) / Math.sqrt(-l));
} else {
tmp = c0 / (Math.sqrt((V / A)) * Math.sqrt(l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if l <= -2e-310: tmp = c0 * (math.sqrt((-A / V)) / math.sqrt(-l)) else: tmp = c0 / (math.sqrt((V / A)) * math.sqrt(l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (l <= -2e-310) tmp = Float64(c0 * Float64(sqrt(Float64(Float64(-A) / V)) / sqrt(Float64(-l)))); else tmp = Float64(c0 / Float64(sqrt(Float64(V / A)) * 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-310)
tmp = c0 * (sqrt((-A / V)) / sqrt(-l));
else
tmp = c0 / (sqrt((V / A)) * 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-310], N[(c0 * N[(N[Sqrt[N[((-A) / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[(N[Sqrt[N[(V / A), $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^{-310}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{-A}{V}}}{\sqrt{-\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 74.6%
pow1/274.6%
clear-num74.3%
inv-pow74.3%
pow-pow74.5%
*-commutative74.5%
associate-/l*74.9%
metadata-eval74.9%
Applied egg-rr74.9%
associate-/l*74.5%
*-commutative74.5%
associate-/l*77.4%
associate-/r/75.2%
Simplified75.2%
metadata-eval75.2%
sqrt-pow275.1%
inv-pow75.1%
sqrt-prod0.0%
associate-/r*0.0%
metadata-eval0.0%
sqrt-div0.0%
clear-num0.0%
sqrt-div74.8%
frac-2neg74.8%
sqrt-div82.4%
distribute-neg-frac82.4%
Applied egg-rr82.4%
if -1.999999999999994e-310 < l Initial program 72.1%
pow1/272.1%
clear-num72.1%
inv-pow72.1%
pow-pow72.1%
*-commutative72.1%
associate-/l*73.5%
metadata-eval73.5%
Applied egg-rr73.5%
associate-/l*72.1%
*-commutative72.1%
associate-/l*72.4%
associate-/r/74.7%
Simplified74.7%
metadata-eval74.7%
sqrt-pow274.6%
inv-pow74.6%
un-div-inv74.7%
sqrt-prod87.4%
associate-/r*85.7%
Applied egg-rr85.7%
associate-/r*87.4%
Simplified87.4%
Final simplification84.6%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= l -2.6e+43)
(* c0 (sqrt (/ (/ A l) V)))
(if (<= l -2e-310)
(/ c0 (/ (sqrt (* l V)) (sqrt A)))
(/ c0 (* (sqrt (/ V A)) (sqrt l))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -2.6e+43) {
tmp = c0 * sqrt(((A / l) / V));
} else if (l <= -2e-310) {
tmp = c0 / (sqrt((l * V)) / sqrt(A));
} else {
tmp = c0 / (sqrt((V / A)) * 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 <= (-2.6d+43)) then
tmp = c0 * sqrt(((a / l) / v))
else if (l <= (-2d-310)) then
tmp = c0 / (sqrt((l * v)) / sqrt(a))
else
tmp = c0 / (sqrt((v / a)) * 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 <= -2.6e+43) {
tmp = c0 * Math.sqrt(((A / l) / V));
} else if (l <= -2e-310) {
tmp = c0 / (Math.sqrt((l * V)) / Math.sqrt(A));
} else {
tmp = c0 / (Math.sqrt((V / A)) * Math.sqrt(l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if l <= -2.6e+43: tmp = c0 * math.sqrt(((A / l) / V)) elif l <= -2e-310: tmp = c0 / (math.sqrt((l * V)) / math.sqrt(A)) else: tmp = c0 / (math.sqrt((V / A)) * math.sqrt(l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (l <= -2.6e+43) tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V))); elseif (l <= -2e-310) tmp = Float64(c0 / Float64(sqrt(Float64(l * V)) / sqrt(A))); else tmp = Float64(c0 / Float64(sqrt(Float64(V / A)) * 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 <= -2.6e+43)
tmp = c0 * sqrt(((A / l) / V));
elseif (l <= -2e-310)
tmp = c0 / (sqrt((l * V)) / sqrt(A));
else
tmp = c0 / (sqrt((V / A)) * 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, -2.6e+43], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(c0 / N[(N[Sqrt[N[(l * V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[(N[Sqrt[N[(V / A), $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.6 \cdot 10^{+43}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{\ell \cdot V}}{\sqrt{A}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.60000000000000021e43Initial program 67.3%
add-sqr-sqrt33.9%
sqrt-unprod32.5%
*-commutative32.5%
*-commutative32.5%
swap-sqr28.7%
add-sqr-sqrt28.7%
associate-/r*25.7%
pow225.7%
Applied egg-rr25.7%
sqrt-prod27.4%
sqrt-div0.0%
clear-num0.0%
sqrt-div0.0%
metadata-eval0.0%
associate-/r*0.0%
sqrt-prod27.3%
unpow227.3%
sqrt-prod32.0%
add-sqr-sqrt67.7%
Applied egg-rr76.6%
if -2.60000000000000021e43 < l < -1.999999999999994e-310Initial program 79.3%
sqrt-div50.7%
associate-*r/48.9%
Applied egg-rr48.9%
associate-/l*50.6%
Simplified50.6%
if -1.999999999999994e-310 < l Initial program 72.1%
pow1/272.1%
clear-num72.1%
inv-pow72.1%
pow-pow72.1%
*-commutative72.1%
associate-/l*73.5%
metadata-eval73.5%
Applied egg-rr73.5%
associate-/l*72.1%
*-commutative72.1%
associate-/l*72.4%
associate-/r/74.7%
Simplified74.7%
metadata-eval74.7%
sqrt-pow274.6%
inv-pow74.6%
un-div-inv74.7%
sqrt-prod87.4%
associate-/r*85.7%
Applied egg-rr85.7%
associate-/r*87.4%
Simplified87.4%
Final simplification72.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-310) (* c0 (pow (* l (/ V 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-310) {
tmp = c0 * pow((l * (V / 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-310)) then
tmp = c0 * ((l * (v / 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-310) {
tmp = c0 * Math.pow((l * (V / 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-310: tmp = c0 * math.pow((l * (V / 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-310) tmp = Float64(c0 * (Float64(l * Float64(V / 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-310)
tmp = c0 * ((l * (V / 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-310], N[(c0 * N[Power[N[(l * N[(V / 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^{-310}:\\
\;\;\;\;c0 \cdot {\left(\ell \cdot \frac{V}{A}\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 74.6%
pow1/274.6%
clear-num74.3%
inv-pow74.3%
pow-pow74.5%
*-commutative74.5%
associate-/l*74.9%
metadata-eval74.9%
Applied egg-rr74.9%
associate-/l*74.5%
*-commutative74.5%
associate-/l*77.4%
associate-/r/75.2%
Simplified75.2%
if -1.999999999999994e-310 < l Initial program 72.1%
associate-/r*73.8%
sqrt-div85.4%
Applied egg-rr85.4%
Final simplification79.7%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= l -2e-310) (* c0 (pow (* l (/ V A)) -0.5)) (/ c0 (* (sqrt (/ V A)) (sqrt l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -2e-310) {
tmp = c0 * pow((l * (V / A)), -0.5);
} else {
tmp = c0 / (sqrt((V / A)) * 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-310)) then
tmp = c0 * ((l * (v / a)) ** (-0.5d0))
else
tmp = c0 / (sqrt((v / a)) * 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-310) {
tmp = c0 * Math.pow((l * (V / A)), -0.5);
} else {
tmp = c0 / (Math.sqrt((V / A)) * Math.sqrt(l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if l <= -2e-310: tmp = c0 * math.pow((l * (V / A)), -0.5) else: tmp = c0 / (math.sqrt((V / A)) * math.sqrt(l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (l <= -2e-310) tmp = Float64(c0 * (Float64(l * Float64(V / A)) ^ -0.5)); else tmp = Float64(c0 / Float64(sqrt(Float64(V / A)) * 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-310)
tmp = c0 * ((l * (V / A)) ^ -0.5);
else
tmp = c0 / (sqrt((V / A)) * 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-310], N[(c0 * N[Power[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(c0 / N[(N[Sqrt[N[(V / A), $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^{-310}:\\
\;\;\;\;c0 \cdot {\left(\ell \cdot \frac{V}{A}\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{V}{A}} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 74.6%
pow1/274.6%
clear-num74.3%
inv-pow74.3%
pow-pow74.5%
*-commutative74.5%
associate-/l*74.9%
metadata-eval74.9%
Applied egg-rr74.9%
associate-/l*74.5%
*-commutative74.5%
associate-/l*77.4%
associate-/r/75.2%
Simplified75.2%
if -1.999999999999994e-310 < l Initial program 72.1%
pow1/272.1%
clear-num72.1%
inv-pow72.1%
pow-pow72.1%
*-commutative72.1%
associate-/l*73.5%
metadata-eval73.5%
Applied egg-rr73.5%
associate-/l*72.1%
*-commutative72.1%
associate-/l*72.4%
associate-/r/74.7%
Simplified74.7%
metadata-eval74.7%
sqrt-pow274.6%
inv-pow74.6%
un-div-inv74.7%
sqrt-prod87.4%
associate-/r*85.7%
Applied egg-rr85.7%
associate-/r*87.4%
Simplified87.4%
Final simplification80.5%
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+302)))
(* c0 (sqrt (/ (/ A l) V)))
(* 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+302)) {
tmp = c0 * sqrt(((A / l) / V));
} 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+302))) then
tmp = c0 * sqrt(((a / l) / v))
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+302)) {
tmp = c0 * Math.sqrt(((A / l) / V));
} 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+302): tmp = c0 * math.sqrt(((A / l) / V)) 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+302)) tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V))); 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+302)))
tmp = c0 * sqrt(((A / l) / V));
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+302]], $MachinePrecision]], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $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^{+302}\right):\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0 or 5e302 < (/.f64 A (*.f64 V l)) Initial program 37.1%
add-sqr-sqrt27.8%
sqrt-unprod27.9%
*-commutative27.9%
*-commutative27.9%
swap-sqr27.2%
add-sqr-sqrt27.2%
associate-/r*32.0%
pow232.0%
Applied egg-rr32.0%
sqrt-prod35.1%
sqrt-div24.4%
clear-num24.4%
sqrt-div25.1%
metadata-eval25.1%
associate-/r*25.2%
sqrt-prod34.7%
unpow234.7%
sqrt-prod33.3%
add-sqr-sqrt55.2%
Applied egg-rr55.3%
if 0.0 < (/.f64 A (*.f64 V l)) < 5e302Initial program 98.8%
Final simplification81.0%
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 l) V)))
(if (<= t_0 5e+302) (* c0 (sqrt t_0)) (/ c0 (sqrt (* V (/ l 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 / l) / V));
} else if (t_0 <= 5e+302) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 / sqrt((V * (l / 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 / l) / v))
else if (t_0 <= 5d+302) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 / sqrt((v * (l / 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 / l) / V));
} else if (t_0 <= 5e+302) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 / Math.sqrt((V * (l / 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 / l) / V)) elif t_0 <= 5e+302: tmp = c0 * math.sqrt(t_0) else: tmp = c0 / math.sqrt((V * (l / 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 / l) / V))); elseif (t_0 <= 5e+302) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 / sqrt(Float64(V * Float64(l / 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 / l) / V));
elseif (t_0 <= 5e+302)
tmp = c0 * sqrt(t_0);
else
tmp = c0 / sqrt((V * (l / 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 / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+302], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[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}{\ell}}{V}}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+302}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 31.4%
add-sqr-sqrt31.4%
sqrt-unprod31.4%
*-commutative31.4%
*-commutative31.4%
swap-sqr30.6%
add-sqr-sqrt30.6%
associate-/r*34.7%
pow234.7%
Applied egg-rr34.7%
sqrt-prod37.2%
sqrt-div27.8%
clear-num27.8%
sqrt-div27.8%
metadata-eval27.8%
associate-/r*27.8%
sqrt-prod36.5%
unpow236.5%
sqrt-prod31.5%
add-sqr-sqrt51.9%
Applied egg-rr53.6%
if 0.0 < (/.f64 A (*.f64 V l)) < 5e302Initial program 98.8%
if 5e302 < (/.f64 A (*.f64 V l)) Initial program 42.6%
pow1/242.6%
clear-num42.6%
inv-pow42.6%
pow-pow43.0%
*-commutative43.0%
associate-/l*58.5%
metadata-eval58.5%
Applied egg-rr58.5%
associate-/l*43.0%
*-commutative43.0%
associate-/l*58.1%
associate-/r/58.5%
Simplified58.5%
metadata-eval58.5%
sqrt-pow258.5%
inv-pow58.5%
un-div-inv58.5%
associate-*l/43.0%
sqrt-div27.5%
*-commutative27.5%
sqrt-div43.0%
associate-*l/58.1%
*-commutative58.1%
Applied egg-rr58.1%
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 l) V)))
(if (<= t_0 2e+282) (* 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 / l) / V));
} else if (t_0 <= 2e+282) {
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 / l) / v))
else if (t_0 <= 2d+282) 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 / l) / V));
} else if (t_0 <= 2e+282) {
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 / l) / V)) elif t_0 <= 2e+282: 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 / l) / V))); elseif (t_0 <= 2e+282) 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 / l) / V));
elseif (t_0 <= 2e+282)
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 / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+282], 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}{\ell}}{V}}\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+282}:\\
\;\;\;\;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 31.4%
add-sqr-sqrt31.4%
sqrt-unprod31.4%
*-commutative31.4%
*-commutative31.4%
swap-sqr30.6%
add-sqr-sqrt30.6%
associate-/r*34.7%
pow234.7%
Applied egg-rr34.7%
sqrt-prod37.2%
sqrt-div27.8%
clear-num27.8%
sqrt-div27.8%
metadata-eval27.8%
associate-/r*27.8%
sqrt-prod36.5%
unpow236.5%
sqrt-prod31.5%
add-sqr-sqrt51.9%
Applied egg-rr53.6%
if 0.0 < (/.f64 A (*.f64 V l)) < 2.00000000000000007e282Initial program 98.8%
if 2.00000000000000007e282 < (/.f64 A (*.f64 V l)) Initial program 48.4%
pow1/248.4%
clear-num48.4%
inv-pow48.4%
pow-pow48.7%
*-commutative48.7%
associate-/l*61.0%
metadata-eval61.0%
Applied egg-rr61.0%
Applied egg-rr61.0%
Final simplification80.9%
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 5e-297)
(* c0 (pow (/ (/ A V) l) 0.5))
(if (<= t_0 2e+282)
(/ c0 (sqrt (/ (* l V) A)))
(/ 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 <= 5e-297) {
tmp = c0 * pow(((A / V) / l), 0.5);
} else if (t_0 <= 2e+282) {
tmp = c0 / sqrt(((l * V) / A));
} 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 <= 5d-297) then
tmp = c0 * (((a / v) / l) ** 0.5d0)
else if (t_0 <= 2d+282) then
tmp = c0 / sqrt(((l * v) / a))
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 <= 5e-297) {
tmp = c0 * Math.pow(((A / V) / l), 0.5);
} else if (t_0 <= 2e+282) {
tmp = c0 / Math.sqrt(((l * V) / A));
} 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 <= 5e-297: tmp = c0 * math.pow(((A / V) / l), 0.5) elif t_0 <= 2e+282: tmp = c0 / math.sqrt(((l * V) / A)) 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 <= 5e-297) tmp = Float64(c0 * (Float64(Float64(A / V) / l) ^ 0.5)); elseif (t_0 <= 2e+282) tmp = Float64(c0 / sqrt(Float64(Float64(l * V) / A))); 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 <= 5e-297)
tmp = c0 * (((A / V) / l) ^ 0.5);
elseif (t_0 <= 2e+282)
tmp = c0 / sqrt(((l * V) / A));
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, 5e-297], N[(c0 * N[Power[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+282], N[(c0 / N[Sqrt[N[(N[(l * V), $MachinePrecision] / A), $MachinePrecision]], $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 5 \cdot 10^{-297}:\\
\;\;\;\;c0 \cdot {\left(\frac{\frac{A}{V}}{\ell}\right)}^{0.5}\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+282}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\ell \cdot V}{A}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 5e-297Initial program 32.8%
pow1/232.8%
associate-/r*53.5%
Applied egg-rr53.5%
if 5e-297 < (/.f64 A (*.f64 V l)) < 2.00000000000000007e282Initial program 99.2%
pow1/299.2%
clear-num99.1%
inv-pow99.1%
pow-pow99.2%
*-commutative99.2%
associate-/l*88.3%
metadata-eval88.3%
Applied egg-rr88.3%
Applied egg-rr89.5%
associate-*r/99.2%
Applied egg-rr99.2%
if 2.00000000000000007e282 < (/.f64 A (*.f64 V l)) Initial program 48.4%
pow1/248.4%
clear-num48.4%
inv-pow48.4%
pow-pow48.7%
*-commutative48.7%
associate-/l*61.0%
metadata-eval61.0%
Applied egg-rr61.0%
Applied egg-rr61.0%
Final simplification80.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 73.5%
Final simplification73.5%
herbie shell --seed 2023313
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))