2-ancestry mixing, zero discriminant

Percentage Accurate: 76.5% → 98.7%
Time: 8.2s
Alternatives: 4
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \sqrt[3]{\frac{g}{2 \cdot a}} \end{array} \]
(FPCore (g a) :precision binary64 (cbrt (/ g (* 2.0 a))))
double code(double g, double a) {
	return cbrt((g / (2.0 * a)));
}
public static double code(double g, double a) {
	return Math.cbrt((g / (2.0 * a)));
}
function code(g, a)
	return cbrt(Float64(g / Float64(2.0 * a)))
end
code[g_, a_] := N[Power[N[(g / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}

\\
\sqrt[3]{\frac{g}{2 \cdot a}}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 4 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 76.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sqrt[3]{\frac{g}{2 \cdot a}} \end{array} \]
(FPCore (g a) :precision binary64 (cbrt (/ g (* 2.0 a))))
double code(double g, double a) {
	return cbrt((g / (2.0 * a)));
}
public static double code(double g, double a) {
	return Math.cbrt((g / (2.0 * a)));
}
function code(g, a)
	return cbrt(Float64(g / Float64(2.0 * a)))
end
code[g_, a_] := N[Power[N[(g / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}

\\
\sqrt[3]{\frac{g}{2 \cdot a}}
\end{array}

Alternative 1: 98.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \frac{\sqrt[3]{\frac{g}{2}}}{\sqrt[3]{a}} \end{array} \]
(FPCore (g a) :precision binary64 (/ (cbrt (/ g 2.0)) (cbrt a)))
double code(double g, double a) {
	return cbrt((g / 2.0)) / cbrt(a);
}
public static double code(double g, double a) {
	return Math.cbrt((g / 2.0)) / Math.cbrt(a);
}
function code(g, a)
	return Float64(cbrt(Float64(g / 2.0)) / cbrt(a))
end
code[g_, a_] := N[(N[Power[N[(g / 2.0), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sqrt[3]{\frac{g}{2}}}{\sqrt[3]{a}}
\end{array}
Derivation
  1. Initial program 77.5%

    \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. div-invN/A

      \[\leadsto \sqrt[3]{g \cdot \frac{1}{2 \cdot a}} \]
    2. cbrt-prodN/A

      \[\leadsto \sqrt[3]{g} \cdot \color{blue}{\sqrt[3]{\frac{1}{2 \cdot a}}} \]
    3. pow1/3N/A

      \[\leadsto \sqrt[3]{g} \cdot {\left(\frac{1}{2 \cdot a}\right)}^{\color{blue}{\frac{1}{3}}} \]
    4. *-commutativeN/A

      \[\leadsto {\left(\frac{1}{2 \cdot a}\right)}^{\frac{1}{3}} \cdot \color{blue}{\sqrt[3]{g}} \]
    5. inv-powN/A

      \[\leadsto {\left({\left(2 \cdot a\right)}^{-1}\right)}^{\frac{1}{3}} \cdot \sqrt[3]{g} \]
    6. pow-powN/A

      \[\leadsto {\left(2 \cdot a\right)}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot \sqrt[3]{\color{blue}{g}} \]
    7. unpow-prod-downN/A

      \[\leadsto \left({2}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot {a}^{\left(-1 \cdot \frac{1}{3}\right)}\right) \cdot \sqrt[3]{\color{blue}{g}} \]
    8. metadata-evalN/A

      \[\leadsto \left({2}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot {a}^{\frac{-1}{3}}\right) \cdot \sqrt[3]{g} \]
    9. metadata-evalN/A

      \[\leadsto \left({2}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot {a}^{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)}\right) \cdot \sqrt[3]{g} \]
    10. pow-flipN/A

      \[\leadsto \left({2}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot \frac{1}{{a}^{\frac{1}{3}}}\right) \cdot \sqrt[3]{g} \]
    11. pow1/3N/A

      \[\leadsto \left({2}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot \frac{1}{\sqrt[3]{a}}\right) \cdot \sqrt[3]{g} \]
    12. div-invN/A

      \[\leadsto \frac{{2}^{\left(-1 \cdot \frac{1}{3}\right)}}{\sqrt[3]{a}} \cdot \sqrt[3]{\color{blue}{g}} \]
    13. associate-*l/N/A

      \[\leadsto \frac{{2}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot \sqrt[3]{g}}{\color{blue}{\sqrt[3]{a}}} \]
    14. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left({2}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot \sqrt[3]{g}\right), \color{blue}{\left(\sqrt[3]{a}\right)}\right) \]
    15. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({2}^{\left(-1 \cdot \frac{1}{3}\right)}\right), \left(\sqrt[3]{g}\right)\right), \left(\sqrt[3]{\color{blue}{a}}\right)\right) \]
    16. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{pow.f64}\left(2, \left(-1 \cdot \frac{1}{3}\right)\right), \left(\sqrt[3]{g}\right)\right), \left(\sqrt[3]{a}\right)\right) \]
    17. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{pow.f64}\left(2, \frac{-1}{3}\right), \left(\sqrt[3]{g}\right)\right), \left(\sqrt[3]{a}\right)\right) \]
    18. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{pow.f64}\left(2, \frac{-1}{3}\right), \mathsf{cbrt.f64}\left(g\right)\right), \left(\sqrt[3]{a}\right)\right) \]
    19. cbrt-lowering-cbrt.f6498.6%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{pow.f64}\left(2, \frac{-1}{3}\right), \mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
  4. Applied egg-rr98.6%

    \[\leadsto \color{blue}{\frac{{2}^{-0.3333333333333333} \cdot \sqrt[3]{g}}{\sqrt[3]{a}}} \]
  5. Step-by-step derivation
    1. sqr-powN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({2}^{\left(\frac{\frac{-1}{3}}{2}\right)} \cdot {2}^{\left(\frac{\frac{-1}{3}}{2}\right)}\right), \mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    2. pow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({\left({2}^{\left(\frac{\frac{-1}{3}}{2}\right)}\right)}^{2}\right), \mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    3. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left({2}^{\left(\frac{\frac{-1}{3}}{2}\right)}\right), 2\right), \mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    4. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{pow.f64}\left(2, \left(\frac{\frac{-1}{3}}{2}\right)\right), 2\right), \mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    5. metadata-eval98.7%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{pow.f64}\left(2, \frac{-1}{6}\right), 2\right), \mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
  6. Applied egg-rr98.7%

    \[\leadsto \frac{\color{blue}{{\left({2}^{-0.16666666666666666}\right)}^{2}} \cdot \sqrt[3]{g}}{\sqrt[3]{a}} \]
  7. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot {\left({2}^{\frac{-1}{6}}\right)}^{2}\right), \mathsf{cbrt.f64}\left(\color{blue}{a}\right)\right) \]
    2. pow-powN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot {2}^{\left(\frac{-1}{6} \cdot 2\right)}\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    3. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot {2}^{\frac{-1}{3}}\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot {2}^{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)}\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    5. pow-flipN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot \frac{1}{{2}^{\frac{1}{3}}}\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    6. pow1/3N/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot \frac{1}{\sqrt[3]{2}}\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    7. div-invN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{\sqrt[3]{g}}{\sqrt[3]{2}}\right), \mathsf{cbrt.f64}\left(\color{blue}{a}\right)\right) \]
    8. cbrt-divN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{\frac{g}{2}}\right), \mathsf{cbrt.f64}\left(\color{blue}{a}\right)\right) \]
    9. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{g}{2}\right)\right), \mathsf{cbrt.f64}\left(\color{blue}{a}\right)\right) \]
    10. /-lowering-/.f6498.8%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, 2\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
  8. Applied egg-rr98.8%

    \[\leadsto \frac{\color{blue}{\sqrt[3]{\frac{g}{2}}}}{\sqrt[3]{a}} \]
  9. Add Preprocessing

