2-ancestry mixing, zero discriminant

Percentage Accurate: 76.5% → 98.7%
Time: 8.4s
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]{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 74.3%

    \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
  2. Step-by-step derivation
    1. cbrt-lowering-cbrt.f64N/A

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

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

      \[\leadsto \mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{g}{a}\right), 2\right)\right) \]
    4. /-lowering-/.f6474.3%

      \[\leadsto \mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(g, a\right), 2\right)\right) \]
  3. Simplified74.3%

    \[\leadsto \color{blue}{\sqrt[3]{\frac{\frac{g}{a}}{2}}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-/l/N/A

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \left(\sqrt[3]{\color{blue}{2 \cdot a}}\right)\right) \]
    7. metadata-evalN/A

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \mathsf{cbrt.f64}\left(\left(2 \cdot a\right)\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \mathsf{cbrt.f64}\left(\left(a \cdot 2\right)\right)\right) \]
    13. metadata-evalN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(a, \left(\frac{1}{2}\right)\right)\right)\right) \]
    17. metadata-eval98.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) \]
  6. Applied egg-rr98.8%

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

Alternative 2: 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 74.3%

    \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
  2. Step-by-step derivation
    1. cbrt-lowering-cbrt.f64N/A

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

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

      \[\leadsto \mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{g}{a}\right), 2\right)\right) \]
    4. /-lowering-/.f6474.3%

      \[\leadsto \mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(g, a\right), 2\right)\right) \]
  3. Simplified74.3%

    \[\leadsto \color{blue}{\sqrt[3]{\frac{\frac{g}{a}}{2}}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-/l/N/A

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \left(\sqrt[3]{\color{blue}{2 \cdot a}}\right)\right) \]
    7. metadata-evalN/A

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \mathsf{cbrt.f64}\left(\left(2 \cdot a\right)\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \mathsf{cbrt.f64}\left(\left(a \cdot 2\right)\right)\right) \]
    13. metadata-evalN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(a, \left(\frac{1}{2}\right)\right)\right)\right) \]
    17. metadata-eval98.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) \]
  6. Applied egg-rr98.8%

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

      \[\leadsto \sqrt[3]{\frac{g}{\frac{a}{\frac{1}{2}}}} \]
    2. associate-/r/N/A

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\sqrt[3]{g \cdot 0.5}}{\sqrt[3]{a}}} \]
  9. Step-by-step derivation
    1. metadata-evalN/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(\left(\frac{g}{2}\right)\right), \mathsf{cbrt.f64}\left(a\right)\right) \]
    3. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{\sqrt[3]{a}}}{\frac{\sqrt[3]{2}}{\color{blue}{\sqrt[3]{g}}}} \]
    6. associate-/r/N/A

      \[\leadsto \frac{\frac{1}{\sqrt[3]{a}}}{\sqrt[3]{2}} \cdot \color{blue}{\sqrt[3]{g}} \]
    7. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(\frac{1}{2}, a\right)\right), \left(\sqrt[3]{g}\right)\right) \]
    22. cbrt-lowering-cbrt.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) \]
  12. Applied egg-rr98.7%

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

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

Alternative 3: 76.2% accurate, 1.0× speedup?

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

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

    \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
  2. Step-by-step derivation
    1. cbrt-lowering-cbrt.f64N/A

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

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

      \[\leadsto \mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{g}{a}\right), 2\right)\right) \]
    4. /-lowering-/.f6474.3%

      \[\leadsto \mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(g, a\right), 2\right)\right) \]
  3. Simplified74.3%

    \[\leadsto \color{blue}{\sqrt[3]{\frac{\frac{g}{a}}{2}}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-/l/N/A

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \left(\sqrt[3]{\color{blue}{2 \cdot a}}\right)\right) \]
    7. metadata-evalN/A

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \mathsf{cbrt.f64}\left(\left(2 \cdot a\right)\right)\right) \]
    12. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \mathsf{cbrt.f64}\left(\left(a \cdot 2\right)\right)\right) \]
    13. metadata-evalN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cbrt.f64}\left(g\right), \mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(a, \left(\frac{1}{2}\right)\right)\right)\right) \]
    17. metadata-eval98.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) \]
  6. Applied egg-rr98.8%

    \[\leadsto \color{blue}{\frac{\sqrt[3]{g}}{\sqrt[3]{\frac{a}{0.5}}}} \]
  7. Step-by-step derivation
    1. clear-numN/A

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \left(\sqrt[3]{\frac{\frac{a}{\frac{1}{2}}}{g}}\right)\right) \]
    4. *-lft-identityN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \left(\sqrt[3]{\frac{2}{a} \cdot \left(\mathsf{neg}\left(\frac{\mathsf{neg}\left(a\right)}{\frac{g}{a}}\right)\right)}\right)\right) \]
    16. sub0-negN/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{cbrt.f64}\left(\left(\frac{2}{a} \cdot \left(\mathsf{neg}\left(\frac{0 - a}{\frac{g}{a}}\right)\right)\right)\right)\right) \]
    20. sub0-negN/A

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

    \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{\frac{\frac{a}{0.5}}{g}}}} \]
  9. 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 74.3%

    \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
  2. Step-by-step derivation
    1. cbrt-lowering-cbrt.f64N/A

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

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

      \[\leadsto \mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(\left(\frac{g}{a}\right), 2\right)\right) \]
    4. /-lowering-/.f6474.3%

      \[\leadsto \mathsf{cbrt.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(g, a\right), 2\right)\right) \]
  3. Simplified74.3%

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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