| Alternative 1 | |
|---|---|
| Accuracy | 74.7% |
| Cost | 27724 |
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) (- INFINITY))
(* (sqrt (/ A V)) (/ c0 (sqrt l)))
(if (<= (* V l) -1e-258)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 2e-319)
(* c0 (* (pow (/ -1.0 V) 0.5) (pow (/ (- l) A) -0.5)))
(if (<= (* V l) 1e+307)
(/ c0 (/ (sqrt (* V l)) (sqrt A)))
(* (sqrt A) (sqrt (* (/ c0 V) (/ c0 l)))))))))double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = sqrt((A / V)) * (c0 / sqrt(l));
} else if ((V * l) <= -1e-258) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 2e-319) {
tmp = c0 * (pow((-1.0 / V), 0.5) * pow((-l / A), -0.5));
} else if ((V * l) <= 1e+307) {
tmp = c0 / (sqrt((V * l)) / sqrt(A));
} else {
tmp = sqrt(A) * sqrt(((c0 / V) * (c0 / l)));
}
return tmp;
}
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = Math.sqrt((A / V)) * (c0 / Math.sqrt(l));
} else if ((V * l) <= -1e-258) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 2e-319) {
tmp = c0 * (Math.pow((-1.0 / V), 0.5) * Math.pow((-l / A), -0.5));
} else if ((V * l) <= 1e+307) {
tmp = c0 / (Math.sqrt((V * l)) / Math.sqrt(A));
} else {
tmp = Math.sqrt(A) * Math.sqrt(((c0 / V) * (c0 / l)));
}
return tmp;
}
def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
def code(c0, A, V, l): tmp = 0 if (V * l) <= -math.inf: tmp = math.sqrt((A / V)) * (c0 / math.sqrt(l)) elif (V * l) <= -1e-258: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 2e-319: tmp = c0 * (math.pow((-1.0 / V), 0.5) * math.pow((-l / A), -0.5)) elif (V * l) <= 1e+307: tmp = c0 / (math.sqrt((V * l)) / math.sqrt(A)) else: tmp = math.sqrt(A) * math.sqrt(((c0 / V) * (c0 / l))) return tmp
function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(sqrt(Float64(A / V)) * Float64(c0 / sqrt(l))); elseif (Float64(V * l) <= -1e-258) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 2e-319) tmp = Float64(c0 * Float64((Float64(-1.0 / V) ^ 0.5) * (Float64(Float64(-l) / A) ^ -0.5))); elseif (Float64(V * l) <= 1e+307) tmp = Float64(c0 / Float64(sqrt(Float64(V * l)) / sqrt(A))); else tmp = Float64(sqrt(A) * sqrt(Float64(Float64(c0 / V) * Float64(c0 / l)))); end return tmp end
function tmp = code(c0, A, V, l) tmp = c0 * sqrt((A / (V * l))); end
function tmp_2 = code(c0, A, V, l) tmp = 0.0; if ((V * l) <= -Inf) tmp = sqrt((A / V)) * (c0 / sqrt(l)); elseif ((V * l) <= -1e-258) tmp = c0 * (sqrt(-A) / sqrt((V * -l))); elseif ((V * l) <= 2e-319) tmp = c0 * (((-1.0 / V) ^ 0.5) * ((-l / A) ^ -0.5)); elseif ((V * l) <= 1e+307) tmp = c0 / (sqrt((V * l)) / sqrt(A)); else tmp = sqrt(A) * sqrt(((c0 / V) * (c0 / l))); end tmp_2 = tmp; end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-258], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e-319], N[(c0 * N[(N[Power[N[(-1.0 / V), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[((-l) / A), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+307], N[(c0 / N[(N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[A], $MachinePrecision] * N[Sqrt[N[(N[(c0 / V), $MachinePrecision] * N[(c0 / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-258}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-319}:\\
\;\;\;\;c0 \cdot \left({\left(\frac{-1}{V}\right)}^{0.5} \cdot {\left(\frac{-\ell}{A}\right)}^{-0.5}\right)\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+307}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{A} \cdot \sqrt{\frac{c0}{V} \cdot \frac{c0}{\ell}}\\
\end{array}
Results
if (*.f64 V l) < -inf.0Initial program 35.4%
Applied egg-rr85.2%
[Start]35.4 | \[ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\] |
|---|---|
associate-/r* [=>]62.6 | \[ c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}}
\] |
sqrt-div [=>]85.2 | \[ c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}}
\] |
Applied egg-rr84.4%
[Start]85.2 | \[ c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}
\] |
|---|---|
associate-*r/ [=>]85.2 | \[ \color{blue}{\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}}
\] |
clear-num [=>]84.4 | \[ \color{blue}{\frac{1}{\frac{\sqrt{\ell}}{c0 \cdot \sqrt{\frac{A}{V}}}}}
\] |
*-commutative [=>]84.4 | \[ \frac{1}{\frac{\sqrt{\ell}}{\color{blue}{\sqrt{\frac{A}{V}} \cdot c0}}}
\] |
Simplified84.6%
[Start]84.4 | \[ \frac{1}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}} \cdot c0}}
\] |
|---|---|
associate-/r* [=>]84.3 | \[ \frac{1}{\color{blue}{\frac{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}{c0}}}
\] |
associate-/r/ [=>]85.0 | \[ \color{blue}{\frac{1}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}} \cdot c0}
\] |
associate-*l/ [=>]85.1 | \[ \color{blue}{\frac{1 \cdot c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}}
\] |
*-lft-identity [=>]85.1 | \[ \frac{\color{blue}{c0}}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}
\] |
associate-/r/ [=>]84.6 | \[ \color{blue}{\frac{c0}{\sqrt{\ell}} \cdot \sqrt{\frac{A}{V}}}
\] |
*-commutative [=>]84.6 | \[ \color{blue}{\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}}
\] |
if -inf.0 < (*.f64 V l) < -9.99999999999999954e-259Initial program 85.1%
Applied egg-rr99.4%
[Start]85.1 | \[ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\] |
|---|---|
frac-2neg [=>]85.1 | \[ c0 \cdot \sqrt{\color{blue}{\frac{-A}{-V \cdot \ell}}}
\] |
sqrt-div [=>]99.4 | \[ c0 \cdot \color{blue}{\frac{\sqrt{-A}}{\sqrt{-V \cdot \ell}}}
\] |
*-commutative [=>]99.4 | \[ c0 \cdot \frac{\sqrt{-A}}{\sqrt{-\color{blue}{\ell \cdot V}}}
\] |
distribute-rgt-neg-in [=>]99.4 | \[ c0 \cdot \frac{\sqrt{-A}}{\sqrt{\color{blue}{\ell \cdot \left(-V\right)}}}
\] |
if -9.99999999999999954e-259 < (*.f64 V l) < 1.99998e-319Initial program 11.9%
Applied egg-rr46.4%
[Start]11.9 | \[ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\] |
|---|---|
pow1/2 [=>]11.9 | \[ c0 \cdot \color{blue}{{\left(\frac{A}{V \cdot \ell}\right)}^{0.5}}
\] |
clear-num [=>]11.9 | \[ c0 \cdot {\color{blue}{\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)}}^{0.5}
\] |
inv-pow [=>]11.9 | \[ c0 \cdot {\color{blue}{\left({\left(\frac{V \cdot \ell}{A}\right)}^{-1}\right)}}^{0.5}
\] |
pow-pow [=>]12.0 | \[ c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}}
\] |
associate-/l* [=>]46.4 | \[ c0 \cdot {\color{blue}{\left(\frac{V}{\frac{A}{\ell}}\right)}}^{\left(-1 \cdot 0.5\right)}
\] |
metadata-eval [=>]46.4 | \[ c0 \cdot {\left(\frac{V}{\frac{A}{\ell}}\right)}^{\color{blue}{-0.5}}
\] |
Simplified46.5%
[Start]46.4 | \[ c0 \cdot {\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}
\] |
|---|---|
associate-/l* [<=]12.0 | \[ c0 \cdot {\color{blue}{\left(\frac{V \cdot \ell}{A}\right)}}^{-0.5}
\] |
*-lft-identity [<=]12.0 | \[ c0 \cdot {\left(\frac{V \cdot \ell}{\color{blue}{1 \cdot A}}\right)}^{-0.5}
\] |
times-frac [=>]46.5 | \[ c0 \cdot {\color{blue}{\left(\frac{V}{1} \cdot \frac{\ell}{A}\right)}}^{-0.5}
\] |
/-rgt-identity [=>]46.5 | \[ c0 \cdot {\left(\color{blue}{V} \cdot \frac{\ell}{A}\right)}^{-0.5}
\] |
Taylor expanded in V around -inf 53.7%
Simplified58.9%
[Start]53.7 | \[ c0 \cdot e^{-0.5 \cdot \left(\log \left(-1 \cdot \frac{\ell}{A}\right) + -1 \cdot \log \left(\frac{-1}{V}\right)\right)}
\] |
|---|---|
+-commutative [=>]53.7 | \[ c0 \cdot e^{-0.5 \cdot \color{blue}{\left(-1 \cdot \log \left(\frac{-1}{V}\right) + \log \left(-1 \cdot \frac{\ell}{A}\right)\right)}}
\] |
distribute-lft-in [=>]53.7 | \[ c0 \cdot e^{\color{blue}{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right) + -0.5 \cdot \log \left(-1 \cdot \frac{\ell}{A}\right)}}
\] |
*-commutative [<=]53.7 | \[ c0 \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right) + \color{blue}{\log \left(-1 \cdot \frac{\ell}{A}\right) \cdot -0.5}}
\] |
exp-sum [=>]54.3 | \[ c0 \cdot \color{blue}{\left(e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)} \cdot e^{\log \left(-1 \cdot \frac{\ell}{A}\right) \cdot -0.5}\right)}
\] |
associate-*r* [=>]54.3 | \[ c0 \cdot \left(e^{\color{blue}{\left(-0.5 \cdot -1\right) \cdot \log \left(\frac{-1}{V}\right)}} \cdot e^{\log \left(-1 \cdot \frac{\ell}{A}\right) \cdot -0.5}\right)
\] |
metadata-eval [=>]54.3 | \[ c0 \cdot \left(e^{\color{blue}{0.5} \cdot \log \left(\frac{-1}{V}\right)} \cdot e^{\log \left(-1 \cdot \frac{\ell}{A}\right) \cdot -0.5}\right)
\] |
*-commutative [<=]54.3 | \[ c0 \cdot \left(e^{\color{blue}{\log \left(\frac{-1}{V}\right) \cdot 0.5}} \cdot e^{\log \left(-1 \cdot \frac{\ell}{A}\right) \cdot -0.5}\right)
\] |
exp-to-pow [=>]55.3 | \[ c0 \cdot \left(\color{blue}{{\left(\frac{-1}{V}\right)}^{0.5}} \cdot e^{\log \left(-1 \cdot \frac{\ell}{A}\right) \cdot -0.5}\right)
\] |
exp-to-pow [=>]58.9 | \[ c0 \cdot \left({\left(\frac{-1}{V}\right)}^{0.5} \cdot \color{blue}{{\left(-1 \cdot \frac{\ell}{A}\right)}^{-0.5}}\right)
\] |
associate-*r/ [=>]58.9 | \[ c0 \cdot \left({\left(\frac{-1}{V}\right)}^{0.5} \cdot {\color{blue}{\left(\frac{-1 \cdot \ell}{A}\right)}}^{-0.5}\right)
\] |
neg-mul-1 [<=]58.9 | \[ c0 \cdot \left({\left(\frac{-1}{V}\right)}^{0.5} \cdot {\left(\frac{\color{blue}{-\ell}}{A}\right)}^{-0.5}\right)
\] |
if 1.99998e-319 < (*.f64 V l) < 9.99999999999999986e306Initial program 83.5%
Applied egg-rr95.8%
[Start]83.5 | \[ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\] |
|---|---|
sqrt-div [=>]99.2 | \[ c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}}
\] |
associate-*r/ [=>]95.8 | \[ \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}}
\] |
Simplified99.2%
[Start]95.8 | \[ \frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}
\] |
|---|---|
associate-/l* [=>]99.2 | \[ \color{blue}{\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}}
\] |
if 9.99999999999999986e306 < (*.f64 V l) Initial program 39.4%
Applied egg-rr39.3%
[Start]39.4 | \[ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\] |
|---|---|
sqrt-div [=>]39.4 | \[ c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}}
\] |
associate-*r/ [=>]39.3 | \[ \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}}
\] |
Simplified39.4%
[Start]39.3 | \[ \frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}
\] |
|---|---|
associate-*l/ [<=]39.4 | \[ \color{blue}{\frac{c0}{\sqrt{V \cdot \ell}} \cdot \sqrt{A}}
\] |
Applied egg-rr38.6%
[Start]39.4 | \[ \frac{c0}{\sqrt{V \cdot \ell}} \cdot \sqrt{A}
\] |
|---|---|
add-sqr-sqrt [=>]39.4 | \[ \color{blue}{\left(\sqrt{\frac{c0}{\sqrt{V \cdot \ell}}} \cdot \sqrt{\frac{c0}{\sqrt{V \cdot \ell}}}\right)} \cdot \sqrt{A}
\] |
sqrt-unprod [=>]39.4 | \[ \color{blue}{\sqrt{\frac{c0}{\sqrt{V \cdot \ell}} \cdot \frac{c0}{\sqrt{V \cdot \ell}}}} \cdot \sqrt{A}
\] |
pow1/2 [=>]39.4 | \[ \color{blue}{{\left(\frac{c0}{\sqrt{V \cdot \ell}} \cdot \frac{c0}{\sqrt{V \cdot \ell}}\right)}^{0.5}} \cdot \sqrt{A}
\] |
frac-times [=>]38.6 | \[ {\color{blue}{\left(\frac{c0 \cdot c0}{\sqrt{V \cdot \ell} \cdot \sqrt{V \cdot \ell}}\right)}}^{0.5} \cdot \sqrt{A}
\] |
add-sqr-sqrt [<=]38.6 | \[ {\left(\frac{c0 \cdot c0}{\color{blue}{V \cdot \ell}}\right)}^{0.5} \cdot \sqrt{A}
\] |
Simplified60.1%
[Start]38.6 | \[ {\left(\frac{c0 \cdot c0}{V \cdot \ell}\right)}^{0.5} \cdot \sqrt{A}
\] |
|---|---|
unpow1/2 [=>]38.6 | \[ \color{blue}{\sqrt{\frac{c0 \cdot c0}{V \cdot \ell}}} \cdot \sqrt{A}
\] |
times-frac [=>]60.1 | \[ \sqrt{\color{blue}{\frac{c0}{V} \cdot \frac{c0}{\ell}}} \cdot \sqrt{A}
\] |
Final simplification91.3%
| Alternative 1 | |
|---|---|
| Accuracy | 74.7% |
| Cost | 27724 |
| Alternative 2 | |
|---|---|
| Accuracy | 74.9% |
| Cost | 27724 |
| Alternative 3 | |
|---|---|
| Accuracy | 74.9% |
| Cost | 27724 |
| Alternative 4 | |
|---|---|
| Accuracy | 74.9% |
| Cost | 27724 |
| Alternative 5 | |
|---|---|
| Accuracy | 91.3% |
| Cost | 20036 |
| Alternative 6 | |
|---|---|
| Accuracy | 91.2% |
| Cost | 14416 |
| Alternative 7 | |
|---|---|
| Accuracy | 86.1% |
| Cost | 14288 |
| Alternative 8 | |
|---|---|
| Accuracy | 87.4% |
| Cost | 14288 |
| Alternative 9 | |
|---|---|
| Accuracy | 92.0% |
| Cost | 14288 |
| Alternative 10 | |
|---|---|
| Accuracy | 91.6% |
| Cost | 14288 |
| Alternative 11 | |
|---|---|
| Accuracy | 81.2% |
| Cost | 14028 |
| Alternative 12 | |
|---|---|
| Accuracy | 81.0% |
| Cost | 14028 |
| Alternative 13 | |
|---|---|
| Accuracy | 76.7% |
| Cost | 7890 |
| Alternative 14 | |
|---|---|
| Accuracy | 76.2% |
| Cost | 7888 |
| Alternative 15 | |
|---|---|
| Accuracy | 76.4% |
| Cost | 7888 |
| Alternative 16 | |
|---|---|
| Accuracy | 70.1% |
| Cost | 6848 |
herbie shell --seed 2023146
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))