Average Error: 35.5 → 31.8
Time: 2.3m
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}\;\left(-g\right) - \sqrt{\left(g - h\right) \cdot \left(h + g\right)} \le -4.4648017124818324 \cdot 10^{-166}:\\ \;\;\;\;\sqrt[3]{\frac{\frac{\left(h + g\right) \cdot \left(g - h\right) - g \cdot g}{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} + g}}{a \cdot 2}} + \sqrt[3]{\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}} \cdot \sqrt[3]{\frac{1}{a \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g} \cdot \sqrt[3]{\frac{1}{a \cdot 2}} + \sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\frac{\frac{\left(h - g\right) \cdot \left(g + h\right) + g \cdot g}{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}}{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 2 regimes
  2. if (- (- g) (sqrt (* (- g h) (+ h g)))) < -4.4648017124818324e-166

    1. Initial program 43.5

      \[\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.5

      \[\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 div-inv43.5

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

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

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

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

    if -4.4648017124818324e-166 < (- (- g) (sqrt (* (- g h) (+ h g))))

    1. Initial program 16.7

      \[\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 simplify16.7

      \[\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-identity16.7

      \[\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-frac16.7

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

      \[\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. Using strategy rm
    8. Applied div-inv16.2

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

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

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

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

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

Runtime

Time bar (total: 2.3m)Debug logProfile

herbie shell --seed 2018166 
(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))))))))