\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 -3.6722565929769024 \cdot 10^{-188}:\\
\;\;\;\;\frac{\sqrt[3]{\sqrt{g \cdot g - h \cdot h} - g}}{\sqrt[3]{a \cdot 2}} + \frac{\sqrt[3]{g - 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}} + \frac{\sqrt[3]{\left(-g\right) - g}}{\sqrt[3]{a \cdot 2}}\\
\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 -3.6722565929769024e-188)
(+
(/ (cbrt (- (sqrt (- (* g g) (* h h))) g)) (cbrt (* a 2.0)))
(/ (cbrt (- g g)) (cbrt (* a 2.0))))
(+
(cbrt (* (- (sqrt (- (* g g) (* h h))) g) (/ 1.0 (* a 2.0))))
(/ (cbrt (- (- g) g)) (cbrt (* a 2.0))))))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 <= -3.6722565929769024e-188) {
tmp = (cbrt(sqrt((g * g) - (h * h)) - g) / cbrt(a * 2.0)) + (cbrt(g - g) / cbrt(a * 2.0));
} else {
tmp = cbrt((sqrt((g * g) - (h * h)) - g) * (1.0 / (a * 2.0))) + (cbrt(-g - g) / cbrt(a * 2.0));
}
return tmp;
}











Bits error versus g











Bits error versus h











Bits error versus a
Results
| Alternative 1 | |
|---|---|
| Error | 32.2 |
| Cost | 40192 |
| Alternative 2 | |
|---|---|
| Error | 33.6 |
| Cost | 27457 |
| Alternative 3 | |
|---|---|
| Error | 34.3 |
| Cost | 27457 |
| Alternative 4 | |
|---|---|
| Error | 36.2 |
| Cost | 21121 |
| Alternative 5 | |
|---|---|
| Error | 36.2 |
| Cost | 21121 |
| Alternative 6 | |
|---|---|
| Error | 49.4 |
| Cost | 20800 |
| Alternative 7 | |
|---|---|
| Error | 61.1 |
| Cost | 64 |
| Alternative 8 | |
|---|---|
| Error | 61.2 |
| Cost | 64 |

if g < -3.67225659297690243e-188Initial program 35.5
rmApplied associate-*l/_binary64_547735.5
Applied cbrt-div_binary64_556635.4
Simplified35.4
rmApplied associate-*l/_binary64_547735.4
Applied cbrt-div_binary64_556631.5
Simplified31.5
Taylor expanded around -inf 31.8
Simplified31.8
Simplified31.8
if -3.67225659297690243e-188 < g Initial program 36.5
rmApplied associate-*l/_binary64_547736.5
Applied cbrt-div_binary64_556632.8
Simplified32.8
Taylor expanded around inf 31.7
Simplified31.7
Final simplification31.7
herbie shell --seed 2021044
(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))))))))