2-ancestry mixing, zero discriminant

Percentage Accurate: 76.2% → 98.6%
Time: 7.5s
Alternatives: 9
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 9 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.2% 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.6% accurate, 0.5× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt[3]{g}}{\color{blue}{\sqrt[3]{2 \cdot a}}} \]
  4. Applied rewrites98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 91.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot 2 \leq -1 \cdot 10^{-304}:\\ \;\;\;\;\sqrt[3]{-g} \cdot {\left(a \cdot -2\right)}^{-0.3333333333333333}\\ \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) -1e-304)
   (* (cbrt (- g)) (pow (* a -2.0) -0.3333333333333333))
   (* (pow a -0.3333333333333333) (cbrt (* g 0.5)))))
double code(double g, double a) {
	double tmp;
	if ((a * 2.0) <= -1e-304) {
		tmp = cbrt(-g) * pow((a * -2.0), -0.3333333333333333);
	} 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) <= -1e-304) {
		tmp = Math.cbrt(-g) * Math.pow((a * -2.0), -0.3333333333333333);
	} 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) <= -1e-304)
		tmp = Float64(cbrt(Float64(-g)) * (Float64(a * -2.0) ^ -0.3333333333333333));
	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], -1e-304], N[(N[Power[(-g), 1/3], $MachinePrecision] * N[Power[N[(a * -2.0), $MachinePrecision], -0.3333333333333333], $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 -1 \cdot 10^{-304}:\\
\;\;\;\;\sqrt[3]{-g} \cdot {\left(a \cdot -2\right)}^{-0.3333333333333333}\\

\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) < -9.99999999999999971e-305

    1. Initial program 76.1%

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{g}}{\color{blue}{\sqrt[3]{2 \cdot a}}} \]
    4. Applied rewrites98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt[3]{g} \cdot \color{blue}{\sqrt[3]{\frac{-1}{2}}}\right) \cdot \sqrt[3]{\frac{-1}{a}} \]
      8. lower-cbrt.f6498.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\frac{1}{a} \cdot \color{blue}{\frac{\mathsf{neg}\left(g\right)}{\mathsf{neg}\left(2\right)}}} \]
    10. Applied rewrites92.2%

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

    if -9.99999999999999971e-305 < (*.f64 #s(literal 2 binary64) a)

    1. Initial program 76.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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