Alternative 2: 98.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \frac{\sqrt[3]{g}}{\sqrt[3]{\frac{a}{0.5}}} \end{array} \]
(FPCore (g a) :precision binary64 (/ (cbrt g) (cbrt (/ a 0.5))))
double code(double g, double a) {
	return cbrt(g) / cbrt((a / 0.5));
}
public static double code(double g, double a) {
	return Math.cbrt(g) / Math.cbrt((a / 0.5));
}
function code(g, a)
	return Float64(cbrt(g) / cbrt(Float64(a / 0.5)))
end
code[g_, a_] := N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[N[(a / 0.5), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sqrt[3]{g}}{\sqrt[3]{\frac{a}{0.5}}}
\end{array}
Derivation
  1. Initial program 77.5%

    \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. div-invN/A

      \[\leadsto \sqrt[3]{g \cdot \frac{1}{2 \cdot a}} \]
    2. cbrt-prodN/A

      \[\leadsto \sqrt[3]{g} \cdot \color{blue}{\sqrt[3]{\frac{1}{2 \cdot a}}} \]
    3. pow1/3N/A

      \[\leadsto \sqrt[3]{g} \cdot {\left(\frac{1}{2 \cdot a}\right)}^{\color{blue}{\frac{1}{3}}} \]
    4. *-commutativeN/A

      \[\leadsto {\left(\frac{1}{2 \cdot a}\right)}^{\frac{1}{3}} \cdot \color{blue}{\sqrt[3]{g}} \]
    5. inv-powN/A

      \[\leadsto {\left({\left(2 \cdot a\right)}^{-1}\right)}^{\frac{1}{3}} \cdot \sqrt[3]{g} \]
    6. pow-powN/A

      \[\leadsto {\left(2 \cdot a\right)}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot \sqrt[3]{\color{blue}{g}} \]
    7. unpow-prod-downN/A

      \[\leadsto \left({2}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot {a}^{\left(-1 \cdot \frac{1}{3}\right)}\right) \cdot \sqrt[3]{\color{blue}{g}} \]
    8. metadata-evalN/A

      \[\leadsto \left({2}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot {a}^{\frac{-1}{3}}\right) \cdot \sqrt[3]{g} \]
    9. metadata-evalN/A

      \[\leadsto \left({2}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot {a}^{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)}\right) \cdot \sqrt[3]{g} \]
    10. pow-flipN/A

      \[\leadsto \left({2}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot \frac{1}{{a}^{\frac{1}{3}}}\right) \cdot \sqrt[3]{g} \]
    11. pow1/3N/A

      \[\leadsto \left({2}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot \frac{1}{\sqrt[3]{a}}\right) \cdot \sqrt[3]{g} \]
    12. div-invN/A

      \[\leadsto \frac{{2}^{\left(-1 \cdot \frac{1}{3}\right)}}{\sqrt[3]{a}} \cdot \sqrt[3]{\color{blue}{g}} \]
    13. associate-*l/N/A

      \[\leadsto \frac{{2}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot \sqrt[3]{g}}{\color{blue}{\sqrt[3]{a}}} \]
    14. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left({2}^{\left(-1 \cdot \frac{1}{3}\right)} \cdot \sqrt[3]{g}\right), \color{blue}{\left(\sqrt[3]{a}\right)}\right) \]
    15. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({2}^{\left(-1 \cdot \frac{1}{3}\right)}\right), \left(\sqrt[3]{g}\right)\right), \left(\sqrt[3]{\color{blue}{a}}\right)\right) \]
    16. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{pow.f64}\left(2, \left(-1 \cdot \frac{1}{3}\right)\right), \left(\sqrt[3]{g}\right)\right), \left(\sqrt[3]{a}\right)\right) \]
    17. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{pow.f64}\left(2, \frac{-1}{3}\right), \left(\sqrt[3]{g}\right)\right), \left(\sqrt[3]{a}\right)\right) \]
    18. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{pow.f64}\left(2, \frac{-1}{3}\right), \mathsf{cbrt.f64}\left(g\right)\right), \left(\sqrt[3]{a}\right)\right) \]
    19. cbrt-lowering-cbrt.f6498.6%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{pow.f64}\left(2, \frac{-1}{3}\right), \mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
  4. Applied egg-rr98.6%

    \[\leadsto \color{blue}{\frac{{2}^{-0.3333333333333333} \cdot \sqrt[3]{g}}{\sqrt[3]{a}}} \]
  5. Step-by-step derivation
    1. sqr-powN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({2}^{\left(\frac{\frac{-1}{3}}{2}\right)} \cdot {2}^{\left(\frac{\frac{-1}{3}}{2}\right)}\right), \mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    2. pow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({\left({2}^{\left(\frac{\frac{-1}{3}}{2}\right)}\right)}^{2}\right), \mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    3. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left({2}^{\left(\frac{\frac{-1}{3}}{2}\right)}\right), 2\right), \mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    4. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{pow.f64}\left(2, \left(\frac{\frac{-1}{3}}{2}\right)\right), 2\right), \mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    5. metadata-eval98.7%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{pow.f64}\left(2, \frac{-1}{6}\right), 2\right), \mathsf{cbrt.f64}\left(g\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
  6. Applied egg-rr98.7%

    \[\leadsto \frac{\color{blue}{{\left({2}^{-0.16666666666666666}\right)}^{2}} \cdot \sqrt[3]{g}}{\sqrt[3]{a}} \]
  7. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot {\left({2}^{\frac{-1}{6}}\right)}^{2}\right), \mathsf{cbrt.f64}\left(\color{blue}{a}\right)\right) \]
    2. pow-powN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot {2}^{\left(\frac{-1}{6} \cdot 2\right)}\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    3. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot {2}^{\frac{-1}{3}}\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot {2}^{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)}\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    5. pow-flipN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot \frac{1}{{2}^{\frac{1}{3}}}\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    6. pow1/3N/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{g} \cdot \frac{1}{\sqrt[3]{2}}\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    7. div-invN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{\sqrt[3]{g}}{\sqrt[3]{2}}\right), \mathsf{cbrt.f64}\left(\color{blue}{a}\right)\right) \]
    8. cbrt-divN/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{\frac{g}{2}}\right), \mathsf{cbrt.f64}\left(\color{blue}{a}\right)\right) \]
    9. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{g}{2}\right)\right), \mathsf{cbrt.f64}\left(\color{blue}{a}\right)\right) \]
    10. /-lowering-/.f6498.8%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(g, 2\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
  8. Applied egg-rr98.8%

    \[\leadsto \frac{\color{blue}{\sqrt[3]{\frac{g}{2}}}}{\sqrt[3]{a}} \]
  9. Step-by-step derivation
    1. cbrt-undivN/A

      \[\leadsto \sqrt[3]{\frac{\frac{g}{2}}{a}} \]
    2. div-invN/A

      \[\leadsto \sqrt[3]{\frac{g \cdot \frac{1}{2}}{a}} \]
    3. metadata-evalN/A

      \[\leadsto \sqrt[3]{\frac{g \cdot \frac{1}{2}}{a}} \]
    4. associate-/l*N/A

      \[\leadsto \sqrt[3]{g \cdot \frac{\frac{1}{2}}{a}} \]
    5. cbrt-unprodN/A

      \[\leadsto \sqrt[3]{g} \cdot \color{blue}{\sqrt[3]{\frac{\frac{1}{2}}{a}}} \]
    6. cbrt-undivN/A

      \[\leadsto \sqrt[3]{g} \cdot \frac{\sqrt[3]{\frac{1}{2}}}{\color{blue}{\sqrt[3]{a}}} \]
    7. clear-numN/A

      \[\leadsto \sqrt[3]{g} \cdot \frac{1}{\color{blue}{\frac{\sqrt[3]{a}}{\sqrt[3]{\frac{1}{2}}}}} \]
    8. un-div-invN/A

      \[\leadsto \frac{\sqrt[3]{g}}{\color{blue}{\frac{\sqrt[3]{a}}{\sqrt[3]{\frac{1}{2}}}}} \]
    9. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left(\sqrt[3]{g}\right), \color{blue}{\left(\frac{\sqrt[3]{a}}{\sqrt[3]{\frac{1}{2}}}\right)}\right) \]
    10. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \left(\frac{\color{blue}{\sqrt[3]{a}}}{\sqrt[3]{\frac{1}{2}}}\right)\right) \]
    11. cbrt-undivN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \left(\sqrt[3]{\frac{a}{\frac{1}{2}}}\right)\right) \]
    12. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \left(\sqrt[3]{\frac{a}{\mathsf{neg}\left(\frac{-1}{2}\right)}}\right)\right) \]
    13. distribute-neg-frac2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \left(\sqrt[3]{\mathsf{neg}\left(\frac{a}{\frac{-1}{2}}\right)}\right)\right) \]
    14. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \mathsf{cbrt.f64}\left(\left(\mathsf{neg}\left(\frac{a}{\frac{-1}{2}}\right)\right)\right)\right) \]
    15. distribute-neg-frac2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \mathsf{cbrt.f64}\left(\left(\frac{a}{\mathsf{neg}\left(\frac{-1}{2}\right)}\right)\right)\right) \]
    16. metadata-evalN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \mathsf{cbrt.f64}\left(\left(\frac{a}{\frac{1}{2}}\right)\right)\right) \]
    17. /-lowering-/.f6498.8%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(a, \frac{1}{2}\right)\right)\right) \]
  10. Applied egg-rr98.8%

    \[\leadsto \color{blue}{\frac{\sqrt[3]{g}}{\sqrt[3]{\frac{a}{0.5}}}} \]
  11. Add Preprocessing

