2-ancestry mixing, zero discriminant

Percentage Accurate: 75.4% → 98.7%
Time: 4.1s
Alternatives: 7
Speedup: 1.0×

Specification

?
\[\sqrt[3]{\frac{g}{2 \cdot a}} \]
(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]
\sqrt[3]{\frac{g}{2 \cdot a}}

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 7 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: 75.4% accurate, 1.0× speedup?

\[\sqrt[3]{\frac{g}{2 \cdot a}} \]
(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]
\sqrt[3]{\frac{g}{2 \cdot a}}

Alternative 1: 98.7% accurate, 0.6× speedup?

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

    \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
  2. 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. mult-flipN/A

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.7% accurate, 0.6× speedup?

\[\frac{\sqrt[3]{g}}{\sqrt[3]{a + a}} \]
(FPCore (g a) :precision binary64 (/ (cbrt g) (cbrt (+ a a))))
double code(double g, double a) {
	return cbrt(g) / cbrt((a + a));
}
public static double code(double g, double a) {
	return Math.cbrt(g) / Math.cbrt((a + a));
}
function code(g, a)
	return Float64(cbrt(g) / cbrt(Float64(a + a)))
end
code[g_, a_] := N[(N[Power[g, 1/3], $MachinePrecision] / N[Power[N[(a + a), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\frac{\sqrt[3]{g}}{\sqrt[3]{a + a}}
Derivation
  1. Initial program 75.4%

    \[\sqrt[3]{\frac{g}{2 \cdot a}} \]
  2. 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}}} \]
    7. lift-*.f64N/A

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

      \[\leadsto \frac{\sqrt[3]{g}}{\sqrt[3]{\color{blue}{a + a}}} \]
    9. lower-+.f6498.7%

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

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

Alternative 3: 96.5% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \left|a\right| + \left|a\right|\\ t_1 := \sqrt[3]{\frac{\left|g\right|}{2 \cdot \left|a\right|}}\\ \mathsf{copysign}\left(1, g\right) \cdot \left(\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq 2 \cdot 10^{-107}:\\ \;\;\;\;e^{\mathsf{fma}\left(\log \left(0.5 \cdot \left|g\right|\right), 0.3333333333333333, -0.3333333333333333 \cdot \log \left(\left|a\right|\right)\right)}\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+98}:\\ \;\;\;\;\sqrt[3]{\frac{\left|g\right|}{t\_0}}\\ \mathbf{else}:\\ \;\;\;\;e^{0.3333333333333333 \cdot \log \left(\left|g\right|\right) - \log t\_0 \cdot 0.3333333333333333}\\ \end{array}\right) \end{array} \]
(FPCore (g a)
 :precision binary64
 (let* ((t_0 (+ (fabs a) (fabs a))) (t_1 (cbrt (/ (fabs g) (* 2.0 (fabs a))))))
   (*
    (copysign 1.0 g)
    (*
     (copysign 1.0 a)
     (if (<= t_1 2e-107)
       (exp
        (fma
         (log (* 0.5 (fabs g)))
         0.3333333333333333
         (* -0.3333333333333333 (log (fabs a)))))
       (if (<= t_1 5e+98)
         (cbrt (/ (fabs g) t_0))
         (exp
          (-
           (* 0.3333333333333333 (log (fabs g)))
           (* (log t_0) 0.3333333333333333)))))))))
double code(double g, double a) {
	double t_0 = fabs(a) + fabs(a);
	double t_1 = cbrt((fabs(g) / (2.0 * fabs(a))));
	double tmp;
	if (t_1 <= 2e-107) {
		tmp = exp(fma(log((0.5 * fabs(g))), 0.3333333333333333, (-0.3333333333333333 * log(fabs(a)))));
	} else if (t_1 <= 5e+98) {
		tmp = cbrt((fabs(g) / t_0));
	} else {
		tmp = exp(((0.3333333333333333 * log(fabs(g))) - (log(t_0) * 0.3333333333333333)));
	}
	return copysign(1.0, g) * (copysign(1.0, a) * tmp);
}
function code(g, a)
	t_0 = Float64(abs(a) + abs(a))
	t_1 = cbrt(Float64(abs(g) / Float64(2.0 * abs(a))))
	tmp = 0.0
	if (t_1 <= 2e-107)
		tmp = exp(fma(log(Float64(0.5 * abs(g))), 0.3333333333333333, Float64(-0.3333333333333333 * log(abs(a)))));
	elseif (t_1 <= 5e+98)
		tmp = cbrt(Float64(abs(g) / t_0));
	else
		tmp = exp(Float64(Float64(0.3333333333333333 * log(abs(g))) - Float64(log(t_0) * 0.3333333333333333)));
	end
	return Float64(copysign(1.0, g) * Float64(copysign(1.0, a) * tmp))
