Average Error: 34.8 → 30.9
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}\;\sqrt[3]{0} + \sqrt[3]{\frac{1}{2 \cdot a}} \cdot \sqrt[3]{\sqrt{\left(h + g\right) \cdot \left(g - h\right)} - g} \le -3.123027187196015 \cdot 10^{-165}:\\ \;\;\;\;\sqrt[3]{\frac{\frac{1}{a}}{2}} \cdot \sqrt[3]{-\left(g + g\right)} + \sqrt[3]{\frac{\left(-g\right) - \sqrt{\left(h + g\right) \cdot \left(g - h\right)}}{2 \cdot a}}\\ \mathbf{if}\;\sqrt[3]{0} + \sqrt[3]{\frac{1}{2 \cdot a}} \cdot \sqrt[3]{\sqrt{\left(h + g\right) \cdot \left(g - h\right)} - g} \le 3.151952907543348 \cdot 10^{-174}:\\ \;\;\;\;\sqrt[3]{\frac{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}{a \cdot 2}} + \frac{\sqrt[3]{\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}}{\sqrt[3]{a \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{-\left(g + g\right)}}{\sqrt[3]{2 \cdot a}} + \sqrt[3]{\frac{\left(-g\right) - \sqrt{\left(g - h\right) \cdot \left(h + g\right)}}{2 \cdot a}}\\ \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 (/ 1 (* 2 a))) (cbrt (- (sqrt (* (+ h g) (- g h))) g)))) < -3.123027187196015e-165

    1. Initial program 43.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 simplify43.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 div-inv43.1

      \[\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{\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}{a \cdot 2}}\]
    5. Applied cbrt-prod40.3

      \[\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{\left(-g\right) - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}{a \cdot 2}}\]
    6. Taylor expanded around -inf 40.0

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

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

    if -3.123027187196015e-165 < (+ (cbrt 0) (* (cbrt (/ 1 (* 2 a))) (cbrt (- (sqrt (* (+ h g) (- g h))) g)))) < 3.151952907543348e-174

    1. Initial program 8.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 simplify8.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-div2.0

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

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

    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 cbrt-div41.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}}\]
    5. Taylor expanded around -inf 40.7

      \[\leadsto \frac{\sqrt[3]{\color{blue}{-1 \cdot g} - 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}}\]
    6. Applied simplify40.7

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

Runtime

Time bar (total: 2.2m)Debug logProfile

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