Average Error: 34.6 → 31.2
Time: 53.3s
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.590581472858523 \cdot 10^{-162}:\\ \;\;\;\;\frac{\sqrt[3]{\sqrt{\left(h + g\right) \cdot \left(g - h\right)} - g}}{\sqrt[3]{2 \cdot a}} + \frac{\sqrt[3]{h \cdot h}}{\sqrt[3]{\left(2 \cdot a\right) \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{\frac{1}{2}}{a}} \cdot \sqrt[3]{\left(-g\right) - \sqrt{\sqrt[3]{g \cdot g - h \cdot h}} \cdot \left|\sqrt[3]{g \cdot g - h \cdot h}\right|}\\ \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 < -1.590581472858523e-162

    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. Using strategy rm
    3. Applied associate-*l/33.0

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

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

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

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

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

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

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

    if -1.590581472858523e-162 < g

    1. Initial program 35.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. Using strategy rm
    3. Applied cbrt-prod32.2

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;g \le -1.590581472858523 \cdot 10^{-162}:\\ \;\;\;\;\frac{\sqrt[3]{\sqrt{\left(h + g\right) \cdot \left(g - h\right)} - g}}{\sqrt[3]{2 \cdot a}} + \frac{\sqrt[3]{h \cdot h}}{\sqrt[3]{\left(2 \cdot a\right) \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{\frac{1}{2}}{a}} \cdot \sqrt[3]{\left(-g\right) - \sqrt{\sqrt[3]{g \cdot g - h \cdot h}} \cdot \left|\sqrt[3]{g \cdot g - h \cdot h}\right|}\\ \end{array}\]

Reproduce

herbie shell --seed 2019005 +o rules:numerics
(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))))))))

Details

Time bar (total: 49.9s)Debug log

sample598.0ms

Algorithm
intervals

simplify380.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

379.0ms
(+ (cbrt (* (/ 1 (* 2 a)) (+ (- g) (sqrt (- (* g g) (* h h)))))) (cbrt (* (/ 1 (* 2 a)) (- (- g) (sqrt (- (* g g) (* h h)))))))

prune33.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 32.0b

localize54.0ms

Local error

Found 4 expressions with local error:

26.9b
(sqrt (- (* g g) (* h h)))
26.9b
(sqrt (- (* g g) (* h h)))
8.4b
(cbrt (* (/ 1 (* 2 a)) (- (- g) (sqrt (- (* g g) (* h h))))))
8.0b
(cbrt (* (/ 1 (* 2 a)) (+ (- g) (sqrt (- (* g g) (* h h))))))

rewrite38.0ms

Algorithm
rewrite-expression-head
Counts
4 → 66
Calls

4 calls. Slowest were:

14.0ms
(cbrt (* (/ 1 (* 2 a)) (- (- g) (sqrt (- (* g g) (* h h))))))
12.0ms
(cbrt (* (/ 1 (* 2 a)) (+ (- g) (sqrt (- (* g g) (* h h))))))
5.0ms
(sqrt (- (* g g) (* h h)))

series674.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

315.0ms
(cbrt (* (/ 1 (* 2 a)) (- (- g) (sqrt (- (* g g) (* h h))))))
303.0ms
(cbrt (* (/ 1 (* 2 a)) (+ (- g) (sqrt (- (* g g) (* h h))))))
30.0ms
(sqrt (- (* g g) (* h h)))
26.0ms
(sqrt (- (* g g) (* h h)))

simplify5.9s

Counts
38 → 78
Calls

38 calls. Slowest were:

681.0ms
(cbrt (* (/ 1 (* 2 a)) (- (* (- g) (- g)) (* (sqrt (- (* g g) (* h h))) (sqrt (- (* g g) (* h h)))))))
588.0ms
(cbrt (* (/ 1 (* 2 a)) (- (* (- g) (- g)) (* (sqrt (- (* g g) (* h h))) (sqrt (- (* g g) (* h h)))))))
381.0ms
(* (exp (* 1/3 (- (+ (log (/ -1 g)) (+ (log 1/2) (log (/ -1 a)))) (* 2 (log (/ -1 h)))))) (cbrt -1/2))

prune1.4s

Pruning

20 alts after pruning (20 fresh and 0 done)

Merged error: 27.1b

localize22.0ms

Local error

Found 4 expressions with local error:

26.9b
(sqrt (- (* g g) (* h h)))
26.9b
(sqrt (- (* g g) (* h h)))
8.4b
(cbrt (* (/ 1 (* 2 a)) (- (- g) (sqrt (- (* g g) (* h h))))))
3.0b
(- (* g g) (* h h))

rewrite29.0ms

Algorithm
rewrite-expression-head
Counts
4 → 67
Calls

4 calls. Slowest were:

