| 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 (/ (cbrt g) (cbrt (* a 2.0))))
double code(double g, double a) {
return cbrt((g / (2.0 * a)));
}
double code(double g, double a) {
return cbrt(g) / cbrt((a * 2.0));
}
public static double code(double g, double a) {
return Math.cbrt((g / (2.0 * a)));
}
public static double code(double g, double a) {
return Math.cbrt(g) / Math.cbrt((a * 2.0));
}
function code(g, a) return cbrt(Float64(g / Float64(2.0 * a))) end
function code(g, a) return Float64(cbrt(g) / cbrt(Float64(a * 2.0))) end
code[g_, a_] := N[Power[N[(g / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
code[g_, a_] := N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[N[(a * 2.0), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\sqrt[3]{\frac{g}{2 \cdot a}}
\frac{\sqrt[3]{g}}{\sqrt[3]{a \cdot 2}}
Results
Initial program 24.54
Applied egg-rr1.35
Simplified1.31
[Start]1.35 | \[ \sqrt[3]{g} \cdot \frac{1}{\sqrt[3]{2 \cdot a}}
\] |
|---|---|
associate-*r/ [=>]1.31 | \[ \color{blue}{\frac{\sqrt[3]{g} \cdot 1}{\sqrt[3]{2 \cdot a}}}
\] |
*-rgt-identity [=>]1.31 | \[ \frac{\color{blue}{\sqrt[3]{g}}}{\sqrt[3]{2 \cdot a}}
\] |
*-commutative [=>]1.31 | \[ \frac{\sqrt[3]{g}}{\sqrt[3]{\color{blue}{a \cdot 2}}}
\] |
Final simplification1.31
| Alternative 1 | |
|---|---|
| Error | 1.31% |
| Cost | 13120 |
| Alternative 2 | |
|---|---|
| Error | 24.53% |
| Cost | 6720 |
| Alternative 3 | |
|---|---|
| Error | 24.54% |
| Cost | 6720 |
herbie shell --seed 2023093
(FPCore (g a)
:name "2-ancestry mixing, zero discriminant"
:precision binary64
(cbrt (/ g (* 2.0 a))))