| Alternative 1 | |
|---|---|
| Accuracy | 76.5% |
| Cost | 34514 |
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) (- INFINITY))
(/ (* c0 (sqrt (/ A V))) (sqrt l))
(if (<= (* V l) -5e-312)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 5e-307)
(* c0 (* (pow (/ (- l) A) -0.5) (/ 1.0 (sqrt (- V)))))
(* c0 (/ (sqrt A) (sqrt (* V 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 = (c0 * sqrt((A / V))) / sqrt(l);
} else if ((V * l) <= -5e-312) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 5e-307) {
tmp = c0 * (pow((-l / A), -0.5) * (1.0 / sqrt(-V)));
} else {
tmp = c0 * (sqrt(A) / sqrt((V * 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 = (c0 * Math.sqrt((A / V))) / Math.sqrt(l);
} else if ((V * l) <= -5e-312) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 5e-307) {
tmp = c0 * (Math.pow((-l / A), -0.5) * (1.0 / Math.sqrt(-V)));
} else {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * 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 = (c0 * math.sqrt((A / V))) / math.sqrt(l) elif (V * l) <= -5e-312: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 5e-307: tmp = c0 * (math.pow((-l / A), -0.5) * (1.0 / math.sqrt(-V))) else: tmp = c0 * (math.sqrt(A) / math.sqrt((V * 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(Float64(c0 * sqrt(Float64(A / V))) / sqrt(l)); elseif (Float64(V * l) <= -5e-312) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 5e-307) tmp = Float64(c0 * Float64((Float64(Float64(-l) / A) ^ -0.5) * Float64(1.0 / sqrt(Float64(-V))))); else tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * 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 = (c0 * sqrt((A / V))) / sqrt(l); elseif ((V * l) <= -5e-312) tmp = c0 * (sqrt(-A) / sqrt((V * -l))); elseif ((V * l) <= 5e-307) tmp = c0 * (((-l / A) ^ -0.5) * (1.0 / sqrt(-V))); else tmp = c0 * (sqrt(A) / sqrt((V * 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[(c0 * N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-312], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e-307], N[(c0 * N[(N[Power[N[((-l) / A), $MachinePrecision], -0.5], $MachinePrecision] * N[(1.0 / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-312}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{-307}:\\
\;\;\;\;c0 \cdot \left({\left(\frac{-\ell}{A}\right)}^{-0.5} \cdot \frac{1}{\sqrt{-V}}\right)\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\end{array}
Results
if (*.f64 V l) < -inf.0Initial program 38.2%
Applied egg-rr86.2%
[Start]38.2 | \[ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\] |
|---|---|
associate-/r* [=>]65.1 | \[ c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}}
\] |
sqrt-div [=>]86.2 | \[ c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}}
\] |
Applied egg-rr85.6%
[Start]86.2 | \[ c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}
\] |
|---|---|
*-commutative [=>]86.2 | \[ \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}} \cdot c0}
\] |
associate-*l/ [=>]85.6 | \[ \color{blue}{\frac{\sqrt{\frac{A}{V}} \cdot c0}{\sqrt{\ell}}}
\] |
if -inf.0 < (*.f64 V l) < -5.0000000000022e-312Initial program 84.7%
Applied egg-rr99.3%
[Start]84.7 | \[ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\] |
|---|---|
frac-2neg [=>]84.7 | \[ c0 \cdot \sqrt{\color{blue}{\frac{-A}{-V \cdot \ell}}}
\] |
sqrt-div [=>]99.3 | \[ c0 \cdot \color{blue}{\frac{\sqrt{-A}}{\sqrt{-V \cdot \ell}}}
\] |
*-commutative [=>]99.3 | \[ c0 \cdot \frac{\sqrt{-A}}{\sqrt{-\color{blue}{\ell \cdot V}}}
\] |
distribute-rgt-neg-in [=>]99.3 | \[ c0 \cdot \frac{\sqrt{-A}}{\sqrt{\color{blue}{\ell \cdot \left(-V\right)}}}
\] |
if -5.0000000000022e-312 < (*.f64 V l) < 5.00000000000000014e-307Initial program 3.6%
Applied egg-rr45.4%
[Start]3.6 | \[ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\] |
|---|---|
pow1/2 [=>]3.6 | \[ c0 \cdot \color{blue}{{\left(\frac{A}{V \cdot \ell}\right)}^{0.5}}
\] |
clear-num [=>]3.6 | \[ c0 \cdot {\color{blue}{\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)}}^{0.5}
\] |
inv-pow [=>]3.6 | \[ c0 \cdot {\color{blue}{\left({\left(\frac{V \cdot \ell}{A}\right)}^{-1}\right)}}^{0.5}
\] |
pow-pow [=>]3.9 | \[ c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}}
\] |
associate-/l* [=>]45.4 | \[ c0 \cdot {\color{blue}{\left(\frac{V}{\frac{A}{\ell}}\right)}}^{\left(-1 \cdot 0.5\right)}
\] |
metadata-eval [=>]45.4 | \[ c0 \cdot {\left(\frac{V}{\frac{A}{\ell}}\right)}^{\color{blue}{-0.5}}
\] |
Taylor expanded in V around -inf 52.3%
Simplified57.4%
[Start]52.3 | \[ c0 \cdot e^{-0.5 \cdot \left(\log \left(-1 \cdot \frac{\ell}{A}\right) + -1 \cdot \log \left(\frac{-1}{V}\right)\right)}
\] |
|---|---|
distribute-lft-in [=>]52.3 | \[ c0 \cdot e^{\color{blue}{-0.5 \cdot \log \left(-1 \cdot \frac{\ell}{A}\right) + -0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}}
\] |
exp-sum [=>]52.8 | \[ c0 \cdot \color{blue}{\left(e^{-0.5 \cdot \log \left(-1 \cdot \frac{\ell}{A}\right)} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right)}
\] |
*-commutative [<=]52.8 | \[ c0 \cdot \left(e^{\color{blue}{\log \left(-1 \cdot \frac{\ell}{A}\right) \cdot -0.5}} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right)
\] |
associate-*r/ [=>]52.8 | \[ c0 \cdot \left(e^{\log \color{blue}{\left(\frac{-1 \cdot \ell}{A}\right)} \cdot -0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right)
\] |
associate-/l* [=>]51.5 | \[ c0 \cdot \left(e^{\log \color{blue}{\left(\frac{-1}{\frac{A}{\ell}}\right)} \cdot -0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right)
\] |
metadata-eval [<=]51.5 | \[ c0 \cdot \left(e^{\log \left(\frac{\color{blue}{\frac{1}{-1}}}{\frac{A}{\ell}}\right) \cdot -0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right)
\] |
associate-/r* [<=]51.5 | \[ c0 \cdot \left(e^{\log \color{blue}{\left(\frac{1}{-1 \cdot \frac{A}{\ell}}\right)} \cdot -0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right)
\] |
neg-mul-1 [<=]51.5 | \[ c0 \cdot \left(e^{\log \left(\frac{1}{\color{blue}{-\frac{A}{\ell}}}\right) \cdot -0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right)
\] |
exp-to-pow [=>]51.7 | \[ c0 \cdot \left(\color{blue}{{\left(\frac{1}{-\frac{A}{\ell}}\right)}^{-0.5}} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right)
\] |
neg-mul-1 [=>]51.7 | \[ c0 \cdot \left({\left(\frac{1}{\color{blue}{-1 \cdot \frac{A}{\ell}}}\right)}^{-0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right)
\] |
associate-/r* [=>]51.7 | \[ c0 \cdot \left({\color{blue}{\left(\frac{\frac{1}{-1}}{\frac{A}{\ell}}\right)}}^{-0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right)
\] |
metadata-eval [=>]51.7 | \[ c0 \cdot \left({\left(\frac{\color{blue}{-1}}{\frac{A}{\ell}}\right)}^{-0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right)
\] |
associate-/l* [<=]53.0 | \[ c0 \cdot \left({\color{blue}{\left(\frac{-1 \cdot \ell}{A}\right)}}^{-0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right)
\] |
neg-mul-1 [<=]53.0 | \[ c0 \cdot \left({\left(\frac{\color{blue}{-\ell}}{A}\right)}^{-0.5} \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)}\right)
\] |
*-commutative [<=]53.0 | \[ c0 \cdot \left({\left(\frac{-\ell}{A}\right)}^{-0.5} \cdot e^{\color{blue}{\left(-1 \cdot \log \left(\frac{-1}{V}\right)\right) \cdot -0.5}}\right)
\] |
*-commutative [=>]53.0 | \[ c0 \cdot \left({\left(\frac{-\ell}{A}\right)}^{-0.5} \cdot e^{\color{blue}{\left(\log \left(\frac{-1}{V}\right) \cdot -1\right)} \cdot -0.5}\right)
\] |
associate-*l* [=>]53.0 | \[ c0 \cdot \left({\left(\frac{-\ell}{A}\right)}^{-0.5} \cdot e^{\color{blue}{\log \left(\frac{-1}{V}\right) \cdot \left(-1 \cdot -0.5\right)}}\right)
\] |
Applied egg-rr57.3%
[Start]57.4 | \[ c0 \cdot \left({\left(\frac{-\ell}{A}\right)}^{-0.5} \cdot {\left(\frac{-1}{V}\right)}^{0.5}\right)
\] |
|---|---|
unpow1/2 [=>]57.4 | \[ c0 \cdot \left({\left(\frac{-\ell}{A}\right)}^{-0.5} \cdot \color{blue}{\sqrt{\frac{-1}{V}}}\right)
\] |
frac-2neg [=>]57.4 | \[ c0 \cdot \left({\left(\frac{-\ell}{A}\right)}^{-0.5} \cdot \sqrt{\color{blue}{\frac{--1}{-V}}}\right)
\] |
metadata-eval [=>]57.4 | \[ c0 \cdot \left({\left(\frac{-\ell}{A}\right)}^{-0.5} \cdot \sqrt{\frac{\color{blue}{1}}{-V}}\right)
\] |
sqrt-div [=>]57.3 | \[ c0 \cdot \left({\left(\frac{-\ell}{A}\right)}^{-0.5} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{-V}}}\right)
\] |
metadata-eval [=>]57.3 | \[ c0 \cdot \left({\left(\frac{-\ell}{A}\right)}^{-0.5} \cdot \frac{\color{blue}{1}}{\sqrt{-V}}\right)
\] |
if 5.00000000000000014e-307 < (*.f64 V l) Initial program 76.3%
Applied egg-rr86.9%
[Start]76.3 | \[ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\] |
|---|---|
sqrt-div [=>]90.2 | \[ c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}}
\] |
associate-*r/ [=>]86.9 | \[ \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}}
\] |
Simplified90.2%
[Start]86.9 | \[ \frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}
\] |
|---|---|
*-commutative [<=]86.9 | \[ \frac{\color{blue}{\sqrt{A} \cdot c0}}{\sqrt{V \cdot \ell}}
\] |
associate-*l/ [<=]90.2 | \[ \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}} \cdot c0}
\] |
Final simplification90.4%
| Alternative 1 | |
|---|---|
| Accuracy | 76.5% |
| Cost | 34514 |
| Alternative 2 | |
|---|---|
| Accuracy | 90.2% |
| Cost | 20228 |
| Alternative 3 | |
|---|---|
| Accuracy | 90.3% |
| Cost | 20036 |
| Alternative 4 | |
|---|---|
| Accuracy | 86.3% |
| Cost | 14288 |
| Alternative 5 | |
|---|---|
| Accuracy | 90.4% |
| Cost | 14284 |
| Alternative 6 | |
|---|---|
| Accuracy | 90.3% |
| Cost | 14156 |
| Alternative 7 | |
|---|---|
| Accuracy | 90.5% |
| Cost | 14092 |
| Alternative 8 | |
|---|---|
| Accuracy | 86.2% |
| Cost | 14028 |
| Alternative 9 | |
|---|---|
| Accuracy | 86.3% |
| Cost | 14028 |
| Alternative 10 | |
|---|---|
| Accuracy | 86.5% |
| Cost | 14028 |
| Alternative 11 | |
|---|---|
| Accuracy | 82.3% |
| Cost | 14025 |
| Alternative 12 | |
|---|---|
| Accuracy | 77.2% |
| Cost | 7624 |
| Alternative 13 | |
|---|---|
| Accuracy | 77.8% |
| Cost | 7624 |
| Alternative 14 | |
|---|---|
| Accuracy | 77.7% |
| Cost | 7624 |
| Alternative 15 | |
|---|---|
| Accuracy | 77.7% |
| Cost | 7624 |
| Alternative 16 | |
|---|---|
| Accuracy | 70.4% |
| Cost | 6848 |
herbie shell --seed 2023136
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))