2-ancestry mixing, zero discriminant

Percentage Accurate: 76.1% → 98.7%
Time: 6.9s
Alternatives: 11
Speedup: 0.8×

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

\\
\frac{\sqrt[3]{g \cdot 0.5}}{\sqrt[3]{a}}
\end{array}
Derivation
  1. Initial program 73.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. 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. cbrt-divN/A

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

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

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

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

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

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

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

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

Alternative 2: 90.7% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 72.0%

      \[\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. cbrt-divN/A

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{g}{a \cdot 2}\right)}^{0.3333333333333333}} \]
    6. Applied rewrites91.9%

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

    if -1.99999999999999992e-291 < (*.f64 #s(literal 2 binary64) a)

    1. Initial program 75.6%

      \[\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-eval92.2

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

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

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

Alternative 3: 83.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \leq 5 \cdot 10^{-308}:\\
\;\;\;\;\frac{1}{\sqrt[3]{\frac{a}{g \cdot 0.5}}}\\

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


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

    1. Initial program 72.2%

      \[\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. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt[3]{\frac{a}{g \cdot \color{blue}{0.5}}}} \]
    4. Applied rewrites72.5%

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{\frac{a}{g \cdot 0.5}}}} \]

    if 4.99999999999999955e-308 < (*.f64 #s(literal 2 binary64) a)

    1. Initial program 75.4%

      \[\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-eval92.2

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

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

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

Alternative 4: 98.7% accurate, 0.5× speedup?

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

\\
\frac{\sqrt[3]{g}}{\sqrt[3]{a \cdot 2}}
\end{array}
Derivation
  1. Initial program 73.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. Final simplification98.7%

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

Alternative 5: 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 73.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. 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. cbrt-divN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 79.3% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-320}:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -1.00000000000000004e-284

    1. Initial program 83.5%

      \[\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. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt[3]{\frac{a}{\color{blue}{g \cdot \frac{1}{2}}}}} \]
      15. metadata-eval85.2

        \[\leadsto \frac{1}{\sqrt[3]{\frac{a}{g \cdot \color{blue}{0.5}}}} \]
    4. Applied rewrites85.2%

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{\frac{a}{g \cdot 0.5}}}} \]

    if -1.00000000000000004e-284 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 4.99994e-320 or 3.9999999999999999e295 < (/.f64 g (*.f64 #s(literal 2 binary64) a))

    1. Initial program 9.5%

      \[\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. cbrt-divN/A

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{g \cdot 0.5}}{\sqrt[3]{a}}} \]
    5. Applied rewrites12.9%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{g \cdot \left(\left(a \cdot a\right) \cdot 4\right)}}{{8}^{\frac{1}{3}} \cdot \sqrt[3]{\color{blue}{{a}^{3}}}} \]
      9. rem-cbrt-cubeN/A

        \[\leadsto \frac{\sqrt[3]{g \cdot \left(\left(a \cdot a\right) \cdot 4\right)}}{{8}^{\frac{1}{3}} \cdot \color{blue}{a}} \]
      10. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{\frac{\sqrt[3]{g \cdot \left(\left(a \cdot a\right) \cdot 4\right)}}{{8}^{\frac{1}{3}}}}{a}} \]
      11. clear-numN/A

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

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

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

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

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

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

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

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

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

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

    if 4.99994e-320 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 3.9999999999999999e295

    1. Initial program 99.0%

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

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

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

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

        \[\leadsto \sqrt[3]{\frac{g}{\color{blue}{\frac{2}{\frac{1}{a}}}}} \]
      5. lower-/.f6499.0

        \[\leadsto \sqrt[3]{\frac{g}{\frac{2}{\color{blue}{\frac{1}{a}}}}} \]
    4. Applied rewrites99.0%

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

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

Alternative 7: 79.3% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-320}:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -1.00000000000000004e-284

    1. Initial program 83.5%

      \[\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. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt[3]{\frac{a}{\color{blue}{g \cdot \frac{1}{2}}}}} \]
      15. metadata-eval85.2

        \[\leadsto \frac{1}{\sqrt[3]{\frac{a}{g \cdot \color{blue}{0.5}}}} \]
    4. Applied rewrites85.2%

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{\frac{a}{g \cdot 0.5}}}} \]

    if -1.00000000000000004e-284 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 4.99994e-320 or 3.9999999999999999e295 < (/.f64 g (*.f64 #s(literal 2 binary64) a))

    1. Initial program 9.5%

      \[\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. cbrt-divN/A

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{g \cdot 0.5}}{\sqrt[3]{a}}} \]
    5. Applied rewrites12.9%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{g \cdot \left(\left(a \cdot a\right) \cdot 4\right)}}{{8}^{\frac{1}{3}} \cdot \sqrt[3]{\color{blue}{{a}^{3}}}} \]
      9. rem-cbrt-cubeN/A

        \[\leadsto \frac{\sqrt[3]{g \cdot \left(\left(a \cdot a\right) \cdot 4\right)}}{{8}^{\frac{1}{3}} \cdot \color{blue}{a}} \]
      10. associate-/r*N/A

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

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

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

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

    if 4.99994e-320 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 3.9999999999999999e295

    1. Initial program 99.0%

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

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

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

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

        \[\leadsto \sqrt[3]{\frac{g}{\color{blue}{\frac{2}{\frac{1}{a}}}}} \]
      5. lower-/.f6499.0

        \[\leadsto \sqrt[3]{\frac{g}{\frac{2}{\color{blue}{\frac{1}{a}}}}} \]
    4. Applied rewrites99.0%

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

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

