Average Error: 35.1 → 31.5
Time: 2.5m
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]{\frac{\sqrt{\left(g - h\right) \cdot \left(h + g\right)} - g}{a \cdot 2}} + {\left(\frac{\left(-g\right) - \sqrt{\left(g - h\right) \cdot \left(h + g\right)}}{a \cdot 2}\right)}^{\frac{1}{3}} \le 9.881653958554104 \cdot 10^{-107}:\\ \;\;\;\;\sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\frac{\left(h - g\right) - g}{2}} + \sqrt[3]{\frac{\left(-g\right) - \sqrt{\left(g - h\right) \cdot \left(h + g\right)}}{a \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{\sqrt{\left(g - h\right) \cdot \left(h + g\right)} - g}{a \cdot 2}} + \sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\frac{\left(-g\right) - \sqrt{\left(g - h\right) \cdot \left(h + g\right)}}{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 (+ (cbrt (/ (- (sqrt (* (- g h) (+ h g))) g) (* a 2))) (pow (/ (- (- g) (sqrt (* (- g h) (+ h g)))) (* a 2)) 1/3)) < 9.881653958554104e-107

    1. Initial program 20.4

      \[\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 simplify20.4

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

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

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

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

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

    if 9.881653958554104e-107 < (+ (cbrt (/ (- (sqrt (* (- g h) (+ h g))) g) (* a 2))) (pow (/ (- (- g) (sqrt (* (- g h) (+ h g)))) (* a 2)) 1/3))

    1. Initial program 37.8

      \[\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 simplify37.8

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

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

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

      \[\leadsto \sqrt[3]{\frac{\sqrt{\left(g - h\right) \cdot \left(h + g\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(h + g\right)}}{2}}}\]
  3. Recombined 2 regimes into one program.

Runtime

Time bar (total: 2.5m)Debug logProfile

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