Alternative 3: 98.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \sqrt[3]{g} \cdot \sqrt[3]{\frac{0.5}{a}} \end{array} \]
(FPCore (g a) :precision binary64 (* (cbrt g) (cbrt (/ 0.5 a))))
double code(double g, double a) {
	return cbrt(g) * cbrt((0.5 / a));
}
public static double code(double g, double a) {
	return Math.cbrt(g) * Math.cbrt((0.5 / a));
}
function code(g, a)
	return Float64(cbrt(g) * cbrt(Float64(0.5 / a)))
end
code[g_, a_] := N[(N[Power[g, 1/3], $MachinePrecision] * N[Power[N[(0.5 / a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt[3]{g} \cdot \sqrt[3]{\frac{0.5}{a}}
\end{array}
Derivation
  1. Initial program 77.5%

    \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. div-invN/A

      \[\leadsto \sqrt[3]{g \cdot \frac{1}{2 \cdot a}} \]
    2. cbrt-prodN/A

      \[\leadsto \sqrt[3]{g} \cdot \color{blue}{\sqrt[3]{\frac{1}{2 \cdot a}}} \]
    3. pow1/3N/A

      \[\leadsto \sqrt[3]{g} \cdot {\left(\frac{1}{2 \cdot a}\right)}^{\color{blue}{\frac{1}{3}}} \]
    4. *-commutativeN/A

      \[\leadsto {\left(\frac{1}{2 \cdot a}\right)}^{\frac{1}{3}} \cdot \color{blue}{\sqrt[3]{g}} \]
    5. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left({\left(\frac{1}{2 \cdot a}\right)}^{\frac{1}{3}}\right), \color{blue}{\left(\sqrt[3]{g}\right)}\right) \]
    6. inv-powN/A

      \[\leadsto \mathsf{*.f64}\left(\left({\left({\left(2 \cdot a\right)}^{-1}\right)}^{\frac{1}{3}}\right), \left(\sqrt[3]{g}\right)\right) \]
    7. pow-powN/A

      \[\leadsto \mathsf{*.f64}\left(\left({\left(2 \cdot a\right)}^{\left(-1 \cdot \frac{1}{3}\right)}\right), \left(\sqrt[3]{\color{blue}{g}}\right)\right) \]
    8. pow-lowering-pow.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left(2 \cdot a\right), \left(-1 \cdot \frac{1}{3}\right)\right), \left(\sqrt[3]{\color{blue}{g}}\right)\right) \]
    9. remove-double-divN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left(\frac{1}{\frac{1}{2 \cdot a}}\right), \left(-1 \cdot \frac{1}{3}\right)\right), \left(\sqrt[3]{g}\right)\right) \]
    10. associate-/r*N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left(\frac{1}{\frac{\frac{1}{2}}{a}}\right), \left(-1 \cdot \frac{1}{3}\right)\right), \left(\sqrt[3]{g}\right)\right) \]
    11. clear-numN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\left(\frac{a}{\frac{1}{2}}\right), \left(-1 \cdot \frac{1}{3}\right)\right), \left(\sqrt[3]{g}\right)\right) \]
    12. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(a, \left(\frac{1}{2}\right)\right), \left(-1 \cdot \frac{1}{3}\right)\right), \left(\sqrt[3]{g}\right)\right) \]
    13. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(a, \frac{1}{2}\right), \left(-1 \cdot \frac{1}{3}\right)\right), \left(\sqrt[3]{g}\right)\right) \]
    14. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(a, \frac{1}{2}\right), \frac{-1}{3}\right), \left(\sqrt[3]{g}\right)\right) \]
    15. cbrt-lowering-cbrt.f6447.4%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{pow.f64}\left(\mathsf{/.f64}\left(a, \frac{1}{2}\right), \frac{-1}{3}\right), \mathsf{cbrt.f64}\left(g\right)\right) \]
  4. Applied egg-rr47.4%

    \[\leadsto \color{blue}{{\left(\frac{a}{0.5}\right)}^{-0.3333333333333333} \cdot \sqrt[3]{g}} \]
  5. Step-by-step derivation
    1. clear-numN/A

      \[\leadsto \mathsf{*.f64}\left(\left({\left(\frac{1}{\frac{\frac{1}{2}}{a}}\right)}^{\frac{-1}{3}}\right), \mathsf{cbrt.f64}\left(g\right)\right) \]
    2. inv-powN/A

      \[\leadsto \mathsf{*.f64}\left(\left({\left({\left(\frac{\frac{1}{2}}{a}\right)}^{-1}\right)}^{\frac{-1}{3}}\right), \mathsf{cbrt.f64}\left(g\right)\right) \]
    3. pow-powN/A

      \[\leadsto \mathsf{*.f64}\left(\left({\left(\frac{\frac{1}{2}}{a}\right)}^{\left(-1 \cdot \frac{-1}{3}\right)}\right), \mathsf{cbrt.f64}\left(\color{blue}{g}\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\left({\left(\frac{\frac{1}{2}}{a}\right)}^{\frac{1}{3}}\right), \mathsf{cbrt.f64}\left(g\right)\right) \]
    5. pow1/3N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\sqrt[3]{\frac{\frac{1}{2}}{a}}\right), \mathsf{cbrt.f64}\left(\color{blue}{g}\right)\right) \]
    6. cbrt-lowering-cbrt.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{\frac{1}{2}}{a}\right)\right), \mathsf{cbrt.f64}\left(\color{blue}{g}\right)\right) \]
    7. /-lowering-/.f6498.7%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right)\right), \mathsf{cbrt.f64}\left(g\right)\right) \]
  6. Applied egg-rr98.7%

    \[\leadsto \color{blue}{\sqrt[3]{\frac{0.5}{a}}} \cdot \sqrt[3]{g} \]
  7. Final simplification98.7%

    \[\leadsto \sqrt[3]{g} \cdot \sqrt[3]{\frac{0.5}{a}} \]
  8. Add Preprocessing

