Average Error: 35.4 → 31.6
Time: 2.2m
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 -8.646935183303432 \cdot 10^{-243}:\\ \;\;\;\;\sqrt[3]{\frac{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}{a \cdot 2}} + \sqrt[3]{\left(-g\right) - g} \cdot \sqrt[3]{\frac{1}{a \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\frac{\left(\sqrt[3]{\sqrt{\left(g + h\right) \cdot \left(g - h\right)}} \cdot \sqrt[3]{\sqrt{\left(g + h\right) \cdot \left(g - h\right)}}\right) \cdot \sqrt[3]{\sqrt{\left(g + h\right) \cdot \left(g - h\right)}} - g}{2}} + \sqrt[3]{\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}} \cdot \sqrt[3]{\frac{1}{a \cdot 2}}\\ \end{array}\]

Error

Bits error versus g

Bits error versus h

Bits error versus a

Derivation

  1. Split input into 2 regimes
  2. if (- (- g) (sqrt (* (- g h) (+ h g)))) < -8.646935183303432e-243

    1. Initial program 43.6

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

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

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

      \[\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. Taylor expanded around inf 41.0

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

    if -8.646935183303432e-243 < (- (- g) (sqrt (* (- g h) (+ h g))))

    1. Initial program 14.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 simplify14.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 div-inv14.9

      \[\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-prod14.6

      \[\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 *-un-lft-identity14.6

      \[\leadsto \sqrt[3]{\frac{\color{blue}{1 \cdot \left(\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g\right)}}{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 times-frac14.5

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

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

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

Runtime

Time bar (total: 2.2m)Debug logProfile

herbie shell --seed '#(1071246582 2318319007 2683472949 3810440501 3233274817 2724848749)' 
(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))))))))