Average Error: 35.3 → 31.5
Time: 54.2s
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 -6.359331887313869 \cdot 10^{-161}:\\ \;\;\;\;\frac{\sqrt[3]{\sqrt{\left(h + g\right) \cdot \left(g - h\right)} - g}}{\sqrt[3]{a \cdot 2}} + \sqrt[3]{\frac{\frac{-1}{2}}{a} \cdot \left(g + \sqrt{\left(h + g\right) \cdot \left(g - h\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{\sqrt{\left(h + g\right) \cdot \left(g - h\right)} - g}{a \cdot 2}} + \sqrt[3]{g + g} \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 2 regimes
  2. if g < -6.359331887313869e-161

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

      \[\leadsto \color{blue}{\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-div30.0

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

    if -6.359331887313869e-161 < g

    1. Initial program 36.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. Simplified36.9

      \[\leadsto \color{blue}{\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.2

      \[\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 32.8

      \[\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}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification31.5

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

Reproduce

herbie shell --seed 2019007 
(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: 51.6s)Debug log

sample662.0ms

Algorithm
intervals

simplify299.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune16.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 33.6b

localize37.0ms

Local error

Found 4 expressions with local error:

29.9b
(sqrt (* (+ g h) (- g h)))
29.9b
(sqrt (* (+ g h) (- g h)))
8.1b
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))
6.7b
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))

rewrite8.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

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

series655.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

318.0ms
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))
266.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
40.0ms
(sqrt (* (+ g h) (- g h)))
31.0ms
(sqrt (* (+ g h) (- g h)))

simplify5.9s

Counts
44 → 76
Calls

44 calls. Slowest were:

353.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
350.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))
337.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))

prune1.3s

Pruning

18 alts after pruning (18 fresh and 0 done)

Merged error: 30.9b

localize11.0ms

Local error

Found 4 expressions with local error:

29.9b
(sqrt (* (+ g h) (- g h)))
29.9b
(sqrt (* (+ g h) (- g h)))
6.7b
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
1.7b
(- (sqrt (* (+ g h) (- g h))) g)

rewrite10.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

5.0ms
(- (sqrt (* (+ g h) (- g h))) g)
2.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
1.0ms
(sqrt (* (+ g h) (- g h)))

series346.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

214.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
48.0ms
(sqrt (* (+ g h) (- g h)))
43.0ms
(sqrt (* (+ g h) (- g h)))
42.0ms
(- (sqrt (* (+ g h) (- g h))) g)

simplify4.7s

Counts
38 → 73
Calls

38 calls. Slowest were:

345.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
325.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))
322.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))

prune1.5s

Pruning

19 alts after pruning (19 fresh and 0 done)

Merged error: 30.1b

localize41.0ms

Local error

Found 4 expressions with local error:

29.9b
(sqrt (* (+ g h) (- g h)))
29.9b
(sqrt (* (+ g h) (- g h)))
29.9b
(sqrt (* (+ g h) (- g h)))
29.9b
(sqrt (* (+ g h) (- g h)))

rewrite8.0ms

Algorithm
rewrite-expression-head
Counts
4 → 68
Calls

4 calls. Slowest were:

3.0ms
(sqrt (* (+ g h) (- g h)))
1.0ms
(sqrt (* (+ g h) (- g h)))
1.0ms
(sqrt (* (+ g h) (- g h)))

series143.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

48.0ms
(sqrt (* (+ g h) (- g h)))
32.0ms
(sqrt (* (+ g h) (- g h)))
31.0ms
(sqrt (* (+ g h) (- g h)))
31.0ms
(sqrt (* (+ g h) (- g h)))

simplify6.9s

Counts
48 → 80
Calls

48 calls. Slowest were:

730.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
393.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
377.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))

prune1.8s

Pruning

19 alts after pruning (19 fresh and 0 done)

Merged error: 30.1b

localize33.0ms

Local error

Found 4 expressions with local error:

29.9b
(sqrt (* (+ g h) (- g h)))
29.9b
(sqrt (* (+ g h) (- g h)))
6.7b
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
1.7b
(- (sqrt (* (+ g h) (- g h))) g)

rewrite19.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

9.0ms
(- (sqrt (* (+ g h) (- g h))) g)
3.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
2.0ms
(sqrt (* (+ g h) (- g h)))

series393.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

243.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
55.0ms
(- (sqrt (* (+ g h) (- g h))) g)
48.0ms
(sqrt (* (+ g h) (- g h)))
48.0ms
(sqrt (* (+ g h) (- g h)))

simplify5.0s

Counts
38 → 73
Calls

38 calls. Slowest were:

462.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
389.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
363.0ms
(- (+ (* 1/18 (* (cbrt 1/2) (* (exp (* 1/3 (- (log (/ 1 (sqrt -1))) (+ (* 5 (log h)) (log a))))) (pow g 2)))) (* (cbrt 1/2) (exp (* 1/3 (- (+ (log (sqrt -1)) (log h)) (log a)))))) (* 1/3 (* (cbrt 1/2) (* g (exp (* 1/3 (- (log -1) (+ (* 2 (log h)) (log a)))))))))

prune1.2s

Pruning

19 alts after pruning (19 fresh and 0 done)

Merged error: 30.1b

regimes605.0ms

Accuracy

70.9% (1.1b remaining)

Error of 31.5b against oracle of 30.4b and baseline of 34.1b

bsearch1.7s

end0.0ms

sample18.2s

Algorithm
intervals