Alternative 4: 76.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sqrt[3]{g \cdot \frac{0.5}{a}} \end{array} \]
(FPCore (g a) :precision binary64 (cbrt (* g (/ 0.5 a))))
double code(double g, double a) {
	return cbrt((g * (0.5 / a)));
}
public static double code(double g, double a) {
	return Math.cbrt((g * (0.5 / a)));
}
function code(g, a)
	return cbrt(Float64(g * Float64(0.5 / a)))
end
code[g_, a_] := N[Power[N[(g * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}

\\
\sqrt[3]{g \cdot \frac{0.5}{a}}
\end{array}
Derivation
  1. Initial program 77.5%

    \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. clear-numN/A

      \[\leadsto \mathsf{cbrt.f64}\left(\left(\frac{1}{\frac{2 \cdot a}{g}}\right)\right) \]
    2. associate-/r/N/A

      \[\leadsto \mathsf{cbrt.f64}\left(\left(\frac{1}{2 \cdot a} \cdot g\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{cbrt.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{2 \cdot a}\right), g\right)\right) \]
    4. associate-/r*N/A

      \[\leadsto \mathsf{cbrt.f64}\left(\mathsf{*.f64}\left(\left(\frac{\frac{1}{2}}{a}\right), g\right)\right) \]
    5. /-lowering-/.f64N/A

      \[\leadsto \mathsf{cbrt.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2}\right), a\right), g\right)\right) \]
    6. metadata-eval77.5%

      \[\leadsto \mathsf{cbrt.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right), g\right)\right) \]
  4. Applied egg-rr77.5%

    \[\leadsto \sqrt[3]{\color{blue}{\frac{0.5}{a} \cdot g}} \]
  5. Final simplification77.5%

    \[\leadsto \sqrt[3]{g \cdot \frac{0.5}{a}} \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2024163 
(FPCore (g a)
  :name "2-ancestry mixing, zero discriminant"
  :precision binary64
  (cbrt (/ g (* 2.0 a))))