2-ancestry mixing, zero discriminant

Percentage Accurate: 76.7% → 98.7%
Time: 7.5s
Alternatives: 8
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 8 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.7% 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} \\ \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 75.0%

    \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/r*N/A

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt[3]{g \cdot \color{blue}{\frac{1}{2}}}}{\sqrt[3]{a}} \]
    8. cbrt-lowering-cbrt.f6498.7

      \[\leadsto \frac{\sqrt[3]{g \cdot 0.5}}{\color{blue}{\sqrt[3]{a}}} \]
  4. Applied egg-rr98.7%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt[3]{\color{blue}{\frac{\frac{1}{a}}{\mathsf{neg}\left(2\right)} \cdot \left(\mathsf{neg}\left(g\right)\right)}} \]
    12. cbrt-prodN/A

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

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

      \[\leadsto \color{blue}{\sqrt[3]{\frac{\frac{1}{a}}{\mathsf{neg}\left(2\right)}} \cdot {\left(\mathsf{neg}\left(g\right)\right)}^{\frac{1}{3}}} \]
  6. Applied egg-rr98.8%

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

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

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

      \[\leadsto \sqrt[3]{\color{blue}{\frac{1}{2} \cdot \frac{1}{\mathsf{neg}\left(a\right)}}} \cdot \sqrt[3]{\mathsf{neg}\left(g\right)} \]
    4. cbrt-prodN/A

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\sqrt[3]{\frac{1}{2}}} \cdot \sqrt[3]{\mathsf{neg}\left(\frac{1}{a}\right)}\right) \cdot \sqrt[3]{\mathsf{neg}\left(g\right)} \]
    10. distribute-frac-neg2N/A

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

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

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

      \[\leadsto \left(\sqrt[3]{\frac{1}{2}} \cdot \sqrt[3]{\color{blue}{\frac{-1}{a}}}\right) \cdot \sqrt[3]{\mathsf{neg}\left(g\right)} \]
    14. /-lowering-/.f6498.7

      \[\leadsto \left(\sqrt[3]{0.5} \cdot \sqrt[3]{\color{blue}{\frac{-1}{a}}}\right) \cdot \sqrt[3]{-g} \]
  8. Applied egg-rr98.7%

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

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

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

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

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

      \[\leadsto \sqrt[3]{\color{blue}{\frac{1}{\frac{a}{\frac{-1}{2}}}}} \cdot \sqrt[3]{\mathsf{neg}\left(g\right)} \]
    6. cbrt-divN/A

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

      \[\leadsto \frac{\color{blue}{1}}{\sqrt[3]{\frac{a}{\frac{-1}{2}}}} \cdot \sqrt[3]{\mathsf{neg}\left(g\right)} \]
    8. div-invN/A

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

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

      \[\leadsto \frac{1}{\sqrt[3]{a \cdot \color{blue}{\left(\mathsf{neg}\left(2\right)\right)}}} \cdot \sqrt[3]{\mathsf{neg}\left(g\right)} \]
    11. distribute-rgt-neg-inN/A

      \[\leadsto \frac{1}{\sqrt[3]{\color{blue}{\mathsf{neg}\left(a \cdot 2\right)}}} \cdot \sqrt[3]{\mathsf{neg}\left(g\right)} \]
    12. associate-/r/N/A

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

      \[\leadsto \frac{\color{blue}{\sqrt[3]{1}}}{\frac{\sqrt[3]{\mathsf{neg}\left(a \cdot 2\right)}}{\sqrt[3]{\mathsf{neg}\left(g\right)}}} \]
    14. cbrt-divN/A

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt[3]{g}} \cdot \sqrt[3]{\frac{1}{a \cdot 2}} \]
  10. Applied egg-rr98.8%

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

