\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}\begin{array}{l}
\mathbf{if}\;g \leq -1.7876443121533805 \cdot 10^{-142}:\\
\;\;\;\;\sqrt[3]{\left(g + \sqrt{g \cdot g - h \cdot h}\right) \cdot \frac{-1}{a \cdot 2}} + \frac{\sqrt[3]{\sqrt{g \cdot g - h \cdot h} - g}}{\sqrt[3]{a \cdot 2}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\left(\sqrt{g \cdot g - h \cdot h} - g\right) \cdot \frac{1}{a \cdot 2}} + \sqrt[3]{\frac{0.5}{a}} \cdot \sqrt[3]{\left(-g\right) - g}\\
\end{array}(FPCore (g h a) :precision binary64 (+ (cbrt (* (/ 1.0 (* 2.0 a)) (+ (- g) (sqrt (- (* g g) (* h h)))))) (cbrt (* (/ 1.0 (* 2.0 a)) (- (- g) (sqrt (- (* g g) (* h h))))))))
(FPCore (g h a)
:precision binary64
(if (<= g -1.7876443121533805e-142)
(+
(cbrt (* (+ g (sqrt (- (* g g) (* h h)))) (/ -1.0 (* a 2.0))))
(/ (cbrt (- (sqrt (- (* g g) (* h h))) g)) (cbrt (* a 2.0))))
(+
(cbrt (* (- (sqrt (- (* g g) (* h h))) g) (/ 1.0 (* a 2.0))))
(* (cbrt (/ 0.5 a)) (cbrt (- (- g) g))))))double code(double g, double h, double a) {
return cbrt((1.0 / (2.0 * a)) * (-g + sqrt((g * g) - (h * h)))) + cbrt((1.0 / (2.0 * a)) * (-g - sqrt((g * g) - (h * h))));
}
double code(double g, double h, double a) {
double tmp;
if (g <= -1.7876443121533805e-142) {
tmp = cbrt((g + sqrt((g * g) - (h * h))) * (-1.0 / (a * 2.0))) + (cbrt(sqrt((g * g) - (h * h)) - g) / cbrt(a * 2.0));
} else {
tmp = cbrt((sqrt((g * g) - (h * h)) - g) * (1.0 / (a * 2.0))) + (cbrt(0.5 / a) * cbrt(-g - g));
}
return tmp;
}










Bits error versus g










Bits error versus h










Bits error versus a
Results
| Alternative 1 | |
|---|---|
| Error | 32.4 |
| Cost | 34177 |
| Alternative 2 | |
|---|---|
| Error | 32.4 |
| Cost | 34177 |
| Alternative 3 | |
|---|---|
| Error | 32.7 |
| Cost | 67586 |
| Alternative 4 | |
|---|---|
| Error | 32.7 |
| Cost | 67586 |
| Alternative 5 | |
|---|---|
| Error | 34.7 |
| Cost | 74369 |
| Alternative 6 | |
|---|---|
| Error | 34.7 |
| Cost | 74369 |
| Alternative 7 | |
|---|---|
| Error | 36.8 |
| Cost | 74048 |

if g < -1.787644312153381e-142Initial program 35.5
rmApplied associate-*l/_binary64_343135.5
Applied cbrt-div_binary64_352031.9
Simplified31.9
Simplified31.9
if -1.787644312153381e-142 < g Initial program 37.5
rmApplied cbrt-prod_binary64_351933.8
Simplified33.8
Taylor expanded around inf 32.8
Simplified32.8
Final simplification32.4
herbie shell --seed 2021043
(FPCore (g h a)
:name "2-ancestry mixing, positive discriminant"
:precision binary64
(+ (cbrt (* (/ 1.0 (* 2.0 a)) (+ (- g) (sqrt (- (* g g) (* h h)))))) (cbrt (* (/ 1.0 (* 2.0 a)) (- (- g) (sqrt (- (* g g) (* h h))))))))