13.0ms
(cbrt (* (/ 1 (* 2 a)) (- (- g) (sqrt (- (* g g) (* h h))))))
5.0ms
(sqrt (- (* g g) (* h h)))
5.0ms
(sqrt (- (* g g) (* h h)))

series401.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

290.0ms
(cbrt (* (/ 1 (* 2 a)) (- (- g) (sqrt (- (* g g) (* h h))))))
45.0ms
(sqrt (- (* g g) (* h h)))
38.0ms
(sqrt (- (* g g) (* h h)))
26.0ms
(- (* g g) (* h h))

simplify3.7s

Counts
37 → 79
Calls

37 calls. Slowest were:

673.0ms
(cbrt (* (/ 1 (* 2 a)) (- (* (- g) (- g)) (* (sqrt (- (* g g) (* h h))) (sqrt (- (* g g) (* h h)))))))
339.0ms
(* (exp (* 1/3 (- (+ (log 2) (log (/ 1 a))) (log (/ 1 g))))) (cbrt -1/2))
324.0ms
(cbrt (* (/ 1 (* 2 a)) (- (pow (- g) 3) (pow (sqrt (- (* g g) (* h h))) 3))))

prune1.5s

Pruning

21 alts after pruning (21 fresh and 0 done)

Merged error: 26.9b

localize52.0ms

Local error

Found 4 expressions with local error:

26.9b
(sqrt (* (+ g h) (- g h)))
26.9b
(sqrt (- (* g g) (* h h)))
8.4b
(cbrt (* (/ 1 (* 2 a)) (- (- g) (sqrt (- (* g g) (* h h))))))
3.0b
(- (* g g) (* h h))

rewrite28.0ms

Algorithm
rewrite-expression-head
Counts
4 → 69
Calls

4 calls. Slowest were:

12.0ms
(cbrt (* (/ 1 (* 2 a)) (- (- g) (sqrt (- (* g g) (* h h))))))
5.0ms
(sqrt (- (* g g) (* h h)))
5.0ms
(- (* g g) (* h h))

series700.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

616.0ms
(cbrt (* (/ 1 (* 2 a)) (- (- g) (sqrt (- (* g g) (* h h))))))
40.0ms
(sqrt (* (+ g h) (- g h)))
27.0ms
(sqrt (- (* g g) (* h h)))
17.0ms
(- (* g g) (* h h))

simplify5.1s

Counts
39 → 81
Calls

39 calls. Slowest were:

600.0ms
(cbrt (* (/ 1 (* 2 a)) (- (* (- g) (- g)) (* (sqrt (- (* g g) (* h h))) (sqrt (- (* g g) (* h h)))))))
480.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
398.0ms
(* (exp (* 1/3 (- (+ (log 2) (log (/ 1 a))) (log (/ 1 g))))) (cbrt -1/2))

prune1.5s

Pruning

25 alts after pruning (25 fresh and 0 done)

Merged error: 26.8b

localize21.0ms

Local error

Found 4 expressions with local error:

26.9b
(sqrt (- (* g g) (* h h)))
26.9b
(sqrt (- (* g g) (* h h)))
8.0b
(cbrt (* (/ 1 (* 2 a)) (+ (- g) (sqrt (- (* g g) (* h h))))))
3.0b
(- (* g g) (* h h))

rewrite29.0ms

Algorithm
rewrite-expression-head
Counts
4 → 67
Calls

4 calls. Slowest were:

13.0ms
(cbrt (* (/ 1 (* 2 a)) (+ (- g) (sqrt (- (* g g) (* h h))))))
5.0ms
(sqrt (- (* g g) (* h h)))
5.0ms
(sqrt (- (* g g) (* h h)))

series436.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

340.0ms
(cbrt (* (/ 1 (* 2 a)) (+ (- g) (sqrt (- (* g g) (* h h))))))
38.0ms
(sqrt (- (* g g) (* h h)))
38.0ms
(sqrt (- (* g g) (* h h)))
20.0ms
(- (* g g) (* h h))

simplify3.7s

Counts
37 → 79
Calls

37 calls. Slowest were:

558.0ms
(cbrt (* (/ 1 (* 2 a)) (- (* (- g) (- g)) (* (sqrt (- (* g g) (* h h))) (sqrt (- (* g g) (* h h)))))))
409.0ms
(cbrt (* (/ 1 (* 2 a)) (+ (pow (- g) 3) (pow (sqrt (- (* g g) (* h h))) 3))))
305.0ms
(cbrt (* 1 (+ (pow (- g) 3) (pow (sqrt (- (* g g) (* h h))) 3))))

prune1.4s

Pruning

24 alts after pruning (24 fresh and 0 done)

Merged error: 26.8b

regimes1.8s

Accuracy

41.3% (2.0b remaining)

Error of 31.2b against oracle of 29.1b and baseline of 32.6b

bsearch1.2s

end0.0ms

sample19.2s

Algorithm
intervals