Alternative 2: 91.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot 2 \leq -2 \cdot 10^{-304}:\\ \;\;\;\;{\left(-a\right)}^{-0.3333333333333333} \cdot \sqrt[3]{g \cdot -0.5}\\ \mathbf{else}:\\ \;\;\;\;{a}^{-0.3333333333333333} \cdot \sqrt[3]{g \cdot 0.5}\\ \end{array} \end{array} \]
(FPCore (g a)
 :precision binary64
 (if (<= (* a 2.0) -2e-304)
   (* (pow (- a) -0.3333333333333333) (cbrt (* g -0.5)))
   (* (pow a -0.3333333333333333) (cbrt (* g 0.5)))))
double code(double g, double a) {
	double tmp;
	if ((a * 2.0) <= -2e-304) {
		tmp = pow(-a, -0.3333333333333333) * cbrt((g * -0.5));
	} else {
		tmp = pow(a, -0.3333333333333333) * cbrt((g * 0.5));
	}
	return tmp;
}
public static double code(double g, double a) {
	double tmp;
	if ((a * 2.0) <= -2e-304) {
		tmp = Math.pow(-a, -0.3333333333333333) * Math.cbrt((g * -0.5));
	} else {
		tmp = Math.pow(a, -0.3333333333333333) * Math.cbrt((g * 0.5));
	}
	return tmp;
}
function code(g, a)
	tmp = 0.0
	if (Float64(a * 2.0) <= -2e-304)
		tmp = Float64((Float64(-a) ^ -0.3333333333333333) * cbrt(Float64(g * -0.5)));
	else
		tmp = Float64((a ^ -0.3333333333333333) * cbrt(Float64(g * 0.5)));
	end
	return tmp
