Average Error: 34.8 → 30.2
Time: 2.8m
Precision: 64
Internal Precision: 576
\[\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}\;\sqrt[3]{0} + \sqrt[3]{\frac{\sqrt{\left(g - h\right) \cdot \left(g + h\right)} - g}{2}} \cdot \sqrt[3]{\frac{1}{a}} \le -3.7447113182156726 \cdot 10^{-134}:\\ \;\;\;\;\frac{\sqrt[3]{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}}{\sqrt[3]{a \cdot 2}} + \sqrt[3]{\frac{\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}{a \cdot 2}}\\ \mathbf{if}\;\sqrt[3]{0} + \sqrt[3]{\frac{\sqrt{\left(g - h\right) \cdot \left(g + h\right)} - g}{2}} \cdot \sqrt[3]{\frac{1}{a}} \le 6.910886318754606 \cdot 10^{-112}:\\ \;\;\;\;\sqrt[3]{\frac{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}{a \cdot 2}} + \sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\frac{\left(-g\right) - g}{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}}{\sqrt[3]{a \cdot 2}} + \sqrt[3]{\frac{\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}{a \cdot 2}}\\ \end{array}\]

Error

Bits error versus g

Bits error versus h

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if (+ (cbrt 0) (* (cbrt (/ (- (sqrt (* (- g h) (+ g h))) g) 2)) (cbrt (/ 1 a)))) < -3.7447113182156726e-134

    1. Initial program 43.3

      \[\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)}\]
    2. Applied simplify43.2

      \[\leadsto \color{blue}{\sqrt[3]{\frac{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}{a \cdot 2}} + \sqrt[3]{\frac{\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}{a \cdot 2}}}\]
    3. Using strategy rm
    4. Applied cbrt-div40.6

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}}{\sqrt[3]{a \cdot 2}}} + \sqrt[3]{\frac{\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}{a \cdot 2}}\]

    if -3.7447113182156726e-134 < (+ (cbrt 0) (* (cbrt (/ (- (sqrt (* (- g h) (+ g h))) g) 2)) (cbrt (/ 1 a)))) < 6.910886318754606e-112

    1. Initial program 13.1

      \[\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)}\]
    2. Applied simplify13.1

      \[\leadsto \color{blue}{\sqrt[3]{\frac{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}{a \cdot 2}} + \sqrt[3]{\frac{\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}{a \cdot 2}}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity13.1

      \[\leadsto \sqrt[3]{\frac{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}{a \cdot 2}} + \sqrt[3]{\frac{\color{blue}{1 \cdot \left(\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}\right)}}{a \cdot 2}}\]
    5. Applied times-frac13.1

      \[\leadsto \sqrt[3]{\frac{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}{a \cdot 2}} + \sqrt[3]{\color{blue}{\frac{1}{a} \cdot \frac{\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}{2}}}\]
    6. Applied cbrt-prod5.9

      \[\leadsto \sqrt[3]{\frac{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}{a \cdot 2}} + \color{blue}{\sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\frac{\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}{2}}}\]
    7. Taylor expanded around inf 2.1

      \[\leadsto \sqrt[3]{\frac{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}{a \cdot 2}} + \sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\frac{\left(-g\right) - \color{blue}{g}}{2}}\]

    if 6.910886318754606e-112 < (+ (cbrt 0) (* (cbrt (/ (- (sqrt (* (- g h) (+ g h))) g) 2)) (cbrt (/ 1 a))))

    1. Initial program 41.9

      \[\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)}\]
    2. Applied simplify41.9

      \[\leadsto \color{blue}{\sqrt[3]{\frac{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}{a \cdot 2}} + \sqrt[3]{\frac{\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}{a \cdot 2}}}\]
    3. Using strategy rm
    4. Applied cbrt-div40.1

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}}{\sqrt[3]{a \cdot 2}}} + \sqrt[3]{\frac{\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}{a \cdot 2}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 2.8m)Debug logProfile

herbie shell --seed 2018199 
(FPCore (g h a)
  :name "2-ancestry mixing, positive discriminant"
  (+ (cbrt (* (/ 1 (* 2 a)) (+ (- g) (sqrt (- (* g g) (* h h)))))) (cbrt (* (/ 1 (* 2 a)) (- (- g) (sqrt (- (* g g) (* h h))))))))