Alternative 8: 79.3% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-320}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+295}:\\
\;\;\;\;\sqrt[3]{g \cdot \frac{0.5}{a}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -1.00000000000000004e-284

    1. Initial program 83.5%

      \[\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. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt[3]{\frac{a}{\color{blue}{g \cdot \frac{1}{2}}}}} \]
      15. metadata-eval85.2

        \[\leadsto \frac{1}{\sqrt[3]{\frac{a}{g \cdot \color{blue}{0.5}}}} \]
    4. Applied rewrites85.2%

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{\frac{a}{g \cdot 0.5}}}} \]

    if -1.00000000000000004e-284 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 4.99994e-320 or 3.9999999999999999e295 < (/.f64 g (*.f64 #s(literal 2 binary64) a))

    1. Initial program 9.5%

      \[\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. cbrt-divN/A

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{g \cdot 0.5}}{\sqrt[3]{a}}} \]
    5. Applied rewrites12.9%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{g \cdot \left(\left(a \cdot a\right) \cdot 4\right)}}{{8}^{\frac{1}{3}} \cdot \sqrt[3]{\color{blue}{{a}^{3}}}} \]
      9. rem-cbrt-cubeN/A

        \[\leadsto \frac{\sqrt[3]{g \cdot \left(\left(a \cdot a\right) \cdot 4\right)}}{{8}^{\frac{1}{3}} \cdot \color{blue}{a}} \]
      10. associate-/r*N/A

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

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

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

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

    if 4.99994e-320 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 3.9999999999999999e295

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 79.3% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-320}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+295}:\\
\;\;\;\;\sqrt[3]{g \cdot \frac{0.5}{a}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < -1.00000000000000004e-284

    1. Initial program 83.5%

      \[\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. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\sqrt[3]{\frac{a}{\color{blue}{g \cdot \frac{1}{2}}}}} \]
      15. metadata-eval85.2

        \[\leadsto \frac{1}{\sqrt[3]{\frac{a}{g \cdot \color{blue}{0.5}}}} \]
    4. Applied rewrites85.2%

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{\frac{a}{g \cdot 0.5}}}} \]

    if -1.00000000000000004e-284 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 4.99994e-320 or 3.9999999999999999e295 < (/.f64 g (*.f64 #s(literal 2 binary64) a))

    1. Initial program 9.5%

      \[\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. cbrt-divN/A

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{g \cdot 0.5}}{\sqrt[3]{a}}} \]
    5. Applied rewrites12.9%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{g \cdot \left(\left(a \cdot a\right) \cdot 4\right)}}{{8}^{\frac{1}{3}} \cdot \sqrt[3]{\color{blue}{{a}^{3}}}} \]
      9. rem-cbrt-cubeN/A

        \[\leadsto \frac{\sqrt[3]{g \cdot \left(\left(a \cdot a\right) \cdot 4\right)}}{{8}^{\frac{1}{3}} \cdot \color{blue}{a}} \]
      10. associate-/r*N/A

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

        \[\leadsto \color{blue}{\frac{\frac{\sqrt[3]{g \cdot \left(\left(a \cdot a\right) \cdot 4\right)}}{{8}^{\frac{1}{3}}}}{a}} \]
    7. Applied rewrites33.2%

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

    if 4.99994e-320 < (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 3.9999999999999999e295

    1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 77.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{g}{a \cdot 2} \leq 4 \cdot 10^{+295}:\\
\;\;\;\;\sqrt[3]{g \cdot \frac{0.5}{a}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{g \cdot \left(0.5 \cdot \left(a \cdot a\right)\right)}}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 g (*.f64 #s(literal 2 binary64) a)) < 3.9999999999999999e295

    1. Initial program 80.1%

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\frac{\color{blue}{0.5}}{a} \cdot g} \]
    4. Applied rewrites80.1%

      \[\leadsto \sqrt[3]{\color{blue}{\frac{0.5}{a} \cdot g}} \]

    if 3.9999999999999999e295 < (/.f64 g (*.f64 #s(literal 2 binary64) a))

    1. Initial program 4.4%

      \[\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. cbrt-divN/A

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{g \cdot 0.5}}{\sqrt[3]{a}}} \]
    5. Applied rewrites7.9%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{g \cdot \left(\left(a \cdot a\right) \cdot 4\right)}}{{8}^{\frac{1}{3}} \cdot \sqrt[3]{\color{blue}{{a}^{3}}}} \]
      9. rem-cbrt-cubeN/A

        \[\leadsto \frac{\sqrt[3]{g \cdot \left(\left(a \cdot a\right) \cdot 4\right)}}{{8}^{\frac{1}{3}} \cdot \color{blue}{a}} \]
      10. associate-/r*N/A

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{g \cdot \left(\left(a \cdot a\right) \cdot 0.5\right)}}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.9%

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

Alternative 11: 76.1% 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 73.9%

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt[3]{\frac{\color{blue}{0.5}}{a} \cdot g} \]
  4. Applied rewrites73.9%

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

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

Reproduce

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