end
code[g_, a_] := Block[{t$95$0 = N[(N[Abs[a], $MachinePrecision] + N[Abs[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[Abs[g], $MachinePrecision] / N[(2.0 * N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[g]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$1, 2e-107], N[Exp[N[(N[Log[N[(0.5 * N[Abs[g], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.3333333333333333 + N[(-0.3333333333333333 * N[Log[N[Abs[a], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 5e+98], N[Power[N[(N[Abs[g], $MachinePrecision] / t$95$0), $MachinePrecision], 1/3], $MachinePrecision], N[Exp[N[(N[(0.3333333333333333 * N[Log[N[Abs[g], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Log[t$95$0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|a\right| + \left|a\right|\\
t_1 := \sqrt[3]{\frac{\left|g\right|}{2 \cdot \left|a\right|}}\\
\mathsf{copysign}\left(1, g\right) \cdot \left(\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-107}:\\
\;\;\;\;e^{\mathsf{fma}\left(\log \left(0.5 \cdot \left|g\right|\right), 0.3333333333333333, -0.3333333333333333 \cdot \log \left(\left|a\right|\right)\right)}\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+98}:\\
\;\;\;\;\sqrt[3]{\frac{\left|g\right|}{t\_0}}\\

\mathbf{else}:\\
\;\;\;\;e^{0.3333333333333333 \cdot \log \left(\left|g\right|\right) - \log t\_0 \cdot 0.3333333333333333}\\


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

    1. Initial program 75.4%

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

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

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

        \[\leadsto \color{blue}{e^{\log \left(\frac{g}{2 \cdot a}\right) \cdot \frac{1}{3}}} \]
      4. lower-unsound-exp.f64N/A

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

        \[\leadsto e^{\color{blue}{\log \left(\frac{g}{2 \cdot a}\right) \cdot \frac{1}{3}}} \]
      6. lower-unsound-log.f6436.2%

        \[\leadsto e^{\color{blue}{\log \left(\frac{g}{2 \cdot a}\right)} \cdot 0.3333333333333333} \]
      7. lift-*.f64N/A

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{2 \cdot a}}\right) \cdot \frac{1}{3}} \]
      8. count-2-revN/A

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot \frac{1}{3}} \]
      9. lower-+.f6436.2%

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot 0.3333333333333333} \]
    3. Applied rewrites36.2%

      \[\leadsto \color{blue}{e^{\log \left(\frac{g}{a + a}\right) \cdot 0.3333333333333333}} \]
    4. Step-by-step derivation
      1. lift-log.f64N/A

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

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

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot \frac{1}{3}} \]
      4. count-2N/A

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

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

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

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

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

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

        \[\leadsto e^{\left(\log \color{blue}{\left(\frac{1}{2} \cdot g\right)} - \log a\right) \cdot \frac{1}{3}} \]
      11. lower-unsound--.f64N/A

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

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

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

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

        \[\leadsto e^{\left(\log \color{blue}{\left(g \cdot \frac{1}{2}\right)} - \log a\right) \cdot \frac{1}{3}} \]
      16. lower-unsound-log.f6422.5%

        \[\leadsto e^{\left(\log \left(g \cdot 0.5\right) - \color{blue}{\log a}\right) \cdot 0.3333333333333333} \]
    5. Applied rewrites22.5%

      \[\leadsto e^{\color{blue}{\left(\log \left(g \cdot 0.5\right) - \log a\right)} \cdot 0.3333333333333333} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

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

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

        \[\leadsto e^{\frac{1}{3} \cdot \color{blue}{\left(\log \left(g \cdot \frac{1}{2}\right) - \log a\right)}} \]
      4. sub-flipN/A

        \[\leadsto e^{\frac{1}{3} \cdot \color{blue}{\left(\log \left(g \cdot \frac{1}{2}\right) + \left(\mathsf{neg}\left(\log a\right)\right)\right)}} \]
      5. distribute-lft-inN/A

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

        \[\leadsto e^{\color{blue}{\log \left(g \cdot \frac{1}{2}\right) \cdot \frac{1}{3}} + \frac{1}{3} \cdot \left(\mathsf{neg}\left(\log a\right)\right)} \]
      7. lower-fma.f64N/A

        \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(g \cdot \frac{1}{2}\right), \frac{1}{3}, \frac{1}{3} \cdot \left(\mathsf{neg}\left(\log a\right)\right)\right)}} \]
      8. lift-*.f64N/A

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

        \[\leadsto e^{\mathsf{fma}\left(\log \color{blue}{\left(\frac{1}{2} \cdot g\right)}, \frac{1}{3}, \frac{1}{3} \cdot \left(\mathsf{neg}\left(\log a\right)\right)\right)} \]
      10. lower-*.f64N/A

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

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

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

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

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \mathsf{neg}\left(\log \color{blue}{\left(\sqrt[3]{a}\right)}\right)\right)} \]
      15. log-recN/A

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

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \log \left(\frac{\color{blue}{\sqrt[3]{1}}}{\sqrt[3]{a}}\right)\right)} \]
      17. cbrt-divN/A

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \log \color{blue}{\left(\sqrt[3]{\frac{1}{a}}\right)}\right)} \]
      18. lift-/.f64N/A

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \log \left(\sqrt[3]{\color{blue}{\frac{1}{a}}}\right)\right)} \]
      19. lift-/.f64N/A

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

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

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \log \color{blue}{\left({a}^{\left(\frac{-1}{3}\right)}\right)}\right)} \]
      22. metadata-evalN/A

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

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \log \left({a}^{\color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)}}\right)\right)} \]
      24. log-powN/A

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right) \cdot \log a}\right)} \]
      25. lower-unsound-log.f64N/A

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) \cdot \color{blue}{\log a}\right)} \]
      26. lower-unsound-*.f64N/A

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right) \cdot \log a}\right)} \]
    7. Applied rewrites22.5%

      \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(0.5 \cdot g\right), 0.3333333333333333, -0.3333333333333333 \cdot \log a\right)}} \]

    if 2e-107 < (cbrt.f64 (/.f64 g (*.f64 #s(literal 2 binary64) a))) < 4.9999999999999998e98

    1. Initial program 75.4%

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

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

        \[\leadsto \sqrt[3]{\frac{g}{\color{blue}{a + a}}} \]
      3. lower-+.f6475.4%

        \[\leadsto \sqrt[3]{\frac{g}{\color{blue}{a + a}}} \]
    3. Applied rewrites75.4%

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

    if 4.9999999999999998e98 < (cbrt.f64 (/.f64 g (*.f64 #s(literal 2 binary64) a)))

    1. Initial program 75.4%

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

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

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

        \[\leadsto \color{blue}{e^{\log \left(\frac{g}{2 \cdot a}\right) \cdot \frac{1}{3}}} \]
      4. lower-unsound-exp.f64N/A

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

        \[\leadsto e^{\color{blue}{\log \left(\frac{g}{2 \cdot a}\right) \cdot \frac{1}{3}}} \]
      6. lower-unsound-log.f6436.2%

        \[\leadsto e^{\color{blue}{\log \left(\frac{g}{2 \cdot a}\right)} \cdot 0.3333333333333333} \]
      7. lift-*.f64N/A

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{2 \cdot a}}\right) \cdot \frac{1}{3}} \]
      8. count-2-revN/A

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot \frac{1}{3}} \]
      9. lower-+.f6436.2%

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot 0.3333333333333333} \]
    3. Applied rewrites36.2%

      \[\leadsto \color{blue}{e^{\log \left(\frac{g}{a + a}\right) \cdot 0.3333333333333333}} \]
    4. Step-by-step derivation
      1. lift-log.f64N/A

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

        \[\leadsto e^{\log \color{blue}{\left(\frac{g}{a + a}\right)} \cdot \frac{1}{3}} \]
      3. log-divN/A

        \[\leadsto e^{\color{blue}{\left(\log g - \log \left(a + a\right)\right)} \cdot \frac{1}{3}} \]
      4. lower-unsound--.f64N/A

        \[\leadsto e^{\color{blue}{\left(\log g - \log \left(a + a\right)\right)} \cdot \frac{1}{3}} \]
      5. lower-unsound-log.f64N/A

        \[\leadsto e^{\left(\color{blue}{\log g} - \log \left(a + a\right)\right) \cdot \frac{1}{3}} \]
      6. lower-unsound-log.f6422.5%

        \[\leadsto e^{\left(\log g - \color{blue}{\log \left(a + a\right)}\right) \cdot 0.3333333333333333} \]
    5. Applied rewrites22.5%

      \[\leadsto e^{\color{blue}{\left(\log g - \log \left(a + a\right)\right)} \cdot 0.3333333333333333} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

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

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

        \[\leadsto e^{\frac{1}{3} \cdot \color{blue}{\left(\log g - \log \left(a + a\right)\right)}} \]
      4. sub-flipN/A

        \[\leadsto e^{\frac{1}{3} \cdot \color{blue}{\left(\log g + \left(\mathsf{neg}\left(\log \left(a + a\right)\right)\right)\right)}} \]
      5. distribute-rgt-inN/A

        \[\leadsto e^{\color{blue}{\log g \cdot \frac{1}{3} + \left(\mathsf{neg}\left(\log \left(a + a\right)\right)\right) \cdot \frac{1}{3}}} \]
      6. fp-cancel-sub-signN/A

        \[\leadsto e^{\color{blue}{\log g \cdot \frac{1}{3} - \log \left(a + a\right) \cdot \frac{1}{3}}} \]
      7. lower--.f64N/A

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

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

        \[\leadsto e^{\color{blue}{\frac{1}{3} \cdot \log g} - \log \left(a + a\right) \cdot \frac{1}{3}} \]
      10. lower-*.f6422.4%

        \[\leadsto e^{0.3333333333333333 \cdot \log g - \color{blue}{\log \left(a + a\right) \cdot 0.3333333333333333}} \]
    7. Applied rewrites22.4%

      \[\leadsto e^{\color{blue}{0.3333333333333333 \cdot \log g - \log \left(a + a\right) \cdot 0.3333333333333333}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 96.4% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \left|a\right| + \left|a\right|\\ t_1 := \sqrt[3]{\frac{\left|g\right|}{2 \cdot \left|a\right|}}\\ \mathsf{copysign}\left(1, g\right) \cdot \left(\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq 2 \cdot 10^{-107}:\\ \;\;\;\;e^{\mathsf{fma}\left(\log \left(0.5 \cdot \left|g\right|\right), 0.3333333333333333, -0.3333333333333333 \cdot \log \left(\left|a\right|\right)\right)}\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+98}:\\ \;\;\;\;\sqrt[3]{\frac{\left|g\right|}{t\_0}}\\ \mathbf{else}:\\ \;\;\;\;e^{\left(\log \left(\left|g\right|\right) - \log t\_0\right) \cdot 0.3333333333333333}\\ \end{array}\right) \end{array} \]
(FPCore (g a)
 :precision binary64
 (let* ((t_0 (+ (fabs a) (fabs a))) (t_1 (cbrt (/ (fabs g) (* 2.0 (fabs a))))))
   (*
    (copysign 1.0 g)
    (*
     (copysign 1.0 a)
     (if (<= t_1 2e-107)
       (exp
        (fma
         (log (* 0.5 (fabs g)))
         0.3333333333333333
         (* -0.3333333333333333 (log (fabs a)))))
       (if (<= t_1 5e+98)
         (cbrt (/ (fabs g) t_0))
         (exp (* (- (log (fabs g)) (log t_0)) 0.3333333333333333))))))))
double code(double g, double a) {
	double t_0 = fabs(a) + fabs(a);
	double t_1 = cbrt((fabs(g) / (2.0 * fabs(a))));
	double tmp;
	if (t_1 <= 2e-107) {
		tmp = exp(fma(log((0.5 * fabs(g))), 0.3333333333333333, (-0.3333333333333333 * log(fabs(a)))));
	} else if (t_1 <= 5e+98) {
		tmp = cbrt((fabs(g) / t_0));
	} else {
		tmp = exp(((log(fabs(g)) - log(t_0)) * 0.3333333333333333));
	}
	return copysign(1.0, g) * (copysign(1.0, a) * tmp);
}
function code(g, a)
	t_0 = Float64(abs(a) + abs(a))
	t_1 = cbrt(Float64(abs(g) / Float64(2.0 * abs(a))))
	tmp = 0.0
	if (t_1 <= 2e-107)
		tmp = exp(fma(log(Float64(0.5 * abs(g))), 0.3333333333333333, Float64(-0.3333333333333333 * log(abs(a)))));
	elseif (t_1 <= 5e+98)
		tmp = cbrt(Float64(abs(g) / t_0));
	else
		tmp = exp(Float64(Float64(log(abs(g)) - log(t_0)) * 0.3333333333333333));
	end
	return Float64(copysign(1.0, g) * Float64(copysign(1.0, a) * tmp))
end
code[g_, a_] := Block[{t$95$0 = N[(N[Abs[a], $MachinePrecision] + N[Abs[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[Abs[g], $MachinePrecision] / N[(2.0 * N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[g]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$1, 2e-107], N[Exp[N[(N[Log[N[(0.5 * N[Abs[g], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.3333333333333333 + N[(-0.3333333333333333 * N[Log[N[Abs[a], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 5e+98], N[Power[N[(N[Abs[g], $MachinePrecision] / t$95$0), $MachinePrecision], 1/3], $MachinePrecision], N[Exp[N[(N[(N[Log[N[Abs[g], $MachinePrecision]], $MachinePrecision] - N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|a\right| + \left|a\right|\\
t_1 := \sqrt[3]{\frac{\left|g\right|}{2 \cdot \left|a\right|}}\\
\mathsf{copysign}\left(1, g\right) \cdot \left(\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-107}:\\
\;\;\;\;e^{\mathsf{fma}\left(\log \left(0.5 \cdot \left|g\right|\right), 0.3333333333333333, -0.3333333333333333 \cdot \log \left(\left|a\right|\right)\right)}\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+98}:\\
\;\;\;\;\sqrt[3]{\frac{\left|g\right|}{t\_0}}\\

\mathbf{else}:\\
\;\;\;\;e^{\left(\log \left(\left|g\right|\right) - \log t\_0\right) \cdot 0.3333333333333333}\\


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

    1. Initial program 75.4%

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

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

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

        \[\leadsto \color{blue}{e^{\log \left(\frac{g}{2 \cdot a}\right) \cdot \frac{1}{3}}} \]
      4. lower-unsound-exp.f64N/A

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

        \[\leadsto e^{\color{blue}{\log \left(\frac{g}{2 \cdot a}\right) \cdot \frac{1}{3}}} \]
      6. lower-unsound-log.f6436.2%

        \[\leadsto e^{\color{blue}{\log \left(\frac{g}{2 \cdot a}\right)} \cdot 0.3333333333333333} \]
      7. lift-*.f64N/A

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{2 \cdot a}}\right) \cdot \frac{1}{3}} \]
      8. count-2-revN/A

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot \frac{1}{3}} \]
      9. lower-+.f6436.2%

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot 0.3333333333333333} \]
    3. Applied rewrites36.2%

      \[\leadsto \color{blue}{e^{\log \left(\frac{g}{a + a}\right) \cdot 0.3333333333333333}} \]
    4. Step-by-step derivation
      1. lift-log.f64N/A

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

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

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot \frac{1}{3}} \]
      4. count-2N/A

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

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

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

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

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

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

        \[\leadsto e^{\left(\log \color{blue}{\left(\frac{1}{2} \cdot g\right)} - \log a\right) \cdot \frac{1}{3}} \]
      11. lower-unsound--.f64N/A

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

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

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

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

        \[\leadsto e^{\left(\log \color{blue}{\left(g \cdot \frac{1}{2}\right)} - \log a\right) \cdot \frac{1}{3}} \]
      16. lower-unsound-log.f6422.5%

        \[\leadsto e^{\left(\log \left(g \cdot 0.5\right) - \color{blue}{\log a}\right) \cdot 0.3333333333333333} \]
    5. Applied rewrites22.5%

      \[\leadsto e^{\color{blue}{\left(\log \left(g \cdot 0.5\right) - \log a\right)} \cdot 0.3333333333333333} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

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

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

        \[\leadsto e^{\frac{1}{3} \cdot \color{blue}{\left(\log \left(g \cdot \frac{1}{2}\right) - \log a\right)}} \]
      4. sub-flipN/A

        \[\leadsto e^{\frac{1}{3} \cdot \color{blue}{\left(\log \left(g \cdot \frac{1}{2}\right) + \left(\mathsf{neg}\left(\log a\right)\right)\right)}} \]
      5. distribute-lft-inN/A

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

        \[\leadsto e^{\color{blue}{\log \left(g \cdot \frac{1}{2}\right) \cdot \frac{1}{3}} + \frac{1}{3} \cdot \left(\mathsf{neg}\left(\log a\right)\right)} \]
      7. lower-fma.f64N/A

        \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(g \cdot \frac{1}{2}\right), \frac{1}{3}, \frac{1}{3} \cdot \left(\mathsf{neg}\left(\log a\right)\right)\right)}} \]
      8. lift-*.f64N/A

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

        \[\leadsto e^{\mathsf{fma}\left(\log \color{blue}{\left(\frac{1}{2} \cdot g\right)}, \frac{1}{3}, \frac{1}{3} \cdot \left(\mathsf{neg}\left(\log a\right)\right)\right)} \]
      10. lower-*.f64N/A

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

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

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

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

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \mathsf{neg}\left(\log \color{blue}{\left(\sqrt[3]{a}\right)}\right)\right)} \]
      15. log-recN/A

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

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \log \left(\frac{\color{blue}{\sqrt[3]{1}}}{\sqrt[3]{a}}\right)\right)} \]
      17. cbrt-divN/A

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \log \color{blue}{\left(\sqrt[3]{\frac{1}{a}}\right)}\right)} \]
      18. lift-/.f64N/A

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \log \left(\sqrt[3]{\color{blue}{\frac{1}{a}}}\right)\right)} \]
      19. lift-/.f64N/A

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

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

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \log \color{blue}{\left({a}^{\left(\frac{-1}{3}\right)}\right)}\right)} \]
      22. metadata-evalN/A

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

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \log \left({a}^{\color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right)}}\right)\right)} \]
      24. log-powN/A

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right) \cdot \log a}\right)} \]
      25. lower-unsound-log.f64N/A

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \left(\mathsf{neg}\left(\frac{1}{3}\right)\right) \cdot \color{blue}{\log a}\right)} \]
      26. lower-unsound-*.f64N/A

        \[\leadsto e^{\mathsf{fma}\left(\log \left(\frac{1}{2} \cdot g\right), \frac{1}{3}, \color{blue}{\left(\mathsf{neg}\left(\frac{1}{3}\right)\right) \cdot \log a}\right)} \]
    7. Applied rewrites22.5%

      \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \left(0.5 \cdot g\right), 0.3333333333333333, -0.3333333333333333 \cdot \log a\right)}} \]

    if 2e-107 < (cbrt.f64 (/.f64 g (*.f64 #s(literal 2 binary64) a))) < 4.9999999999999998e98

    1. Initial program 75.4%

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

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

        \[\leadsto \sqrt[3]{\frac{g}{\color{blue}{a + a}}} \]
      3. lower-+.f6475.4%

        \[\leadsto \sqrt[3]{\frac{g}{\color{blue}{a + a}}} \]
    3. Applied rewrites75.4%

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

    if 4.9999999999999998e98 < (cbrt.f64 (/.f64 g (*.f64 #s(literal 2 binary64) a)))

    1. Initial program 75.4%

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

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

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

        \[\leadsto \color{blue}{e^{\log \left(\frac{g}{2 \cdot a}\right) \cdot \frac{1}{3}}} \]
      4. lower-unsound-exp.f64N/A

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

        \[\leadsto e^{\color{blue}{\log \left(\frac{g}{2 \cdot a}\right) \cdot \frac{1}{3}}} \]
      6. lower-unsound-log.f6436.2%

        \[\leadsto e^{\color{blue}{\log \left(\frac{g}{2 \cdot a}\right)} \cdot 0.3333333333333333} \]
      7. lift-*.f64N/A

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{2 \cdot a}}\right) \cdot \frac{1}{3}} \]
      8. count-2-revN/A

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot \frac{1}{3}} \]
      9. lower-+.f6436.2%

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot 0.3333333333333333} \]
    3. Applied rewrites36.2%

      \[\leadsto \color{blue}{e^{\log \left(\frac{g}{a + a}\right) \cdot 0.3333333333333333}} \]
    4. Step-by-step derivation
      1. lift-log.f64N/A

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

        \[\leadsto e^{\log \color{blue}{\left(\frac{g}{a + a}\right)} \cdot \frac{1}{3}} \]
      3. log-divN/A

        \[\leadsto e^{\color{blue}{\left(\log g - \log \left(a + a\right)\right)} \cdot \frac{1}{3}} \]
      4. lower-unsound--.f64N/A

        \[\leadsto e^{\color{blue}{\left(\log g - \log \left(a + a\right)\right)} \cdot \frac{1}{3}} \]
      5. lower-unsound-log.f64N/A

        \[\leadsto e^{\left(\color{blue}{\log g} - \log \left(a + a\right)\right) \cdot \frac{1}{3}} \]
      6. lower-unsound-log.f6422.5%

        \[\leadsto e^{\left(\log g - \color{blue}{\log \left(a + a\right)}\right) \cdot 0.3333333333333333} \]
    5. Applied rewrites22.5%

      \[\leadsto e^{\color{blue}{\left(\log g - \log \left(a + a\right)\right)} \cdot 0.3333333333333333} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 96.4% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \sqrt[3]{\frac{\left|g\right|}{2 \cdot \left|a\right|}}\\ t_1 := \left|a\right| + \left|a\right|\\ \mathsf{copysign}\left(1, g\right) \cdot \left(\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq 2 \cdot 10^{-107}:\\ \;\;\;\;e^{\left(\log \left(\left|g\right| \cdot 0.5\right) - \log \left(\left|a\right|\right)\right) \cdot 0.3333333333333333}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+98}:\\ \;\;\;\;\sqrt[3]{\frac{\left|g\right|}{t\_1}}\\ \mathbf{else}:\\ \;\;\;\;e^{\left(\log \left(\left|g\right|\right) - \log t\_1\right) \cdot 0.3333333333333333}\\ \end{array}\right) \end{array} \]