end
code[g_, a_] := If[LessEqual[N[(a * 2.0), $MachinePrecision], -2e-304], N[(N[Power[(-a), -0.3333333333333333], $MachinePrecision] * N[Power[N[(g * -0.5), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[Power[a, -0.3333333333333333], $MachinePrecision] * N[Power[N[(g * 0.5), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq -2 \cdot 10^{-304}:\\
\;\;\;\;{\left(-a\right)}^{-0.3333333333333333} \cdot \sqrt[3]{g \cdot -0.5}\\

\mathbf{else}:\\
\;\;\;\;{a}^{-0.3333333333333333} \cdot \sqrt[3]{g \cdot 0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 #s(literal 2 binary64) a) < -1.99999999999999994e-304

    1. Initial program 69.4%

      \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{g \cdot \color{blue}{\frac{1}{2}}}}{\sqrt[3]{a}} \]
      8. cbrt-lowering-cbrt.f6498.7

        \[\leadsto \frac{\sqrt[3]{g \cdot 0.5}}{\color{blue}{\sqrt[3]{a}}} \]
    4. Applied egg-rr98.7%

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{\mathsf{neg}\left(g \cdot \color{blue}{\frac{1}{2}}\right)}{\mathsf{neg}\left(a\right)}\right)}^{\frac{1}{3}} \]
      9. div-invN/A

        \[\leadsto {\left(\frac{\mathsf{neg}\left(\color{blue}{\frac{g}{2}}\right)}{\mathsf{neg}\left(a\right)}\right)}^{\frac{1}{3}} \]
      10. div-invN/A

        \[\leadsto {\color{blue}{\left(\left(\mathsf{neg}\left(\frac{g}{2}\right)\right) \cdot \frac{1}{\mathsf{neg}\left(a\right)}\right)}}^{\frac{1}{3}} \]
      11. distribute-neg-frac2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\mathsf{neg}\left(a\right)\right)}^{\frac{-1}{3}} \cdot \color{blue}{\sqrt[3]{\mathsf{neg}\left(\frac{g}{2}\right)}} \]
    6. Applied egg-rr92.1%

      \[\leadsto \color{blue}{{\left(-a\right)}^{-0.3333333333333333} \cdot \sqrt[3]{g \cdot -0.5}} \]

    if -1.99999999999999994e-304 < (*.f64 #s(literal 2 binary64) a)

    1. Initial program 80.8%

      \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {a}^{\frac{-1}{3}} \cdot \sqrt[3]{\color{blue}{g \cdot \frac{1}{2}}} \]
      14. metadata-eval92.2

        \[\leadsto {a}^{-0.3333333333333333} \cdot \sqrt[3]{g \cdot \color{blue}{0.5}} \]
    4. Applied egg-rr92.2%

      \[\leadsto \color{blue}{{a}^{-0.3333333333333333} \cdot \sqrt[3]{g \cdot 0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification92.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot 2 \leq -2 \cdot 10^{-304}:\\ \;\;\;\;{\left(-a\right)}^{-0.3333333333333333} \cdot \sqrt[3]{g \cdot -0.5}\\ \mathbf{else}:\\ \;\;\;\;{a}^{-0.3333333333333333} \cdot \sqrt[3]{g \cdot 0.5}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 90.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{g}{a \cdot 2}\\ t_1 := \sqrt{\frac{g \cdot -0.5}{a}}\\ t_2 := \frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-321}:\\ \;\;\;\;\sqrt[3]{-t\_1 \cdot t\_1}\\ \mathbf{elif}\;t\_0 \leq 10^{-312}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_0 \leq 10^{+295}:\\ \;\;\;\;\frac{1}{\sqrt[3]{\frac{a \cdot 2}{g}}}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (g a)
 :precision binary64
 (let* ((t_0 (/ g (* a 2.0)))
        (t_1 (sqrt (/ (* g -0.5) a)))
        (t_2 (/ (cbrt (* 0.5 (* a (* g a)))) a)))
   (if (<= t_0 (- INFINITY))
     t_2
     (if (<= t_0 -1e-321)
       (cbrt (- (* t_1 t_1)))
       (if (<= t_0 1e-312)
         t_2
         (if (<= t_0 1e+295) (/ 1.0 (cbrt (/ (* a 2.0) g))) t_2))))))
double code(double g, double a) {
	double t_0 = g / (a * 2.0);
	double t_1 = sqrt(((g * -0.5) / a));
	double t_2 = cbrt((0.5 * (a * (g * a)))) / a;
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = t_2;
	} else if (t_0 <= -1e-321) {
		tmp = cbrt(-(t_1 * t_1));
	} else if (t_0 <= 1e-312) {
		tmp = t_2;
	} else if (t_0 <= 1e+295) {
		tmp = 1.0 / cbrt(((a * 2.0) / g));
	} else {
		tmp = t_2;
	}
	return tmp;
}
public static double code(double g, double a) {
	double t_0 = g / (a * 2.0);
	double t_1 = Math.sqrt(((g * -0.5) / a));
	double t_2 = Math.cbrt((0.5 * (a * (g * a)))) / a;
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = t_2;
	} else if (t_0 <= -1e-321) {
		tmp = Math.cbrt(-(t_1 * t_1));
	} else if (t_0 <= 1e-312) {
		tmp = t_2;
	} else if (t_0 <= 1e+295) {
		tmp = 1.0 / Math.cbrt(((a * 2.0) / g));
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(g, a)
	t_0 = Float64(g / Float64(a * 2.0))
	t_1 = sqrt(Float64(Float64(g * -0.5) / a))
	t_2 = Float64(cbrt(Float64(0.5 * Float64(a * Float64(g * a)))) / a)
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = t_2;
	elseif (t_0 <= -1e-321)
		tmp = cbrt(Float64(-Float64(t_1 * t_1)));
	elseif (t_0 <= 1e-312)
		tmp = t_2;
	elseif (t_0 <= 1e+295)
		tmp = Float64(1.0 / cbrt(Float64(Float64(a * 2.0) / g)));
	else
		tmp = t_2;
	end
	return tmp
end
code[g_, a_] := Block[{t$95$0 = N[(g / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(g * -0.5), $MachinePrecision] / a), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[(0.5 * N[(a * N[(g * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$2, If[LessEqual[t$95$0, -1e-321], N[Power[(-N[(t$95$1 * t$95$1), $MachinePrecision]), 1/3], $MachinePrecision], If[LessEqual[t$95$0, 1e-312], t$95$2, If[LessEqual[t$95$0, 1e+295], N[(1.0 / N[Power[N[(N[(a * 2.0), $MachinePrecision] / g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{g}{a \cdot 2}\\
t_1 := \sqrt{\frac{g \cdot -0.5}{a}}\\
t_2 := \frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-321}:\\
\;\;\;\;\sqrt[3]{-t\_1 \cdot t\_1}\\

\mathbf{elif}\;t\_0 \leq 10^{-312}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_0 \leq 10^{+295}:\\
\;\;\;\;\frac{1}{\sqrt[3]{\frac{a \cdot 2}{g}}}\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -inf.0 or -9.98013e-322 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999847e-313 or 9.9999999999999998e294 < (/.f64 g (*.f64 #s(literal 2 binary64) a))

    1. Initial program 5.7%

      \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{g \cdot 0.5}}{\color{blue}{\sqrt[3]{a}}} \]
    4. Applied egg-rr98.8%

      \[\leadsto \color{blue}{\frac{\sqrt[3]{g \cdot 0.5}}{\sqrt[3]{a}}} \]
    5. Applied egg-rr66.3%

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\left(\left(g \cdot a\right) \cdot a\right) \cdot 0.5}}{a}} \]

    if -inf.0 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -9.98013e-322

    1. Initial program 98.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{g \cdot {\color{blue}{\left(\left(2 \cdot a\right) \cdot \left(2 \cdot a\right)\right)}}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}} \]
      10. remove-double-negN/A

        \[\leadsto \sqrt[3]{g \cdot {\left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(2 \cdot a\right)\right)\right)\right)} \cdot \left(2 \cdot a\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}} \]
      11. remove-double-negN/A

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

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

        \[\leadsto \sqrt[3]{g \cdot \color{blue}{\left({\left(\mathsf{neg}\left(2 \cdot a\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)} \cdot {\left(\mathsf{neg}\left(2 \cdot a\right)\right)}^{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right)}} \]
      14. pow-prod-upN/A

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{g \cdot \color{blue}{\frac{1}{\mathsf{neg}\left(2 \cdot a\right)}}} \]
    4. Applied egg-rr98.5%

      \[\leadsto \sqrt[3]{\color{blue}{\sqrt{\frac{g \cdot -0.5}{a}} \cdot \left(-\sqrt{\frac{g \cdot -0.5}{a}}\right)}} \]

    if 9.9999999999847e-313 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999999998e294

    1. Initial program 98.9%

      \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{g \cdot \color{blue}{\frac{1}{2}}}}{\sqrt[3]{a}} \]
      8. cbrt-lowering-cbrt.f6498.6

        \[\leadsto \frac{\sqrt[3]{g \cdot 0.5}}{\color{blue}{\sqrt[3]{a}}} \]
    4. Applied egg-rr98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt[3]{\frac{\color{blue}{a \cdot 2}}{g}}} \]
      15. *-lowering-*.f6499.1

        \[\leadsto \frac{1}{\sqrt[3]{\frac{\color{blue}{a \cdot 2}}{g}}} \]
    6. Applied egg-rr99.1%

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{\frac{a \cdot 2}{g}}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification90.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{g}{a \cdot 2} \leq -\infty:\\ \;\;\;\;\frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \mathbf{elif}\;\frac{g}{a \cdot 2} \leq -1 \cdot 10^{-321}:\\ \;\;\;\;\sqrt[3]{-\sqrt{\frac{g \cdot -0.5}{a}} \cdot \sqrt{\frac{g \cdot -0.5}{a}}}\\ \mathbf{elif}\;\frac{g}{a \cdot 2} \leq 10^{-312}:\\ \;\;\;\;\frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \mathbf{elif}\;\frac{g}{a \cdot 2} \leq 10^{+295}:\\ \;\;\;\;\frac{1}{\sqrt[3]{\frac{a \cdot 2}{g}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 90.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{g}{a \cdot 2}\\ t_1 := \frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-321}:\\ \;\;\;\;\sqrt[3]{t\_0}\\ \mathbf{elif}\;t\_0 \leq 10^{-312}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 10^{+295}:\\ \;\;\;\;\frac{1}{\sqrt[3]{\frac{a \cdot 2}{g}}}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (g a)
 :precision binary64
 (let* ((t_0 (/ g (* a 2.0))) (t_1 (/ (cbrt (* 0.5 (* a (* g a)))) a)))
   (if (<= t_0 (- INFINITY))
     t_1
     (if (<= t_0 -1e-321)
       (cbrt t_0)
       (if (<= t_0 1e-312)
         t_1
         (if (<= t_0 1e+295) (/ 1.0 (cbrt (/ (* a 2.0) g))) t_1))))))
double code(double g, double a) {
	double t_0 = g / (a * 2.0);
	double t_1 = cbrt((0.5 * (a * (g * a)))) / a;
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = t_1;
	} else if (t_0 <= -1e-321) {
		tmp = cbrt(t_0);
	} else if (t_0 <= 1e-312) {
		tmp = t_1;
	} else if (t_0 <= 1e+295) {
		tmp = 1.0 / cbrt(((a * 2.0) / g));
	} else {
		tmp = t_1;
	}
	return tmp;
}
public static double code(double g, double a) {
	double t_0 = g / (a * 2.0);
	double t_1 = Math.cbrt((0.5 * (a * (g * a)))) / a;
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else if (t_0 <= -1e-321) {
		tmp = Math.cbrt(t_0);
	} else if (t_0 <= 1e-312) {
		tmp = t_1;
	} else if (t_0 <= 1e+295) {
		tmp = 1.0 / Math.cbrt(((a * 2.0) / g));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(g, a)
	t_0 = Float64(g / Float64(a * 2.0))
	t_1 = Float64(cbrt(Float64(0.5 * Float64(a * Float64(g * a)))) / a)
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = t_1;
	elseif (t_0 <= -1e-321)
		tmp = cbrt(t_0);
	elseif (t_0 <= 1e-312)
		tmp = t_1;
	elseif (t_0 <= 1e+295)
		tmp = Float64(1.0 / cbrt(Float64(Float64(a * 2.0) / g)));
	else
		tmp = t_1;
	end
	return tmp
end
code[g_, a_] := Block[{t$95$0 = N[(g / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(0.5 * N[(a * N[(g * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, -1e-321], N[Power[t$95$0, 1/3], $MachinePrecision], If[LessEqual[t$95$0, 1e-312], t$95$1, If[LessEqual[t$95$0, 1e+295], N[(1.0 / N[Power[N[(N[(a * 2.0), $MachinePrecision] / g), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{g}{a \cdot 2}\\
t_1 := \frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-321}:\\
\;\;\;\;\sqrt[3]{t\_0}\\

\mathbf{elif}\;t\_0 \leq 10^{-312}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 10^{+295}:\\
\;\;\;\;\frac{1}{\sqrt[3]{\frac{a \cdot 2}{g}}}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -inf.0 or -9.98013e-322 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999847e-313 or 9.9999999999999998e294 < (/.f64 g (*.f64 #s(literal 2 binary64) a))

    1. Initial program 5.7%

      \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{g \cdot 0.5}}{\color{blue}{\sqrt[3]{a}}} \]
    4. Applied egg-rr98.8%

      \[\leadsto \color{blue}{\frac{\sqrt[3]{g \cdot 0.5}}{\sqrt[3]{a}}} \]
    5. Applied egg-rr66.3%

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\left(\left(g \cdot a\right) \cdot a\right) \cdot 0.5}}{a}} \]

    if -inf.0 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -9.98013e-322

    1. Initial program 98.4%

      \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
    2. Add Preprocessing

    if 9.9999999999847e-313 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999999998e294

    1. Initial program 98.9%

      \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{g \cdot \color{blue}{\frac{1}{2}}}}{\sqrt[3]{a}} \]
      8. cbrt-lowering-cbrt.f6498.6

        \[\leadsto \frac{\sqrt[3]{g \cdot 0.5}}{\color{blue}{\sqrt[3]{a}}} \]
    4. Applied egg-rr98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt[3]{\frac{\color{blue}{a \cdot 2}}{g}}} \]
      15. *-lowering-*.f6499.1

        \[\leadsto \frac{1}{\sqrt[3]{\frac{\color{blue}{a \cdot 2}}{g}}} \]
    6. Applied egg-rr99.1%

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{\frac{a \cdot 2}{g}}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification90.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{g}{a \cdot 2} \leq -\infty:\\ \;\;\;\;\frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \mathbf{elif}\;\frac{g}{a \cdot 2} \leq -1 \cdot 10^{-321}:\\ \;\;\;\;\sqrt[3]{\frac{g}{a \cdot 2}}\\ \mathbf{elif}\;\frac{g}{a \cdot 2} \leq 10^{-312}:\\ \;\;\;\;\frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \mathbf{elif}\;\frac{g}{a \cdot 2} \leq 10^{+295}:\\ \;\;\;\;\frac{1}{\sqrt[3]{\frac{a \cdot 2}{g}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 90.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{g}{a \cdot 2}\\ t_1 := \frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-321}:\\ \;\;\;\;\sqrt[3]{t\_0}\\ \mathbf{elif}\;t\_0 \leq 10^{-312}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 10^{+295}:\\ \;\;\;\;\frac{1}{\sqrt[3]{a \cdot \frac{2}{g}}}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (g a)
 :precision binary64
 (let* ((t_0 (/ g (* a 2.0))) (t_1 (/ (cbrt (* 0.5 (* a (* g a)))) a)))
   (if (<= t_0 (- INFINITY))
     t_1
     (if (<= t_0 -1e-321)
       (cbrt t_0)
       (if (<= t_0 1e-312)
         t_1
         (if (<= t_0 1e+295) (/ 1.0 (cbrt (* a (/ 2.0 g)))) t_1))))))
double code(double g, double a) {
	double t_0 = g / (a * 2.0);
	double t_1 = cbrt((0.5 * (a * (g * a)))) / a;
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = t_1;
	} else if (t_0 <= -1e-321) {
		tmp = cbrt(t_0);
	} else if (t_0 <= 1e-312) {
		tmp = t_1;
	} else if (t_0 <= 1e+295) {
		tmp = 1.0 / cbrt((a * (2.0 / g)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
public static double code(double g, double a) {
	double t_0 = g / (a * 2.0);
	double t_1 = Math.cbrt((0.5 * (a * (g * a)))) / a;
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else if (t_0 <= -1e-321) {
		tmp = Math.cbrt(t_0);
	} else if (t_0 <= 1e-312) {
		tmp = t_1;
	} else if (t_0 <= 1e+295) {
		tmp = 1.0 / Math.cbrt((a * (2.0 / g)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(g, a)
	t_0 = Float64(g / Float64(a * 2.0))
	t_1 = Float64(cbrt(Float64(0.5 * Float64(a * Float64(g * a)))) / a)
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = t_1;
	elseif (t_0 <= -1e-321)
		tmp = cbrt(t_0);
	elseif (t_0 <= 1e-312)
		tmp = t_1;
	elseif (t_0 <= 1e+295)
		tmp = Float64(1.0 / cbrt(Float64(a * Float64(2.0 / g))));
	else
		tmp = t_1;
	end
	return tmp
end
code[g_, a_] := Block[{t$95$0 = N[(g / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(0.5 * N[(a * N[(g * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, -1e-321], N[Power[t$95$0, 1/3], $MachinePrecision], If[LessEqual[t$95$0, 1e-312], t$95$1, If[LessEqual[t$95$0, 1e+295], N[(1.0 / N[Power[N[(a * N[(2.0 / g), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{g}{a \cdot 2}\\
t_1 := \frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-321}:\\
\;\;\;\;\sqrt[3]{t\_0}\\

\mathbf{elif}\;t\_0 \leq 10^{-312}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 10^{+295}:\\
\;\;\;\;\frac{1}{\sqrt[3]{a \cdot \frac{2}{g}}}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -inf.0 or -9.98013e-322 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999847e-313 or 9.9999999999999998e294 < (/.f64 g (*.f64 #s(literal 2 binary64) a))

    1. Initial program 5.7%

      \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{g \cdot 0.5}}{\color{blue}{\sqrt[3]{a}}} \]
    4. Applied egg-rr98.8%

      \[\leadsto \color{blue}{\frac{\sqrt[3]{g \cdot 0.5}}{\sqrt[3]{a}}} \]
    5. Applied egg-rr66.3%

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\left(\left(g \cdot a\right) \cdot a\right) \cdot 0.5}}{a}} \]

    if -inf.0 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -9.98013e-322

    1. Initial program 98.4%

      \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
    2. Add Preprocessing

    if 9.9999999999847e-313 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999999998e294

    1. Initial program 98.9%

      \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{g \cdot \color{blue}{\frac{1}{2}}}}{\sqrt[3]{a}} \]
      8. cbrt-lowering-cbrt.f6498.6

        \[\leadsto \frac{\sqrt[3]{g \cdot 0.5}}{\color{blue}{\sqrt[3]{a}}} \]
    4. Applied egg-rr98.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt[3]{\frac{\color{blue}{a \cdot 2}}{g}}} \]
      15. *-lowering-*.f6499.1

        \[\leadsto \frac{1}{\sqrt[3]{\frac{\color{blue}{a \cdot 2}}{g}}} \]
    6. Applied egg-rr99.1%

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

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

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

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

        \[\leadsto \frac{1}{\sqrt[3]{\color{blue}{\frac{2}{g}} \cdot a}} \]
    8. Applied egg-rr99.1%

      \[\leadsto \frac{1}{\sqrt[3]{\color{blue}{\frac{2}{g} \cdot a}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification90.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{g}{a \cdot 2} \leq -\infty:\\ \;\;\;\;\frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \mathbf{elif}\;\frac{g}{a \cdot 2} \leq -1 \cdot 10^{-321}:\\ \;\;\;\;\sqrt[3]{\frac{g}{a \cdot 2}}\\ \mathbf{elif}\;\frac{g}{a \cdot 2} \leq 10^{-312}:\\ \;\;\;\;\frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \mathbf{elif}\;\frac{g}{a \cdot 2} \leq 10^{+295}:\\ \;\;\;\;\frac{1}{\sqrt[3]{a \cdot \frac{2}{g}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 91.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ t_1 := \frac{g}{a \cdot 2}\\ t_2 := \sqrt[3]{t\_1}\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-321}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 10^{-312}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 10^{+295}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (g a)
 :precision binary64
 (let* ((t_0 (/ (cbrt (* 0.5 (* a (* g a)))) a))
        (t_1 (/ g (* a 2.0)))
        (t_2 (cbrt t_1)))
   (if (<= t_1 (- INFINITY))
     t_0
     (if (<= t_1 -1e-321)
       t_2
       (if (<= t_1 1e-312) t_0 (if (<= t_1 1e+295) t_2 t_0))))))
double code(double g, double a) {
	double t_0 = cbrt((0.5 * (a * (g * a)))) / a;
	double t_1 = g / (a * 2.0);
	double t_2 = cbrt(t_1);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = t_0;
	} else if (t_1 <= -1e-321) {
		tmp = t_2;
	} else if (t_1 <= 1e-312) {
		tmp = t_0;
	} else if (t_1 <= 1e+295) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
public static double code(double g, double a) {
	double t_0 = Math.cbrt((0.5 * (a * (g * a)))) / a;
	double t_1 = g / (a * 2.0);
	double t_2 = Math.cbrt(t_1);
	double tmp;
	if (t_1 <= -Double.POSITIVE_INFINITY) {
		tmp = t_0;
	} else if (t_1 <= -1e-321) {
		tmp = t_2;
	} else if (t_1 <= 1e-312) {
		tmp = t_0;
	} else if (t_1 <= 1e+295) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(g, a)
	t_0 = Float64(cbrt(Float64(0.5 * Float64(a * Float64(g * a)))) / a)
	t_1 = Float64(g / Float64(a * 2.0))
	t_2 = cbrt(t_1)
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = t_0;
	elseif (t_1 <= -1e-321)
		tmp = t_2;
	elseif (t_1 <= 1e-312)
		tmp = t_0;
	elseif (t_1 <= 1e+295)
		tmp = t_2;
	else
		tmp = t_0;
	end
	return tmp
end
code[g_, a_] := Block[{t$95$0 = N[(N[Power[N[(0.5 * N[(a * N[(g * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$1 = N[(g / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, 1/3], $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$0, If[LessEqual[t$95$1, -1e-321], t$95$2, If[LessEqual[t$95$1, 1e-312], t$95$0, If[LessEqual[t$95$1, 1e+295], t$95$2, t$95$0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\
t_1 := \frac{g}{a \cdot 2}\\
t_2 := \sqrt[3]{t\_1}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-321}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 10^{-312}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_1 \leq 10^{+295}:\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -inf.0 or -9.98013e-322 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999847e-313 or 9.9999999999999998e294 < (/.f64 g (*.f64 #s(literal 2 binary64) a))

    1. Initial program 5.7%

      \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/r*N/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{g \cdot 0.5}}{\color{blue}{\sqrt[3]{a}}} \]
    4. Applied egg-rr98.8%

      \[\leadsto \color{blue}{\frac{\sqrt[3]{g \cdot 0.5}}{\sqrt[3]{a}}} \]
    5. Applied egg-rr66.3%

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\left(\left(g \cdot a\right) \cdot a\right) \cdot 0.5}}{a}} \]

    if -inf.0 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -9.98013e-322 or 9.9999999999847e-313 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 9.9999999999999998e294

    1. Initial program 98.6%

      \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification90.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{g}{a \cdot 2} \leq -\infty:\\ \;\;\;\;\frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \mathbf{elif}\;\frac{g}{a \cdot 2} \leq -1 \cdot 10^{-321}:\\ \;\;\;\;\sqrt[3]{\frac{g}{a \cdot 2}}\\ \mathbf{elif}\;\frac{g}{a \cdot 2} \leq 10^{-312}:\\ \;\;\;\;\frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \mathbf{elif}\;\frac{g}{a \cdot 2} \leq 10^{+295}:\\ \;\;\;\;\sqrt[3]{\frac{g}{a \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{0.5 \cdot \left(a \cdot \left(g \cdot a\right)\right)}}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 76.7% accurate, 1.0× speedup?

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

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

    \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
  2. Add Preprocessing
  3. Final simplification75.0%

    \[\leadsto \sqrt[3]{\frac{g}{a \cdot 2}} \]
  4. Add Preprocessing

Alternative 8: 76.7% 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 75.0%

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

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

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

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

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

      \[\leadsto \sqrt[3]{\color{blue}{\frac{\frac{1}{2}}{a}} \cdot g} \]
    6. metadata-eval75.0

      \[\leadsto \sqrt[3]{\frac{\color{blue}{0.5}}{a} \cdot g} \]
  4. Applied egg-rr75.0%

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

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

Reproduce

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