
(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
(if (<= (* V l) -1e-310)
(* c0 (/ (sqrt (- 0.0 A)) (* (sqrt (- 0.0 V)) (sqrt l))))
(if (<= (* V l) 4e-309)
(/ c0 (sqrt (* l (/ V A))))
(if (<= (* V l) 1e+296)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(* c0 (sqrt (/ (/ A l) V)))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -1e-310) {
tmp = c0 * (sqrt((0.0 - A)) / (sqrt((0.0 - V)) * sqrt(l)));
} else if ((V * l) <= 4e-309) {
tmp = c0 / sqrt((l * (V / A)));
} else if ((V * l) <= 1e+296) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} 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) :: tmp
if ((v * l) <= (-1d-310)) then
tmp = c0 * (sqrt((0.0d0 - a)) / (sqrt((0.0d0 - v)) * sqrt(l)))
else if ((v * l) <= 4d-309) then
tmp = c0 / sqrt((l * (v / a)))
else if ((v * l) <= 1d+296) then
tmp = c0 * (sqrt(a) / sqrt((v * l)))
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 tmp;
if ((V * l) <= -1e-310) {
tmp = c0 * (Math.sqrt((0.0 - A)) / (Math.sqrt((0.0 - V)) * Math.sqrt(l)));
} else if ((V * l) <= 4e-309) {
tmp = c0 / Math.sqrt((l * (V / A)));
} else if ((V * l) <= 1e+296) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} 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): tmp = 0 if (V * l) <= -1e-310: tmp = c0 * (math.sqrt((0.0 - A)) / (math.sqrt((0.0 - V)) * math.sqrt(l))) elif (V * l) <= 4e-309: tmp = c0 / math.sqrt((l * (V / A))) elif (V * l) <= 1e+296: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) 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) tmp = 0.0 if (Float64(V * l) <= -1e-310) tmp = Float64(c0 * Float64(sqrt(Float64(0.0 - A)) / Float64(sqrt(Float64(0.0 - V)) * sqrt(l)))); elseif (Float64(V * l) <= 4e-309) tmp = Float64(c0 / sqrt(Float64(l * Float64(V / A)))); elseif (Float64(V * l) <= 1e+296) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); 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)
tmp = 0.0;
if ((V * l) <= -1e-310)
tmp = c0 * (sqrt((0.0 - A)) / (sqrt((0.0 - V)) * sqrt(l)));
elseif ((V * l) <= 4e-309)
tmp = c0 / sqrt((l * (V / A)));
elseif ((V * l) <= 1e+296)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
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_] := If[LessEqual[N[(V * l), $MachinePrecision], -1e-310], N[(c0 * N[(N[Sqrt[N[(0.0 - A), $MachinePrecision]], $MachinePrecision] / N[(N[Sqrt[N[(0.0 - V), $MachinePrecision]], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e-309], N[(c0 / N[Sqrt[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+296], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $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}
\mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{0 - A}}{\sqrt{0 - V} \cdot \sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{-309}:\\
\;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+296}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\end{array}
\end{array}
if (*.f64 V l) < -9.999999999999969e-311Initial program 77.9%
associate-/l/N/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6474.4
Applied egg-rr74.4%
un-div-invN/A
sqrt-undivN/A
frac-2negN/A
sqrt-divN/A
associate-/l/N/A
sqrt-prodN/A
distribute-rgt-neg-inN/A
+-rgt-identityN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
neg-sub0N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f6490.1
Applied egg-rr90.1%
sub0-negN/A
+-rgt-identityN/A
*-commutativeN/A
distribute-lft-neg-inN/A
sqrt-prodN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
neg-sub0N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f6448.1
Applied egg-rr48.1%
if -9.999999999999969e-311 < (*.f64 V l) < 3.9999999999999977e-309Initial program 39.7%
clear-numN/A
sqrt-divN/A
metadata-evalN/A
un-div-invN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6480.6
Applied egg-rr80.6%
clear-numN/A
un-div-invN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f6480.4
Applied egg-rr80.4%
if 3.9999999999999977e-309 < (*.f64 V l) < 9.99999999999999981e295Initial program 86.9%
sqrt-divN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lft-identityN/A
+-commutativeN/A
accelerator-lowering-fma.f6499.4
Applied egg-rr99.4%
Taylor expanded in V around 0
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f6499.4
Simplified99.4%
if 9.99999999999999981e295 < (*.f64 V l) Initial program 29.5%
associate-/l/N/A
/-lowering-/.f64N/A
/-lowering-/.f6472.8
Applied egg-rr72.8%
Final simplification76.3%
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) -5e+304)
(/ c0 (* (sqrt l) (sqrt (/ V A))))
(if (<= (* V l) -1e-304)
(* c0 (/ (sqrt (- 0.0 A)) (sqrt (- 0.0 (* V l)))))
(if (<= (* V l) 4e-309)
(/ c0 (sqrt (* l (/ V A))))
(if (<= (* V l) 1e+296)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(* c0 (sqrt (/ (/ A l) V))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -5e+304) {
tmp = c0 / (sqrt(l) * sqrt((V / A)));
} else if ((V * l) <= -1e-304) {
tmp = c0 * (sqrt((0.0 - A)) / sqrt((0.0 - (V * l))));
} else if ((V * l) <= 4e-309) {
tmp = c0 / sqrt((l * (V / A)));
} else if ((V * l) <= 1e+296) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} 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) :: tmp
if ((v * l) <= (-5d+304)) then
tmp = c0 / (sqrt(l) * sqrt((v / a)))
else if ((v * l) <= (-1d-304)) then
tmp = c0 * (sqrt((0.0d0 - a)) / sqrt((0.0d0 - (v * l))))
else if ((v * l) <= 4d-309) then
tmp = c0 / sqrt((l * (v / a)))
else if ((v * l) <= 1d+296) then
tmp = c0 * (sqrt(a) / sqrt((v * l)))
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 tmp;
if ((V * l) <= -5e+304) {
tmp = c0 / (Math.sqrt(l) * Math.sqrt((V / A)));
} else if ((V * l) <= -1e-304) {
tmp = c0 * (Math.sqrt((0.0 - A)) / Math.sqrt((0.0 - (V * l))));
} else if ((V * l) <= 4e-309) {
tmp = c0 / Math.sqrt((l * (V / A)));
} else if ((V * l) <= 1e+296) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} 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): tmp = 0 if (V * l) <= -5e+304: tmp = c0 / (math.sqrt(l) * math.sqrt((V / A))) elif (V * l) <= -1e-304: tmp = c0 * (math.sqrt((0.0 - A)) / math.sqrt((0.0 - (V * l)))) elif (V * l) <= 4e-309: tmp = c0 / math.sqrt((l * (V / A))) elif (V * l) <= 1e+296: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) 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) tmp = 0.0 if (Float64(V * l) <= -5e+304) tmp = Float64(c0 / Float64(sqrt(l) * sqrt(Float64(V / A)))); elseif (Float64(V * l) <= -1e-304) tmp = Float64(c0 * Float64(sqrt(Float64(0.0 - A)) / sqrt(Float64(0.0 - Float64(V * l))))); elseif (Float64(V * l) <= 4e-309) tmp = Float64(c0 / sqrt(Float64(l * Float64(V / A)))); elseif (Float64(V * l) <= 1e+296) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); 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)
tmp = 0.0;
if ((V * l) <= -5e+304)
tmp = c0 / (sqrt(l) * sqrt((V / A)));
elseif ((V * l) <= -1e-304)
tmp = c0 * (sqrt((0.0 - A)) / sqrt((0.0 - (V * l))));
elseif ((V * l) <= 4e-309)
tmp = c0 / sqrt((l * (V / A)));
elseif ((V * l) <= 1e+296)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
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_] := If[LessEqual[N[(V * l), $MachinePrecision], -5e+304], N[(c0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[N[(V / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-304], N[(c0 * N[(N[Sqrt[N[(0.0 - A), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(0.0 - N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e-309], N[(c0 / N[Sqrt[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+296], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $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}
\mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+304}:\\
\;\;\;\;\frac{c0}{\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-304}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{0 - A}}{\sqrt{0 - V \cdot \ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{-309}:\\
\;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+296}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\end{array}
\end{array}
if (*.f64 V l) < -4.9999999999999997e304Initial program 38.9%
clear-numN/A
sqrt-divN/A
metadata-evalN/A
un-div-invN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6452.5
Applied egg-rr52.5%
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
sqrt-prodN/A
sqrt-undivN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-undivN/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f6449.8
Applied egg-rr49.8%
if -4.9999999999999997e304 < (*.f64 V l) < -9.99999999999999971e-305Initial program 84.9%
associate-/l/N/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6477.8
Applied egg-rr77.8%
un-div-invN/A
sqrt-undivN/A
frac-2negN/A
sqrt-divN/A
associate-/l/N/A
sqrt-prodN/A
distribute-rgt-neg-inN/A
+-rgt-identityN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
neg-sub0N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f6499.5
Applied egg-rr99.5%
+-rgt-identityN/A
*-lowering-*.f6499.5
Applied egg-rr99.5%
if -9.99999999999999971e-305 < (*.f64 V l) < 3.9999999999999977e-309Initial program 41.3%
clear-numN/A
sqrt-divN/A
metadata-evalN/A
un-div-invN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6481.1
Applied egg-rr81.1%
clear-numN/A
un-div-invN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f6480.9
Applied egg-rr80.9%
if 3.9999999999999977e-309 < (*.f64 V l) < 9.99999999999999981e295Initial program 86.9%
sqrt-divN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lft-identityN/A
+-commutativeN/A
accelerator-lowering-fma.f6499.4
Applied egg-rr99.4%
Taylor expanded in V around 0
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f6499.4
Simplified99.4%
if 9.99999999999999981e295 < (*.f64 V l) Initial program 29.5%
associate-/l/N/A
/-lowering-/.f64N/A
/-lowering-/.f6472.8
Applied egg-rr72.8%
Final simplification91.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 (<= (* V l) -5e+304)
(* c0 (/ (sqrt (/ A V)) (sqrt l)))
(if (<= (* V l) -1e-304)
(* c0 (/ (sqrt (- 0.0 A)) (sqrt (- 0.0 (* V l)))))
(if (<= (* V l) 4e-309)
(/ c0 (sqrt (* l (/ V A))))
(if (<= (* V l) 1e+296)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(* c0 (sqrt (/ (/ A l) V))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -5e+304) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else if ((V * l) <= -1e-304) {
tmp = c0 * (sqrt((0.0 - A)) / sqrt((0.0 - (V * l))));
} else if ((V * l) <= 4e-309) {
tmp = c0 / sqrt((l * (V / A)));
} else if ((V * l) <= 1e+296) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} 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) :: tmp
if ((v * l) <= (-5d+304)) then
tmp = c0 * (sqrt((a / v)) / sqrt(l))
else if ((v * l) <= (-1d-304)) then
tmp = c0 * (sqrt((0.0d0 - a)) / sqrt((0.0d0 - (v * l))))
else if ((v * l) <= 4d-309) then
tmp = c0 / sqrt((l * (v / a)))
else if ((v * l) <= 1d+296) then
tmp = c0 * (sqrt(a) / sqrt((v * l)))
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 tmp;
if ((V * l) <= -5e+304) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else if ((V * l) <= -1e-304) {
tmp = c0 * (Math.sqrt((0.0 - A)) / Math.sqrt((0.0 - (V * l))));
} else if ((V * l) <= 4e-309) {
tmp = c0 / Math.sqrt((l * (V / A)));
} else if ((V * l) <= 1e+296) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} 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): tmp = 0 if (V * l) <= -5e+304: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) elif (V * l) <= -1e-304: tmp = c0 * (math.sqrt((0.0 - A)) / math.sqrt((0.0 - (V * l)))) elif (V * l) <= 4e-309: tmp = c0 / math.sqrt((l * (V / A))) elif (V * l) <= 1e+296: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) 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) tmp = 0.0 if (Float64(V * l) <= -5e+304) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); elseif (Float64(V * l) <= -1e-304) tmp = Float64(c0 * Float64(sqrt(Float64(0.0 - A)) / sqrt(Float64(0.0 - Float64(V * l))))); elseif (Float64(V * l) <= 4e-309) tmp = Float64(c0 / sqrt(Float64(l * Float64(V / A)))); elseif (Float64(V * l) <= 1e+296) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); 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)
tmp = 0.0;
if ((V * l) <= -5e+304)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
elseif ((V * l) <= -1e-304)
tmp = c0 * (sqrt((0.0 - A)) / sqrt((0.0 - (V * l))));
elseif ((V * l) <= 4e-309)
tmp = c0 / sqrt((l * (V / A)));
elseif ((V * l) <= 1e+296)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
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_] := If[LessEqual[N[(V * l), $MachinePrecision], -5e+304], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-304], N[(c0 * N[(N[Sqrt[N[(0.0 - A), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(0.0 - N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e-309], N[(c0 / N[Sqrt[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+296], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $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}
\mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+304}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-304}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{0 - A}}{\sqrt{0 - V \cdot \ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{-309}:\\
\;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+296}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\end{array}
\end{array}
if (*.f64 V l) < -4.9999999999999997e304Initial program 38.9%
associate-/r*N/A
sqrt-divN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f6449.9
Applied egg-rr49.9%
if -4.9999999999999997e304 < (*.f64 V l) < -9.99999999999999971e-305Initial program 84.9%
associate-/l/N/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6477.8
Applied egg-rr77.8%
un-div-invN/A
sqrt-undivN/A
frac-2negN/A
sqrt-divN/A
associate-/l/N/A
sqrt-prodN/A
distribute-rgt-neg-inN/A
+-rgt-identityN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
neg-sub0N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f6499.5
Applied egg-rr99.5%
+-rgt-identityN/A
*-lowering-*.f6499.5
Applied egg-rr99.5%
if -9.99999999999999971e-305 < (*.f64 V l) < 3.9999999999999977e-309Initial program 41.3%
clear-numN/A
sqrt-divN/A
metadata-evalN/A
un-div-invN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6481.1
Applied egg-rr81.1%
clear-numN/A
un-div-invN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f6480.9
Applied egg-rr80.9%
if 3.9999999999999977e-309 < (*.f64 V l) < 9.99999999999999981e295Initial program 86.9%
sqrt-divN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lft-identityN/A
+-commutativeN/A
accelerator-lowering-fma.f6499.4
Applied egg-rr99.4%
Taylor expanded in V around 0
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f6499.4
Simplified99.4%
if 9.99999999999999981e295 < (*.f64 V l) Initial program 29.5%
associate-/l/N/A
/-lowering-/.f64N/A
/-lowering-/.f6472.8
Applied egg-rr72.8%
Final simplification91.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 5e-313)
(* c0 (sqrt (/ (/ A V) l)))
(if (<= t_0 2e+275)
(/ c0 (sqrt (/ (fma l V 0.0) A)))
(/ c0 (sqrt (* V (/ l A))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 5e-313) {
tmp = c0 * sqrt(((A / V) / l));
} else if (t_0 <= 2e+275) {
tmp = c0 / sqrt((fma(l, V, 0.0) / A));
} else {
tmp = c0 / sqrt((V * (l / A)));
}
return tmp;
}
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(V * l)) tmp = 0.0 if (t_0 <= 5e-313) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); elseif (t_0 <= 2e+275) tmp = Float64(c0 / sqrt(Float64(fma(l, V, 0.0) / A))); else tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); end return 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, 5e-313], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+275], N[(c0 / N[Sqrt[N[(N[(l * V + 0.0), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-313}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{c0}{\sqrt{\frac{\mathsf{fma}\left(\ell, V, 0\right)}{A}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 5.00000000002e-313Initial program 32.1%
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f6451.6
Applied egg-rr51.6%
if 5.00000000002e-313 < (/.f64 A (*.f64 V l)) < 1.99999999999999992e275Initial program 99.2%
associate-/l/N/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6489.1
Applied egg-rr89.1%
un-div-invN/A
sqrt-undivN/A
clear-numN/A
un-div-invN/A
sqrt-divN/A
associate-/r/N/A
associate-*l/N/A
sqrt-prodN/A
+-rgt-identityN/A
/-lowering-/.f64N/A
sqrt-undivN/A
sqrt-lowering-sqrt.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f6499.3
Applied egg-rr99.3%
if 1.99999999999999992e275 < (/.f64 A (*.f64 V l)) Initial program 45.6%
clear-numN/A
sqrt-divN/A
metadata-evalN/A
un-div-invN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6465.9
Applied egg-rr65.9%
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 2e+271) (* c0 (sqrt t_0)) (/ c0 (sqrt (* V (/ l A))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * sqrt(((A / V) / l));
} else if (t_0 <= 2e+271) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 / sqrt((V * (l / A)));
}
return tmp;
}
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0, a, v, l)
real(8), intent (in) :: c0
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = a / (v * l)
if (t_0 <= 0.0d0) then
tmp = c0 * sqrt(((a / v) / l))
else if (t_0 <= 2d+271) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 / sqrt((v * (l / a)))
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else if (t_0 <= 2e+271) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 / Math.sqrt((V * (l / A)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = A / (V * l) tmp = 0 if t_0 <= 0.0: tmp = c0 * math.sqrt(((A / V) / l)) elif t_0 <= 2e+271: tmp = c0 * math.sqrt(t_0) else: tmp = c0 / math.sqrt((V * (l / A))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(V * l)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); elseif (t_0 <= 2e+271) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (V * l);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = c0 * sqrt(((A / V) / l));
elseif (t_0 <= 2e+271)
tmp = c0 * sqrt(t_0);
else
tmp = c0 / sqrt((V * (l / A)));
end
tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+271], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+271}:\\
\;\;\;\;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.2%
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f6452.7
Applied egg-rr52.7%
if 0.0 < (/.f64 A (*.f64 V l)) < 1.99999999999999991e271Initial program 98.7%
if 1.99999999999999991e271 < (/.f64 A (*.f64 V l)) Initial program 46.5%
clear-numN/A
sqrt-divN/A
metadata-evalN/A
un-div-invN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6466.4
Applied egg-rr66.4%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (let* ((t_0 (/ A (* V l))) (t_1 (* c0 (sqrt (/ (/ A V) l))))) (if (<= t_0 0.0) t_1 (if (<= t_0 1e+296) (* c0 (sqrt t_0)) t_1))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double t_1 = c0 * sqrt(((A / V) / l));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 1e+296) {
tmp = c0 * sqrt(t_0);
} else {
tmp = t_1;
}
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 = a / (v * l)
t_1 = c0 * sqrt(((a / v) / l))
if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 1d+296) then
tmp = c0 * sqrt(t_0)
else
tmp = t_1
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 t_1 = c0 * Math.sqrt(((A / V) / l));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 1e+296) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = t_1;
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = A / (V * l) t_1 = c0 * math.sqrt(((A / V) / l)) tmp = 0 if t_0 <= 0.0: tmp = t_1 elif t_0 <= 1e+296: tmp = c0 * math.sqrt(t_0) else: tmp = t_1 return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(V * l)) t_1 = Float64(c0 * sqrt(Float64(Float64(A / V) / l))) tmp = 0.0 if (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 1e+296) tmp = Float64(c0 * sqrt(t_0)); else tmp = t_1; 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);
t_1 = c0 * sqrt(((A / V) / l));
tmp = 0.0;
if (t_0 <= 0.0)
tmp = t_1;
elseif (t_0 <= 1e+296)
tmp = c0 * sqrt(t_0);
else
tmp = t_1;
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]}, Block[{t$95$1 = N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 1e+296], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
t_1 := c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+296}:\\
\;\;\;\;c0 \cdot \sqrt{t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0 or 9.99999999999999981e295 < (/.f64 A (*.f64 V l)) Initial program 33.7%
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f6457.2
Applied egg-rr57.2%
if 0.0 < (/.f64 A (*.f64 V l)) < 9.99999999999999981e295Initial program 98.7%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) -1e-304)
(* c0 (/ (sqrt (- 0.0 A)) (sqrt (- 0.0 (* V l)))))
(if (<= (* V l) 4e-309)
(/ c0 (sqrt (* l (/ V A))))
(if (<= (* V l) 1e+296)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(* c0 (sqrt (/ (/ A l) V)))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -1e-304) {
tmp = c0 * (sqrt((0.0 - A)) / sqrt((0.0 - (V * l))));
} else if ((V * l) <= 4e-309) {
tmp = c0 / sqrt((l * (V / A)));
} else if ((V * l) <= 1e+296) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} 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) :: tmp
if ((v * l) <= (-1d-304)) then
tmp = c0 * (sqrt((0.0d0 - a)) / sqrt((0.0d0 - (v * l))))
else if ((v * l) <= 4d-309) then
tmp = c0 / sqrt((l * (v / a)))
else if ((v * l) <= 1d+296) then
tmp = c0 * (sqrt(a) / sqrt((v * l)))
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 tmp;
if ((V * l) <= -1e-304) {
tmp = c0 * (Math.sqrt((0.0 - A)) / Math.sqrt((0.0 - (V * l))));
} else if ((V * l) <= 4e-309) {
tmp = c0 / Math.sqrt((l * (V / A)));
} else if ((V * l) <= 1e+296) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} 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): tmp = 0 if (V * l) <= -1e-304: tmp = c0 * (math.sqrt((0.0 - A)) / math.sqrt((0.0 - (V * l)))) elif (V * l) <= 4e-309: tmp = c0 / math.sqrt((l * (V / A))) elif (V * l) <= 1e+296: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) 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) tmp = 0.0 if (Float64(V * l) <= -1e-304) tmp = Float64(c0 * Float64(sqrt(Float64(0.0 - A)) / sqrt(Float64(0.0 - Float64(V * l))))); elseif (Float64(V * l) <= 4e-309) tmp = Float64(c0 / sqrt(Float64(l * Float64(V / A)))); elseif (Float64(V * l) <= 1e+296) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); 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)
tmp = 0.0;
if ((V * l) <= -1e-304)
tmp = c0 * (sqrt((0.0 - A)) / sqrt((0.0 - (V * l))));
elseif ((V * l) <= 4e-309)
tmp = c0 / sqrt((l * (V / A)));
elseif ((V * l) <= 1e+296)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
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_] := If[LessEqual[N[(V * l), $MachinePrecision], -1e-304], N[(c0 * N[(N[Sqrt[N[(0.0 - A), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(0.0 - N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e-309], N[(c0 / N[Sqrt[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+296], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $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}
\mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{-304}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{0 - A}}{\sqrt{0 - V \cdot \ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{-309}:\\
\;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+296}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\end{array}
\end{array}
if (*.f64 V l) < -9.99999999999999971e-305Initial program 77.7%
associate-/l/N/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6474.1
Applied egg-rr74.1%
un-div-invN/A
sqrt-undivN/A
frac-2negN/A
sqrt-divN/A
associate-/l/N/A
sqrt-prodN/A
distribute-rgt-neg-inN/A
+-rgt-identityN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
neg-sub0N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f6490.1
Applied egg-rr90.1%
+-rgt-identityN/A
*-lowering-*.f6490.1
Applied egg-rr90.1%
if -9.99999999999999971e-305 < (*.f64 V l) < 3.9999999999999977e-309Initial program 41.3%
clear-numN/A
sqrt-divN/A
metadata-evalN/A
un-div-invN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6481.1
Applied egg-rr81.1%
clear-numN/A
un-div-invN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f6480.9
Applied egg-rr80.9%
if 3.9999999999999977e-309 < (*.f64 V l) < 9.99999999999999981e295Initial program 86.9%
sqrt-divN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lft-identityN/A
+-commutativeN/A
accelerator-lowering-fma.f6499.4
Applied egg-rr99.4%
Taylor expanded in V around 0
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f6499.4
Simplified99.4%
if 9.99999999999999981e295 < (*.f64 V l) Initial program 29.5%
associate-/l/N/A
/-lowering-/.f64N/A
/-lowering-/.f6472.8
Applied egg-rr72.8%
Final simplification91.2%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) -2e+64)
(* c0 (sqrt (/ (/ A V) l)))
(if (<= (* V l) 4e-309)
(/ c0 (sqrt (* V (/ l A))))
(if (<= (* V l) 1e+296)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(* c0 (sqrt (/ (/ A l) V)))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -2e+64) {
tmp = c0 * sqrt(((A / V) / l));
} else if ((V * l) <= 4e-309) {
tmp = c0 / sqrt((V * (l / A)));
} else if ((V * l) <= 1e+296) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} 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) :: tmp
if ((v * l) <= (-2d+64)) then
tmp = c0 * sqrt(((a / v) / l))
else if ((v * l) <= 4d-309) then
tmp = c0 / sqrt((v * (l / a)))
else if ((v * l) <= 1d+296) then
tmp = c0 * (sqrt(a) / sqrt((v * l)))
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 tmp;
if ((V * l) <= -2e+64) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else if ((V * l) <= 4e-309) {
tmp = c0 / Math.sqrt((V * (l / A)));
} else if ((V * l) <= 1e+296) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} 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): tmp = 0 if (V * l) <= -2e+64: tmp = c0 * math.sqrt(((A / V) / l)) elif (V * l) <= 4e-309: tmp = c0 / math.sqrt((V * (l / A))) elif (V * l) <= 1e+296: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) 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) tmp = 0.0 if (Float64(V * l) <= -2e+64) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); elseif (Float64(V * l) <= 4e-309) tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); elseif (Float64(V * l) <= 1e+296) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); 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)
tmp = 0.0;
if ((V * l) <= -2e+64)
tmp = c0 * sqrt(((A / V) / l));
elseif ((V * l) <= 4e-309)
tmp = c0 / sqrt((V * (l / A)));
elseif ((V * l) <= 1e+296)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
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_] := If[LessEqual[N[(V * l), $MachinePrecision], -2e+64], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 4e-309], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+296], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $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}
\mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+64}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{-309}:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+296}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\
\end{array}
\end{array}
if (*.f64 V l) < -2.00000000000000004e64Initial program 59.9%
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f6460.4
Applied egg-rr60.4%
if -2.00000000000000004e64 < (*.f64 V l) < 3.9999999999999977e-309Initial program 70.8%
clear-numN/A
sqrt-divN/A
metadata-evalN/A
un-div-invN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6480.2
Applied egg-rr80.2%
if 3.9999999999999977e-309 < (*.f64 V l) < 9.99999999999999981e295Initial program 86.9%
sqrt-divN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lft-identityN/A
+-commutativeN/A
accelerator-lowering-fma.f6499.4
Applied egg-rr99.4%
Taylor expanded in V around 0
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f6499.4
Simplified99.4%
if 9.99999999999999981e295 < (*.f64 V l) Initial program 29.5%
associate-/l/N/A
/-lowering-/.f64N/A
/-lowering-/.f6472.8
Applied egg-rr72.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 (<= V -2e-310) (* c0 (/ (sqrt (- 0.0 (/ A l))) (sqrt (- 0.0 V)))) (* c0 (/ (sqrt A) (* (sqrt l) (sqrt V))))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (V <= -2e-310) {
tmp = c0 * (sqrt((0.0 - (A / l))) / sqrt((0.0 - V)));
} else {
tmp = c0 * (sqrt(A) / (sqrt(l) * sqrt(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 (v <= (-2d-310)) then
tmp = c0 * (sqrt((0.0d0 - (a / l))) / sqrt((0.0d0 - v)))
else
tmp = c0 * (sqrt(a) / (sqrt(l) * sqrt(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 (V <= -2e-310) {
tmp = c0 * (Math.sqrt((0.0 - (A / l))) / Math.sqrt((0.0 - V)));
} else {
tmp = c0 * (Math.sqrt(A) / (Math.sqrt(l) * Math.sqrt(V)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): tmp = 0 if V <= -2e-310: tmp = c0 * (math.sqrt((0.0 - (A / l))) / math.sqrt((0.0 - V))) else: tmp = c0 * (math.sqrt(A) / (math.sqrt(l) * math.sqrt(V))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) tmp = 0.0 if (V <= -2e-310) tmp = Float64(c0 * Float64(sqrt(Float64(0.0 - Float64(A / l))) / sqrt(Float64(0.0 - V)))); else tmp = Float64(c0 * Float64(sqrt(A) / Float64(sqrt(l) * sqrt(V)))); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (V <= -2e-310)
tmp = c0 * (sqrt((0.0 - (A / l))) / sqrt((0.0 - V)));
else
tmp = c0 * (sqrt(A) / (sqrt(l) * sqrt(V)));
end
tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[V, -2e-310], N[(c0 * N[(N[Sqrt[N[(0.0 - N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(0.0 - V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[V], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \leq -2 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{0 - \frac{A}{\ell}}}{\sqrt{0 - V}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{\ell} \cdot \sqrt{V}}\\
\end{array}
\end{array}
if V < -1.999999999999994e-310Initial program 74.0%
associate-/l/N/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6476.0
Applied egg-rr76.0%
un-div-invN/A
frac-2negN/A
neg-mul-1N/A
sqrt-divN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
associate-*r/N/A
neg-mul-1N/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f64N/A
sqrt-lowering-sqrt.f64N/A
neg-sub0N/A
--lowering--.f6485.0
Applied egg-rr85.0%
if -1.999999999999994e-310 < V Initial program 70.5%
sqrt-divN/A
/-lowering-/.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f64N/A
+-lft-identityN/A
+-commutativeN/A
accelerator-lowering-fma.f6443.2
Applied egg-rr43.2%
+-rgt-identityN/A
*-commutativeN/A
sqrt-prodN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
sqrt-lowering-sqrt.f6456.2
Applied egg-rr56.2%
Final simplification71.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 72.3%
herbie shell --seed 2024199
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))