(FPCore (g a)
 :precision binary64
 (let* ((t_0 (cbrt (/ (fabs g) (* 2.0 (fabs a))))) (t_1 (+ (fabs a) (fabs a))))
   (*
    (copysign 1.0 g)
    (*
     (copysign 1.0 a)
     (if (<= t_0 2e-107)
       (exp (* (- (log (* (fabs g) 0.5)) (log (fabs a))) 0.3333333333333333))
       (if (<= t_0 5e+98)
         (cbrt (/ (fabs g) t_1))
         (exp (* (- (log (fabs g)) (log t_1)) 0.3333333333333333))))))))
double code(double g, double a) {
	double t_0 = cbrt((fabs(g) / (2.0 * fabs(a))));
	double t_1 = fabs(a) + fabs(a);
	double tmp;
	if (t_0 <= 2e-107) {
		tmp = exp(((log((fabs(g) * 0.5)) - log(fabs(a))) * 0.3333333333333333));
	} else if (t_0 <= 5e+98) {
		tmp = cbrt((fabs(g) / t_1));
	} else {
		tmp = exp(((log(fabs(g)) - log(t_1)) * 0.3333333333333333));
	}
	return copysign(1.0, g) * (copysign(1.0, a) * tmp);
}
public static double code(double g, double a) {
	double t_0 = Math.cbrt((Math.abs(g) / (2.0 * Math.abs(a))));
	double t_1 = Math.abs(a) + Math.abs(a);
	double tmp;
	if (t_0 <= 2e-107) {
		tmp = Math.exp(((Math.log((Math.abs(g) * 0.5)) - Math.log(Math.abs(a))) * 0.3333333333333333));
	} else if (t_0 <= 5e+98) {
		tmp = Math.cbrt((Math.abs(g) / t_1));
	} else {
		tmp = Math.exp(((Math.log(Math.abs(g)) - Math.log(t_1)) * 0.3333333333333333));
	}
	return Math.copySign(1.0, g) * (Math.copySign(1.0, a) * tmp);
}
function code(g, a)
	t_0 = cbrt(Float64(abs(g) / Float64(2.0 * abs(a))))
	t_1 = Float64(abs(a) + abs(a))
	tmp = 0.0
	if (t_0 <= 2e-107)
		tmp = exp(Float64(Float64(log(Float64(abs(g) * 0.5)) - log(abs(a))) * 0.3333333333333333));
	elseif (t_0 <= 5e+98)
		tmp = cbrt(Float64(abs(g) / t_1));
	else
		tmp = exp(Float64(Float64(log(abs(g)) - log(t_1)) * 0.3333333333333333));
	end
	return Float64(copysign(1.0, g) * Float64(copysign(1.0, a) * tmp))
