| Alternative 1 | |
|---|---|
| Error | 1.31% |
| Cost | 13120 |
\[\sqrt[3]{g} \cdot \sqrt[3]{\frac{0.5}{a}}
\]
(FPCore (g a) :precision binary64 (cbrt (/ g (* 2.0 a))))
(FPCore (g a) :precision binary64 (/ 1.0 (/ (cbrt a) (cbrt (* g 0.5)))))
double code(double g, double a) {
return cbrt((g / (2.0 * a)));
}
double code(double g, double a) {
return 1.0 / (cbrt(a) / cbrt((g * 0.5)));
}
public static double code(double g, double a) {
return Math.cbrt((g / (2.0 * a)));
}
public static double code(double g, double a) {
return 1.0 / (Math.cbrt(a) / Math.cbrt((g * 0.5)));
}
function code(g, a) return cbrt(Float64(g / Float64(2.0 * a))) end
function code(g, a) return Float64(1.0 / Float64(cbrt(a) / cbrt(Float64(g * 0.5)))) end
code[g_, a_] := N[Power[N[(g / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
code[g_, a_] := N[(1.0 / N[(N[Power[a, 1/3], $MachinePrecision] / N[Power[N[(g * 0.5), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\sqrt[3]{\frac{g}{2 \cdot a}}
\frac{1}{\frac{\sqrt[3]{a}}{\sqrt[3]{g \cdot 0.5}}}
Results
Initial program 24.65
Applied egg-rr24.58
Applied egg-rr1.35
Simplified1.32
[Start]1.35 | \[ \frac{1}{\sqrt[3]{a} \cdot \frac{1}{\sqrt[3]{g \cdot 0.5}}}
\] |
|---|---|
associate-*r/ [=>]1.32 | \[ \frac{1}{\color{blue}{\frac{\sqrt[3]{a} \cdot 1}{\sqrt[3]{g \cdot 0.5}}}}
\] |
associate-*l/ [<=]1.32 | \[ \frac{1}{\color{blue}{\frac{\sqrt[3]{a}}{\sqrt[3]{g \cdot 0.5}} \cdot 1}}
\] |
*-rgt-identity [=>]1.32 | \[ \frac{1}{\color{blue}{\frac{\sqrt[3]{a}}{\sqrt[3]{g \cdot 0.5}}}}
\] |
Final simplification1.32
| Alternative 1 | |
|---|---|
| Error | 1.31% |
| Cost | 13120 |
| Alternative 2 | |
|---|---|
| Error | 1.3% |
| Cost | 13120 |
| Alternative 3 | |
|---|---|
| Error | 24.59% |
| Cost | 6848 |
| Alternative 4 | |
|---|---|
| Error | 24.58% |
| Cost | 6848 |
| Alternative 5 | |
|---|---|
| Error | 24.65% |
| Cost | 6720 |
herbie shell --seed 2023101
(FPCore (g a)
:name "2-ancestry mixing, zero discriminant"
:precision binary64
(cbrt (/ g (* 2.0 a))))