
(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 7 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}
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
:precision binary64
(*
c0_s
(if (<= (* V l) (- INFINITY))
(/ c0_m (/ (sqrt l) (sqrt (/ A V))))
(if (<= (* V l) -1e-307)
(/ c0_m (/ (sqrt (* V (- l))) (sqrt (- A))))
(if (<= (* V l) 1e-311)
(sqrt (* A (* (/ c0_m l) (/ c0_m V))))
(* c0_m (* (sqrt A) (sqrt (/ (/ 1.0 V) l)))))))))c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = c0_m / (sqrt(l) / sqrt((A / V)));
} else if ((V * l) <= -1e-307) {
tmp = c0_m / (sqrt((V * -l)) / sqrt(-A));
} else if ((V * l) <= 1e-311) {
tmp = sqrt((A * ((c0_m / l) * (c0_m / V))));
} else {
tmp = c0_m * (sqrt(A) * sqrt(((1.0 / V) / l)));
}
return c0_s * tmp;
}
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = c0_m / (Math.sqrt(l) / Math.sqrt((A / V)));
} else if ((V * l) <= -1e-307) {
tmp = c0_m / (Math.sqrt((V * -l)) / Math.sqrt(-A));
} else if ((V * l) <= 1e-311) {
tmp = Math.sqrt((A * ((c0_m / l) * (c0_m / V))));
} else {
tmp = c0_m * (Math.sqrt(A) * Math.sqrt(((1.0 / V) / l)));
}
return c0_s * tmp;
}
c0\_m = math.fabs(c0) c0\_s = math.copysign(1.0, c0) [c0_m, A, V, l] = sort([c0_m, A, V, l]) def code(c0_s, c0_m, A, V, l): tmp = 0 if (V * l) <= -math.inf: tmp = c0_m / (math.sqrt(l) / math.sqrt((A / V))) elif (V * l) <= -1e-307: tmp = c0_m / (math.sqrt((V * -l)) / math.sqrt(-A)) elif (V * l) <= 1e-311: tmp = math.sqrt((A * ((c0_m / l) * (c0_m / V)))) else: tmp = c0_m * (math.sqrt(A) * math.sqrt(((1.0 / V) / l))) return c0_s * tmp
c0\_m = abs(c0) c0\_s = copysign(1.0, c0) c0_m, A, V, l = sort([c0_m, A, V, l]) function code(c0_s, c0_m, A, V, l) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(c0_m / Float64(sqrt(l) / sqrt(Float64(A / V)))); elseif (Float64(V * l) <= -1e-307) tmp = Float64(c0_m / Float64(sqrt(Float64(V * Float64(-l))) / sqrt(Float64(-A)))); elseif (Float64(V * l) <= 1e-311) tmp = sqrt(Float64(A * Float64(Float64(c0_m / l) * Float64(c0_m / V)))); else tmp = Float64(c0_m * Float64(sqrt(A) * sqrt(Float64(Float64(1.0 / V) / l)))); end return Float64(c0_s * tmp) end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp_2 = code(c0_s, c0_m, A, V, l)
tmp = 0.0;
if ((V * l) <= -Inf)
tmp = c0_m / (sqrt(l) / sqrt((A / V)));
elseif ((V * l) <= -1e-307)
tmp = c0_m / (sqrt((V * -l)) / sqrt(-A));
elseif ((V * l) <= 1e-311)
tmp = sqrt((A * ((c0_m / l) * (c0_m / V))));
else
tmp = c0_m * (sqrt(A) * sqrt(((1.0 / V) / l)));
end
tmp_2 = c0_s * tmp;
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := N[(c0$95$s * If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(c0$95$m / N[(N[Sqrt[l], $MachinePrecision] / N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-307], N[(c0$95$m / N[(N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-A)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e-311], N[Sqrt[N[(A * N[(N[(c0$95$m / l), $MachinePrecision] * N[(c0$95$m / V), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(c0$95$m * N[(N[Sqrt[A], $MachinePrecision] * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;\frac{c0\_m}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-307}:\\
\;\;\;\;\frac{c0\_m}{\frac{\sqrt{V \cdot \left(-\ell\right)}}{\sqrt{-A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{-311}:\\
\;\;\;\;\sqrt{A \cdot \left(\frac{c0\_m}{\ell} \cdot \frac{c0\_m}{V}\right)}\\
\mathbf{else}:\\
\;\;\;\;c0\_m \cdot \left(\sqrt{A} \cdot \sqrt{\frac{\frac{1}{V}}{\ell}}\right)\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 42.3%
*-un-lft-identity42.3%
times-frac77.1%
Applied egg-rr77.1%
frac-times42.3%
*-un-lft-identity42.3%
sqrt-undiv0.0%
clear-num0.0%
un-div-inv0.0%
sqrt-undiv42.3%
Applied egg-rr42.3%
associate-*r/71.3%
*-commutative71.3%
associate-/r/71.3%
Simplified71.3%
sqrt-div54.8%
div-inv54.7%
Applied egg-rr54.7%
associate-*r/54.8%
*-rgt-identity54.8%
Simplified54.8%
if -inf.0 < (*.f64 V l) < -9.99999999999999909e-308Initial program 85.3%
*-un-lft-identity85.3%
times-frac79.0%
Applied egg-rr79.0%
frac-times85.3%
*-un-lft-identity85.3%
sqrt-undiv0.0%
clear-num0.0%
un-div-inv0.0%
sqrt-undiv86.8%
Applied egg-rr86.8%
associate-*r/80.4%
*-commutative80.4%
associate-/r/76.4%
Simplified76.4%
associate-/r/80.4%
Applied egg-rr80.4%
*-commutative80.4%
associate-/l*86.8%
frac-2neg86.8%
sqrt-div99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
Applied egg-rr99.5%
if -9.99999999999999909e-308 < (*.f64 V l) < 9.99999999999948e-312Initial program 56.7%
add-sqr-sqrt21.7%
sqrt-unprod21.8%
*-commutative21.8%
*-commutative21.8%
swap-sqr21.5%
add-sqr-sqrt21.5%
pow221.5%
Applied egg-rr21.5%
associate-*l/21.3%
*-commutative21.3%
times-frac33.5%
Simplified33.5%
div-inv33.5%
unpow233.5%
associate-*l*43.3%
Applied egg-rr43.3%
pow1/243.3%
associate-*r*43.3%
unpow-prod-down40.2%
pow1/231.6%
un-div-inv31.6%
Applied egg-rr31.6%
unpow1/231.6%
associate-*l/26.3%
associate-/l*31.6%
Simplified31.6%
sqrt-unprod43.4%
associate-*l*43.3%
Applied egg-rr43.3%
if 9.99999999999948e-312 < (*.f64 V l) Initial program 75.9%
pow1/275.9%
div-inv75.8%
unpow-prod-down92.9%
pow1/292.9%
Applied egg-rr92.9%
unpow1/292.9%
associate-/r*93.2%
Simplified93.2%
Final simplification85.8%
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
:precision binary64
(let* ((t_0 (* c0_m (sqrt (/ A (* V l))))))
(*
c0_s
(if (or (<= t_0 0.0) (not (<= t_0 1.3e+298)))
(* c0_m (sqrt (/ (/ A V) l)))
t_0))))c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
double t_0 = c0_m * sqrt((A / (V * l)));
double tmp;
if ((t_0 <= 0.0) || !(t_0 <= 1.3e+298)) {
tmp = c0_m * sqrt(((A / V) / l));
} else {
tmp = t_0;
}
return c0_s * tmp;
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
real(8), intent (in) :: c0_s
real(8), intent (in) :: c0_m
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_m * sqrt((a / (v * l)))
if ((t_0 <= 0.0d0) .or. (.not. (t_0 <= 1.3d+298))) then
tmp = c0_m * sqrt(((a / v) / l))
else
tmp = t_0
end if
code = c0_s * tmp
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
double t_0 = c0_m * Math.sqrt((A / (V * l)));
double tmp;
if ((t_0 <= 0.0) || !(t_0 <= 1.3e+298)) {
tmp = c0_m * Math.sqrt(((A / V) / l));
} else {
tmp = t_0;
}
return c0_s * tmp;
}
c0\_m = math.fabs(c0) c0\_s = math.copysign(1.0, c0) [c0_m, A, V, l] = sort([c0_m, A, V, l]) def code(c0_s, c0_m, A, V, l): t_0 = c0_m * math.sqrt((A / (V * l))) tmp = 0 if (t_0 <= 0.0) or not (t_0 <= 1.3e+298): tmp = c0_m * math.sqrt(((A / V) / l)) else: tmp = t_0 return c0_s * tmp
c0\_m = abs(c0) c0\_s = copysign(1.0, c0) c0_m, A, V, l = sort([c0_m, A, V, l]) function code(c0_s, c0_m, A, V, l) t_0 = Float64(c0_m * sqrt(Float64(A / Float64(V * l)))) tmp = 0.0 if ((t_0 <= 0.0) || !(t_0 <= 1.3e+298)) tmp = Float64(c0_m * sqrt(Float64(Float64(A / V) / l))); else tmp = t_0; end return Float64(c0_s * tmp) end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp_2 = code(c0_s, c0_m, A, V, l)
t_0 = c0_m * sqrt((A / (V * l)));
tmp = 0.0;
if ((t_0 <= 0.0) || ~((t_0 <= 1.3e+298)))
tmp = c0_m * sqrt(((A / V) / l));
else
tmp = t_0;
end
tmp_2 = c0_s * tmp;
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := Block[{t$95$0 = N[(c0$95$m * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 1.3e+298]], $MachinePrecision]], N[(c0$95$m * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]), $MachinePrecision]]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
\begin{array}{l}
t_0 := c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0 \lor \neg \left(t\_0 \leq 1.3 \cdot 10^{+298}\right):\\
\;\;\;\;c0\_m \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 0.0 or 1.3e298 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) Initial program 67.2%
associate-/r*70.2%
Simplified70.2%
if 0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1.3e298Initial program 98.0%
Final simplification76.6%
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
:precision binary64
(*
c0_s
(if (<= (* V l) (- INFINITY))
(/ c0_m (/ (sqrt l) (sqrt (/ A V))))
(if (<= (* V l) -1e-307)
(* c0_m (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 1e-311)
(sqrt (* A (* (/ c0_m l) (/ c0_m V))))
(* c0_m (* (sqrt A) (sqrt (/ (/ 1.0 V) l)))))))))c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = c0_m / (sqrt(l) / sqrt((A / V)));
} else if ((V * l) <= -1e-307) {
tmp = c0_m * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 1e-311) {
tmp = sqrt((A * ((c0_m / l) * (c0_m / V))));
} else {
tmp = c0_m * (sqrt(A) * sqrt(((1.0 / V) / l)));
}
return c0_s * tmp;
}
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = c0_m / (Math.sqrt(l) / Math.sqrt((A / V)));
} else if ((V * l) <= -1e-307) {
tmp = c0_m * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 1e-311) {
tmp = Math.sqrt((A * ((c0_m / l) * (c0_m / V))));
} else {
tmp = c0_m * (Math.sqrt(A) * Math.sqrt(((1.0 / V) / l)));
}
return c0_s * tmp;
}
c0\_m = math.fabs(c0) c0\_s = math.copysign(1.0, c0) [c0_m, A, V, l] = sort([c0_m, A, V, l]) def code(c0_s, c0_m, A, V, l): tmp = 0 if (V * l) <= -math.inf: tmp = c0_m / (math.sqrt(l) / math.sqrt((A / V))) elif (V * l) <= -1e-307: tmp = c0_m * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 1e-311: tmp = math.sqrt((A * ((c0_m / l) * (c0_m / V)))) else: tmp = c0_m * (math.sqrt(A) * math.sqrt(((1.0 / V) / l))) return c0_s * tmp
c0\_m = abs(c0) c0\_s = copysign(1.0, c0) c0_m, A, V, l = sort([c0_m, A, V, l]) function code(c0_s, c0_m, A, V, l) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(c0_m / Float64(sqrt(l) / sqrt(Float64(A / V)))); elseif (Float64(V * l) <= -1e-307) tmp = Float64(c0_m * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 1e-311) tmp = sqrt(Float64(A * Float64(Float64(c0_m / l) * Float64(c0_m / V)))); else tmp = Float64(c0_m * Float64(sqrt(A) * sqrt(Float64(Float64(1.0 / V) / l)))); end return Float64(c0_s * tmp) end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp_2 = code(c0_s, c0_m, A, V, l)
tmp = 0.0;
if ((V * l) <= -Inf)
tmp = c0_m / (sqrt(l) / sqrt((A / V)));
elseif ((V * l) <= -1e-307)
tmp = c0_m * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 1e-311)
tmp = sqrt((A * ((c0_m / l) * (c0_m / V))));
else
tmp = c0_m * (sqrt(A) * sqrt(((1.0 / V) / l)));
end
tmp_2 = c0_s * tmp;
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := N[(c0$95$s * If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(c0$95$m / N[(N[Sqrt[l], $MachinePrecision] / N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-307], N[(c0$95$m * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e-311], N[Sqrt[N[(A * N[(N[(c0$95$m / l), $MachinePrecision] * N[(c0$95$m / V), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(c0$95$m * N[(N[Sqrt[A], $MachinePrecision] * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;\frac{c0\_m}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-307}:\\
\;\;\;\;c0\_m \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{-311}:\\
\;\;\;\;\sqrt{A \cdot \left(\frac{c0\_m}{\ell} \cdot \frac{c0\_m}{V}\right)}\\
\mathbf{else}:\\
\;\;\;\;c0\_m \cdot \left(\sqrt{A} \cdot \sqrt{\frac{\frac{1}{V}}{\ell}}\right)\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 42.3%
*-un-lft-identity42.3%
times-frac77.1%
Applied egg-rr77.1%
frac-times42.3%
*-un-lft-identity42.3%
sqrt-undiv0.0%
clear-num0.0%
un-div-inv0.0%
sqrt-undiv42.3%
Applied egg-rr42.3%
associate-*r/71.3%
*-commutative71.3%
associate-/r/71.3%
Simplified71.3%
sqrt-div54.8%
div-inv54.7%
Applied egg-rr54.7%
associate-*r/54.8%
*-rgt-identity54.8%
Simplified54.8%
if -inf.0 < (*.f64 V l) < -9.99999999999999909e-308Initial program 85.3%
frac-2neg85.3%
sqrt-div99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
Applied egg-rr99.4%
if -9.99999999999999909e-308 < (*.f64 V l) < 9.99999999999948e-312Initial program 56.7%
add-sqr-sqrt21.7%
sqrt-unprod21.8%
*-commutative21.8%
*-commutative21.8%
swap-sqr21.5%
add-sqr-sqrt21.5%
pow221.5%
Applied egg-rr21.5%
associate-*l/21.3%
*-commutative21.3%
times-frac33.5%
Simplified33.5%
div-inv33.5%
unpow233.5%
associate-*l*43.3%
Applied egg-rr43.3%
pow1/243.3%
associate-*r*43.3%
unpow-prod-down40.2%
pow1/231.6%
un-div-inv31.6%
Applied egg-rr31.6%
unpow1/231.6%
associate-*l/26.3%
associate-/l*31.6%
Simplified31.6%
sqrt-unprod43.4%
associate-*l*43.3%
Applied egg-rr43.3%
if 9.99999999999948e-312 < (*.f64 V l) Initial program 75.9%
pow1/275.9%
div-inv75.8%
unpow-prod-down92.9%
pow1/292.9%
Applied egg-rr92.9%
unpow1/292.9%
associate-/r*93.2%
Simplified93.2%
Final simplification85.8%
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
:precision binary64
(let* ((t_0 (/ A (* V l))))
(*
c0_s
(if (<= t_0 0.0)
(* (sqrt (/ A V)) (/ c0_m (sqrt l)))
(if (<= t_0 5e+294)
(* c0_m (sqrt t_0))
(sqrt (* A (* (/ c0_m l) (/ c0_m V)))))))))c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = sqrt((A / V)) * (c0_m / sqrt(l));
} else if (t_0 <= 5e+294) {
tmp = c0_m * sqrt(t_0);
} else {
tmp = sqrt((A * ((c0_m / l) * (c0_m / V))));
}
return c0_s * tmp;
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
real(8), intent (in) :: c0_s
real(8), intent (in) :: c0_m
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 = sqrt((a / v)) * (c0_m / sqrt(l))
else if (t_0 <= 5d+294) then
tmp = c0_m * sqrt(t_0)
else
tmp = sqrt((a * ((c0_m / l) * (c0_m / v))))
end if
code = c0_s * tmp
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = Math.sqrt((A / V)) * (c0_m / Math.sqrt(l));
} else if (t_0 <= 5e+294) {
tmp = c0_m * Math.sqrt(t_0);
} else {
tmp = Math.sqrt((A * ((c0_m / l) * (c0_m / V))));
}
return c0_s * tmp;
}
c0\_m = math.fabs(c0) c0\_s = math.copysign(1.0, c0) [c0_m, A, V, l] = sort([c0_m, A, V, l]) def code(c0_s, c0_m, A, V, l): t_0 = A / (V * l) tmp = 0 if t_0 <= 0.0: tmp = math.sqrt((A / V)) * (c0_m / math.sqrt(l)) elif t_0 <= 5e+294: tmp = c0_m * math.sqrt(t_0) else: tmp = math.sqrt((A * ((c0_m / l) * (c0_m / V)))) return c0_s * tmp
c0\_m = abs(c0) c0\_s = copysign(1.0, c0) c0_m, A, V, l = sort([c0_m, A, V, l]) function code(c0_s, c0_m, A, V, l) t_0 = Float64(A / Float64(V * l)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(sqrt(Float64(A / V)) * Float64(c0_m / sqrt(l))); elseif (t_0 <= 5e+294) tmp = Float64(c0_m * sqrt(t_0)); else tmp = sqrt(Float64(A * Float64(Float64(c0_m / l) * Float64(c0_m / V)))); end return Float64(c0_s * tmp) end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp_2 = code(c0_s, c0_m, A, V, l)
t_0 = A / (V * l);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = sqrt((A / V)) * (c0_m / sqrt(l));
elseif (t_0 <= 5e+294)
tmp = c0_m * sqrt(t_0);
else
tmp = sqrt((A * ((c0_m / l) * (c0_m / V))));
end
tmp_2 = c0_s * tmp;
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[LessEqual[t$95$0, 0.0], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(c0$95$m / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+294], N[(c0$95$m * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(A * N[(N[(c0$95$m / l), $MachinePrecision] * N[(c0$95$m / V), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0\_m}{\sqrt{\ell}}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+294}:\\
\;\;\;\;c0\_m \cdot \sqrt{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{A \cdot \left(\frac{c0\_m}{\ell} \cdot \frac{c0\_m}{V}\right)}\\
\end{array}
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 35.6%
associate-/r*50.9%
sqrt-div51.7%
associate-*r/50.2%
Applied egg-rr50.2%
*-commutative50.2%
associate-/l*51.8%
Simplified51.8%
if 0.0 < (/.f64 A (*.f64 V l)) < 4.9999999999999999e294Initial program 98.9%
if 4.9999999999999999e294 < (/.f64 A (*.f64 V l)) Initial program 51.1%
add-sqr-sqrt18.9%
sqrt-unprod19.1%
*-commutative19.1%
*-commutative19.1%
swap-sqr18.7%
add-sqr-sqrt18.7%
pow218.7%
Applied egg-rr18.7%
associate-*l/19.1%
*-commutative19.1%
times-frac25.3%
Simplified25.3%
div-inv25.3%
unpow225.3%
associate-*l*31.5%
Applied egg-rr31.5%
pow1/231.5%
associate-*r*33.2%
unpow-prod-down29.3%
pow1/220.2%
un-div-inv20.2%
Applied egg-rr20.2%
unpow1/220.2%
associate-*l/16.8%
associate-/l*20.2%
Simplified20.2%
sqrt-unprod35.0%
associate-*l*35.0%
Applied egg-rr35.0%
c0\_m = (fabs.f64 c0)
c0\_s = (copysign.f64 #s(literal 1 binary64) c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0_s c0_m A V l)
:precision binary64
(let* ((t_0 (/ A (* V l))))
(*
c0_s
(if (or (<= t_0 0.0) (not (<= t_0 5e+294)))
(sqrt (* A (* (/ c0_m l) (/ c0_m V))))
(* c0_m (sqrt t_0))))))c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if ((t_0 <= 0.0) || !(t_0 <= 5e+294)) {
tmp = sqrt((A * ((c0_m / l) * (c0_m / V))));
} else {
tmp = c0_m * sqrt(t_0);
}
return c0_s * tmp;
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
real(8), intent (in) :: c0_s
real(8), intent (in) :: c0_m
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = a / (v * l)
if ((t_0 <= 0.0d0) .or. (.not. (t_0 <= 5d+294))) then
tmp = sqrt((a * ((c0_m / l) * (c0_m / v))))
else
tmp = c0_m * sqrt(t_0)
end if
code = c0_s * tmp
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if ((t_0 <= 0.0) || !(t_0 <= 5e+294)) {
tmp = Math.sqrt((A * ((c0_m / l) * (c0_m / V))));
} else {
tmp = c0_m * Math.sqrt(t_0);
}
return c0_s * tmp;
}
c0\_m = math.fabs(c0) c0\_s = math.copysign(1.0, c0) [c0_m, A, V, l] = sort([c0_m, A, V, l]) def code(c0_s, c0_m, A, V, l): t_0 = A / (V * l) tmp = 0 if (t_0 <= 0.0) or not (t_0 <= 5e+294): tmp = math.sqrt((A * ((c0_m / l) * (c0_m / V)))) else: tmp = c0_m * math.sqrt(t_0) return c0_s * tmp
c0\_m = abs(c0) c0\_s = copysign(1.0, c0) c0_m, A, V, l = sort([c0_m, A, V, l]) function code(c0_s, c0_m, A, V, l) t_0 = Float64(A / Float64(V * l)) tmp = 0.0 if ((t_0 <= 0.0) || !(t_0 <= 5e+294)) tmp = sqrt(Float64(A * Float64(Float64(c0_m / l) * Float64(c0_m / V)))); else tmp = Float64(c0_m * sqrt(t_0)); end return Float64(c0_s * tmp) end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp_2 = code(c0_s, c0_m, A, V, l)
t_0 = A / (V * l);
tmp = 0.0;
if ((t_0 <= 0.0) || ~((t_0 <= 5e+294)))
tmp = sqrt((A * ((c0_m / l) * (c0_m / V))));
else
tmp = c0_m * sqrt(t_0);
end
tmp_2 = c0_s * tmp;
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, N[(c0$95$s * If[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 5e+294]], $MachinePrecision]], N[Sqrt[N[(A * N[(N[(c0$95$m / l), $MachinePrecision] * N[(c0$95$m / V), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(c0$95$m * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
c0\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0 \lor \neg \left(t\_0 \leq 5 \cdot 10^{+294}\right):\\
\;\;\;\;\sqrt{A \cdot \left(\frac{c0\_m}{\ell} \cdot \frac{c0\_m}{V}\right)}\\
\mathbf{else}:\\
\;\;\;\;c0\_m \cdot \sqrt{t\_0}\\
\end{array}
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0 or 4.9999999999999999e294 < (/.f64 A (*.f64 V l)) Initial program 43.2%
add-sqr-sqrt27.5%
sqrt-unprod27.6%
*-commutative27.6%
*-commutative27.6%
swap-sqr26.9%
add-sqr-sqrt26.9%
pow226.9%
Applied egg-rr26.9%
associate-*l/27.9%
*-commutative27.9%
times-frac35.4%
Simplified35.4%
div-inv35.3%
unpow235.3%
associate-*l*41.1%
Applied egg-rr41.1%
pow1/241.1%
associate-*r*42.1%
unpow-prod-down31.5%
pow1/227.1%
un-div-inv27.1%
Applied egg-rr27.1%
unpow1/227.1%
associate-*l/27.1%
associate-/l*29.6%
Simplified29.6%
sqrt-unprod47.1%
associate-*l*43.7%
Applied egg-rr43.7%
if 0.0 < (/.f64 A (*.f64 V l)) < 4.9999999999999999e294Initial program 98.9%
Final simplification74.6%
c0\_m = (fabs.f64 c0) c0\_s = (copysign.f64 #s(literal 1 binary64) c0) NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function. (FPCore (c0_s c0_m A V l) :precision binary64 (* c0_s (* c0_m (sqrt (/ (/ A l) V)))))
c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
return c0_s * (c0_m * sqrt(((A / l) / V)));
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
real(8), intent (in) :: c0_s
real(8), intent (in) :: c0_m
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
code = c0_s * (c0_m * sqrt(((a / l) / v)))
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
return c0_s * (c0_m * Math.sqrt(((A / l) / V)));
}
c0\_m = math.fabs(c0) c0\_s = math.copysign(1.0, c0) [c0_m, A, V, l] = sort([c0_m, A, V, l]) def code(c0_s, c0_m, A, V, l): return c0_s * (c0_m * math.sqrt(((A / l) / V)))
c0\_m = abs(c0) c0\_s = copysign(1.0, c0) c0_m, A, V, l = sort([c0_m, A, V, l]) function code(c0_s, c0_m, A, V, l) return Float64(c0_s * Float64(c0_m * sqrt(Float64(Float64(A / l) / V)))) end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp = code(c0_s, c0_m, A, V, l)
tmp = c0_s * (c0_m * sqrt(((A / l) / V)));
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := N[(c0$95$s * N[(c0$95$m * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
c0\_s \cdot \left(c0\_m \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\right)
\end{array}
Initial program 74.3%
Taylor expanded in c0 around 0 74.3%
*-commutative74.3%
associate-/r*75.7%
Simplified75.7%
Final simplification75.7%
c0\_m = (fabs.f64 c0) c0\_s = (copysign.f64 #s(literal 1 binary64) c0) NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function. (FPCore (c0_s c0_m A V l) :precision binary64 (* c0_s (* c0_m (sqrt (/ A (* V l))))))
c0\_m = fabs(c0);
c0\_s = copysign(1.0, c0);
assert(c0_m < A && A < V && V < l);
double code(double c0_s, double c0_m, double A, double V, double l) {
return c0_s * (c0_m * sqrt((A / (V * l))));
}
c0\_m = abs(c0)
c0\_s = copysign(1.0d0, c0)
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
real(8) function code(c0_s, c0_m, a, v, l)
real(8), intent (in) :: c0_s
real(8), intent (in) :: c0_m
real(8), intent (in) :: a
real(8), intent (in) :: v
real(8), intent (in) :: l
code = c0_s * (c0_m * sqrt((a / (v * l))))
end function
c0\_m = Math.abs(c0);
c0\_s = Math.copySign(1.0, c0);
assert c0_m < A && A < V && V < l;
public static double code(double c0_s, double c0_m, double A, double V, double l) {
return c0_s * (c0_m * Math.sqrt((A / (V * l))));
}
c0\_m = math.fabs(c0) c0\_s = math.copysign(1.0, c0) [c0_m, A, V, l] = sort([c0_m, A, V, l]) def code(c0_s, c0_m, A, V, l): return c0_s * (c0_m * math.sqrt((A / (V * l))))
c0\_m = abs(c0) c0\_s = copysign(1.0, c0) c0_m, A, V, l = sort([c0_m, A, V, l]) function code(c0_s, c0_m, A, V, l) return Float64(c0_s * Float64(c0_m * sqrt(Float64(A / Float64(V * l))))) end
c0\_m = abs(c0);
c0\_s = sign(c0) * abs(1.0);
c0_m, A, V, l = num2cell(sort([c0_m, A, V, l])){:}
function tmp = code(c0_s, c0_m, A, V, l)
tmp = c0_s * (c0_m * sqrt((A / (V * l))));
end
c0\_m = N[Abs[c0], $MachinePrecision]
c0\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: c0_m, A, V, and l should be sorted in increasing order before calling this function.
code[c0$95$s_, c0$95$m_, A_, V_, l_] := N[(c0$95$s * N[(c0$95$m * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
c0\_m = \left|c0\right|
\\
c0\_s = \mathsf{copysign}\left(1, c0\right)
\\
[c0_m, A, V, l] = \mathsf{sort}([c0_m, A, V, l])\\
\\
c0\_s \cdot \left(c0\_m \cdot \sqrt{\frac{A}{V \cdot \ell}}\right)
\end{array}
Initial program 74.3%
herbie shell --seed 2024132
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))