Average Error: 34.3 → 30.0
Time: 1.7m
Precision: 64
Internal Precision: 128
\[\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}\;g \le -1.7619105514034057 \cdot 10^{-159}:\\ \;\;\;\;\sqrt[3]{\frac{\sqrt{\left(g - h\right) \cdot \left(g + h\right)} - g}{2}} \cdot \sqrt[3]{\frac{1}{a}} + 0 \cdot \sqrt[3]{\frac{\frac{-1}{2}}{a}}\\ \mathbf{elif}\;g \le 1.0714960641383543 \cdot 10^{-164}:\\ \;\;\;\;\sqrt[3]{\frac{\sqrt{\left(g - h\right) \cdot \left(g + h\right)} - g}{a \cdot 2}} + \sqrt[3]{g + g} \cdot \sqrt[3]{\frac{\frac{-1}{2}}{a}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{\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}{g + \sqrt{\left(g - h\right) \cdot \left(g + h\right)}}}{a \cdot 2}} + \sqrt[3]{g + \sqrt{\left(g - h\right) \cdot \left(g + h\right)}} \cdot \sqrt[3]{\frac{\frac{-1}{2}}{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 g < -1.7619105514034057e-159

    1. Initial program 33.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. Initial simplification33.1

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

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

      \[\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]{\frac{\frac{-1}{2}}{a}} \cdot \sqrt[3]{g + \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}\]
    7. Applied times-frac33.1

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

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

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

    if -1.7619105514034057e-159 < g < 1.0714960641383543e-164

    1. Initial program 54.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. Initial simplification54.3

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

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

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

    if 1.0714960641383543e-164 < g

    1. Initial program 33.0

      \[\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. Initial simplification32.9

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

      \[\leadsto \sqrt[3]{\frac{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}{a \cdot 2}} + \color{blue}{\sqrt[3]{\frac{\frac{-1}{2}}{a}} \cdot \sqrt[3]{g + \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}}\]
    5. Using strategy rm
    6. Applied flip--29.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]{\frac{\frac{-1}{2}}{a}} \cdot \sqrt[3]{g + \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification30.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;g \le -1.7619105514034057 \cdot 10^{-159}:\\ \;\;\;\;\sqrt[3]{\frac{\sqrt{\left(g - h\right) \cdot \left(g + h\right)} - g}{2}} \cdot \sqrt[3]{\frac{1}{a}} + 0 \cdot \sqrt[3]{\frac{\frac{-1}{2}}{a}}\\ \mathbf{elif}\;g \le 1.0714960641383543 \cdot 10^{-164}:\\ \;\;\;\;\sqrt[3]{\frac{\sqrt{\left(g - h\right) \cdot \left(g + h\right)} - g}{a \cdot 2}} + \sqrt[3]{g + g} \cdot \sqrt[3]{\frac{\frac{-1}{2}}{a}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{\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}{g + \sqrt{\left(g - h\right) \cdot \left(g + h\right)}}}{a \cdot 2}} + \sqrt[3]{g + \sqrt{\left(g - h\right) \cdot \left(g + h\right)}} \cdot \sqrt[3]{\frac{\frac{-1}{2}}{a}}\\ \end{array}\]

Runtime

Time bar (total: 1.7m)Debug logProfile

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