end
code[g_, a_] := Block[{t$95$0 = N[Power[N[(N[Abs[g], $MachinePrecision] / N[(2.0 * N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[a], $MachinePrecision] + N[Abs[a], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[g]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$0, 2e-107], N[Exp[N[(N[(N[Log[N[(N[Abs[g], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] - N[Log[N[Abs[a], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$0, 5e+98], N[Power[N[(N[Abs[g], $MachinePrecision] / t$95$1), $MachinePrecision], 1/3], $MachinePrecision], N[Exp[N[(N[(N[Log[N[Abs[g], $MachinePrecision]], $MachinePrecision] - N[Log[t$95$1], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \sqrt[3]{\frac{\left|g\right|}{2 \cdot \left|a\right|}}\\
t_1 := \left|a\right| + \left|a\right|\\
\mathsf{copysign}\left(1, g\right) \cdot \left(\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-107}:\\
\;\;\;\;e^{\left(\log \left(\left|g\right| \cdot 0.5\right) - \log \left(\left|a\right|\right)\right) \cdot 0.3333333333333333}\\

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+98}:\\
\;\;\;\;\sqrt[3]{\frac{\left|g\right|}{t\_1}}\\

\mathbf{else}:\\
\;\;\;\;e^{\left(\log \left(\left|g\right|\right) - \log t\_1\right) \cdot 0.3333333333333333}\\


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

    1. Initial program 75.4%

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

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

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

        \[\leadsto \color{blue}{e^{\log \left(\frac{g}{2 \cdot a}\right) \cdot \frac{1}{3}}} \]
      4. lower-unsound-exp.f64N/A

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

        \[\leadsto e^{\color{blue}{\log \left(\frac{g}{2 \cdot a}\right) \cdot \frac{1}{3}}} \]
      6. lower-unsound-log.f6436.2%

        \[\leadsto e^{\color{blue}{\log \left(\frac{g}{2 \cdot a}\right)} \cdot 0.3333333333333333} \]
      7. lift-*.f64N/A

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{2 \cdot a}}\right) \cdot \frac{1}{3}} \]
      8. count-2-revN/A

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot \frac{1}{3}} \]
      9. lower-+.f6436.2%

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot 0.3333333333333333} \]
    3. Applied rewrites36.2%

      \[\leadsto \color{blue}{e^{\log \left(\frac{g}{a + a}\right) \cdot 0.3333333333333333}} \]
    4. Step-by-step derivation
      1. lift-log.f64N/A

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

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

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot \frac{1}{3}} \]
      4. count-2N/A

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

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

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

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

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

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

        \[\leadsto e^{\left(\log \color{blue}{\left(\frac{1}{2} \cdot g\right)} - \log a\right) \cdot \frac{1}{3}} \]
      11. lower-unsound--.f64N/A

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

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

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

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

        \[\leadsto e^{\left(\log \color{blue}{\left(g \cdot \frac{1}{2}\right)} - \log a\right) \cdot \frac{1}{3}} \]
      16. lower-unsound-log.f6422.5%

        \[\leadsto e^{\left(\log \left(g \cdot 0.5\right) - \color{blue}{\log a}\right) \cdot 0.3333333333333333} \]
    5. Applied rewrites22.5%

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

    if 2e-107 < (cbrt.f64 (/.f64 g (*.f64 #s(literal 2 binary64) a))) < 4.9999999999999998e98

    1. Initial program 75.4%

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

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

        \[\leadsto \sqrt[3]{\frac{g}{\color{blue}{a + a}}} \]
      3. lower-+.f6475.4%

        \[\leadsto \sqrt[3]{\frac{g}{\color{blue}{a + a}}} \]
    3. Applied rewrites75.4%

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

    if 4.9999999999999998e98 < (cbrt.f64 (/.f64 g (*.f64 #s(literal 2 binary64) a)))

    1. Initial program 75.4%

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

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

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

        \[\leadsto \color{blue}{e^{\log \left(\frac{g}{2 \cdot a}\right) \cdot \frac{1}{3}}} \]
      4. lower-unsound-exp.f64N/A

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

        \[\leadsto e^{\color{blue}{\log \left(\frac{g}{2 \cdot a}\right) \cdot \frac{1}{3}}} \]
      6. lower-unsound-log.f6436.2%

        \[\leadsto e^{\color{blue}{\log \left(\frac{g}{2 \cdot a}\right)} \cdot 0.3333333333333333} \]
      7. lift-*.f64N/A

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{2 \cdot a}}\right) \cdot \frac{1}{3}} \]
      8. count-2-revN/A

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot \frac{1}{3}} \]
      9. lower-+.f6436.2%

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot 0.3333333333333333} \]
    3. Applied rewrites36.2%

      \[\leadsto \color{blue}{e^{\log \left(\frac{g}{a + a}\right) \cdot 0.3333333333333333}} \]
    4. Step-by-step derivation
      1. lift-log.f64N/A

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

        \[\leadsto e^{\log \color{blue}{\left(\frac{g}{a + a}\right)} \cdot \frac{1}{3}} \]
      3. log-divN/A

        \[\leadsto e^{\color{blue}{\left(\log g - \log \left(a + a\right)\right)} \cdot \frac{1}{3}} \]
      4. lower-unsound--.f64N/A

        \[\leadsto e^{\color{blue}{\left(\log g - \log \left(a + a\right)\right)} \cdot \frac{1}{3}} \]
      5. lower-unsound-log.f64N/A

        \[\leadsto e^{\left(\color{blue}{\log g} - \log \left(a + a\right)\right) \cdot \frac{1}{3}} \]
      6. lower-unsound-log.f6422.5%

        \[\leadsto e^{\left(\log g - \color{blue}{\log \left(a + a\right)}\right) \cdot 0.3333333333333333} \]
    5. Applied rewrites22.5%

      \[\leadsto e^{\color{blue}{\left(\log g - \log \left(a + a\right)\right)} \cdot 0.3333333333333333} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 96.3% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \left|a\right| + \left|a\right|\\ t_1 := e^{\left(\log \left(\left|g\right|\right) - \log t\_0\right) \cdot 0.3333333333333333}\\ t_2 := \sqrt[3]{\frac{\left|g\right|}{2 \cdot \left|a\right|}}\\ \mathsf{copysign}\left(1, g\right) \cdot \left(\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l} \mathbf{if}\;t\_2 \leq 2 \cdot 10^{-107}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+98}:\\ \;\;\;\;\sqrt[3]{\frac{\left|g\right|}{t\_0}}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array}\right) \end{array} \]
(FPCore (g a)
 :precision binary64
 (let* ((t_0 (+ (fabs a) (fabs a)))
        (t_1 (exp (* (- (log (fabs g)) (log t_0)) 0.3333333333333333)))
        (t_2 (cbrt (/ (fabs g) (* 2.0 (fabs a))))))
   (*
    (copysign 1.0 g)
    (*
     (copysign 1.0 a)
     (if (<= t_2 2e-107)
       t_1
       (if (<= t_2 5e+98) (cbrt (/ (fabs g) t_0)) t_1))))))
double code(double g, double a) {
	double t_0 = fabs(a) + fabs(a);
	double t_1 = exp(((log(fabs(g)) - log(t_0)) * 0.3333333333333333));
	double t_2 = cbrt((fabs(g) / (2.0 * fabs(a))));
	double tmp;
	if (t_2 <= 2e-107) {
		tmp = t_1;
	} else if (t_2 <= 5e+98) {
		tmp = cbrt((fabs(g) / t_0));
	} else {
		tmp = t_1;
	}
	return copysign(1.0, g) * (copysign(1.0, a) * tmp);
}
public static double code(double g, double a) {
	double t_0 = Math.abs(a) + Math.abs(a);
	double t_1 = Math.exp(((Math.log(Math.abs(g)) - Math.log(t_0)) * 0.3333333333333333));
	double t_2 = Math.cbrt((Math.abs(g) / (2.0 * Math.abs(a))));
	double tmp;
	if (t_2 <= 2e-107) {
		tmp = t_1;
	} else if (t_2 <= 5e+98) {
		tmp = Math.cbrt((Math.abs(g) / t_0));
	} else {
		tmp = t_1;
	}
	return Math.copySign(1.0, g) * (Math.copySign(1.0, a) * tmp);
}
function code(g, a)
	t_0 = Float64(abs(a) + abs(a))
	t_1 = exp(Float64(Float64(log(abs(g)) - log(t_0)) * 0.3333333333333333))
	t_2 = cbrt(Float64(abs(g) / Float64(2.0 * abs(a))))
	tmp = 0.0
	if (t_2 <= 2e-107)
		tmp = t_1;
	elseif (t_2 <= 5e+98)
		tmp = cbrt(Float64(abs(g) / t_0));
	else
		tmp = t_1;
	end
	return Float64(copysign(1.0, g) * Float64(copysign(1.0, a) * tmp))
end
code[g_, a_] := Block[{t$95$0 = N[(N[Abs[a], $MachinePrecision] + N[Abs[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(N[Log[N[Abs[g], $MachinePrecision]], $MachinePrecision] - N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(N[Abs[g], $MachinePrecision] / N[(2.0 * N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[g]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$2, 2e-107], t$95$1, If[LessEqual[t$95$2, 5e+98], N[Power[N[(N[Abs[g], $MachinePrecision] / t$95$0), $MachinePrecision], 1/3], $MachinePrecision], t$95$1]]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left|a\right| + \left|a\right|\\
t_1 := e^{\left(\log \left(\left|g\right|\right) - \log t\_0\right) \cdot 0.3333333333333333}\\
t_2 := \sqrt[3]{\frac{\left|g\right|}{2 \cdot \left|a\right|}}\\
\mathsf{copysign}\left(1, g\right) \cdot \left(\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq 2 \cdot 10^{-107}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+98}:\\
\;\;\;\;\sqrt[3]{\frac{\left|g\right|}{t\_0}}\\

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


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (cbrt.f64 (/.f64 g (*.f64 #s(literal 2 binary64) a))) < 2e-107 or 4.9999999999999998e98 < (cbrt.f64 (/.f64 g (*.f64 #s(literal 2 binary64) a)))

    1. Initial program 75.4%

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

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

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

        \[\leadsto \color{blue}{e^{\log \left(\frac{g}{2 \cdot a}\right) \cdot \frac{1}{3}}} \]
      4. lower-unsound-exp.f64N/A

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

        \[\leadsto e^{\color{blue}{\log \left(\frac{g}{2 \cdot a}\right) \cdot \frac{1}{3}}} \]
      6. lower-unsound-log.f6436.2%

        \[\leadsto e^{\color{blue}{\log \left(\frac{g}{2 \cdot a}\right)} \cdot 0.3333333333333333} \]
      7. lift-*.f64N/A

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{2 \cdot a}}\right) \cdot \frac{1}{3}} \]
      8. count-2-revN/A

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot \frac{1}{3}} \]
      9. lower-+.f6436.2%

        \[\leadsto e^{\log \left(\frac{g}{\color{blue}{a + a}}\right) \cdot 0.3333333333333333} \]
    3. Applied rewrites36.2%

      \[\leadsto \color{blue}{e^{\log \left(\frac{g}{a + a}\right) \cdot 0.3333333333333333}} \]
    4. Step-by-step derivation
      1. lift-log.f64N/A

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

        \[\leadsto e^{\log \color{blue}{\left(\frac{g}{a + a}\right)} \cdot \frac{1}{3}} \]
      3. log-divN/A

        \[\leadsto e^{\color{blue}{\left(\log g - \log \left(a + a\right)\right)} \cdot \frac{1}{3}} \]
      4. lower-unsound--.f64N/A

        \[\leadsto e^{\color{blue}{\left(\log g - \log \left(a + a\right)\right)} \cdot \frac{1}{3}} \]
      5. lower-unsound-log.f64N/A

        \[\leadsto e^{\left(\color{blue}{\log g} - \log \left(a + a\right)\right) \cdot \frac{1}{3}} \]
      6. lower-unsound-log.f6422.5%

        \[\leadsto e^{\left(\log g - \color{blue}{\log \left(a + a\right)}\right) \cdot 0.3333333333333333} \]
    5. Applied rewrites22.5%

      \[\leadsto e^{\color{blue}{\left(\log g - \log \left(a + a\right)\right)} \cdot 0.3333333333333333} \]

    if 2e-107 < (cbrt.f64 (/.f64 g (*.f64 #s(literal 2 binary64) a))) < 4.9999999999999998e98

    1. Initial program 75.4%

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

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

        \[\leadsto \sqrt[3]{\frac{g}{\color{blue}{a + a}}} \]
      3. lower-+.f6475.4%

        \[\leadsto \sqrt[3]{\frac{g}{\color{blue}{a + a}}} \]
    3. Applied rewrites75.4%

      \[\leadsto \color{blue}{\sqrt[3]{\frac{g}{a + a}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 75.4% accurate, 1.0× speedup?

\[\sqrt[3]{\frac{g}{a + a}} \]
(FPCore (g a) :precision binary64 (cbrt (/ g (+ a a))))
double code(double g, double a) {
	return cbrt((g / (a + a)));
}
public static double code(double g, double a) {
	return Math.cbrt((g / (a + a)));
}
function code(g, a)
	return cbrt(Float64(g / Float64(a + a)))
end
code[g_, a_] := N[Power[N[(g / N[(a + a), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]
\sqrt[3]{\frac{g}{a + a}}
Derivation
  1. Initial program 75.4%

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

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

      \[\leadsto \sqrt[3]{\frac{g}{\color{blue}{a + a}}} \]
    3. lower-+.f6475.4%

      \[\leadsto \sqrt[3]{\frac{g}{\color{blue}{a + a}}} \]
  3. Applied rewrites75.4%

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

Reproduce

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