Average Error: 34.5 → 30.1
Time: 52.1s
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.0749396284737093 \cdot 10^{-175}:\\ \;\;\;\;\sqrt[3]{\frac{\frac{-1}{2}}{a}} \cdot \sqrt[3]{\frac{g \cdot g - \sqrt{\left(g - h\right) \cdot \left(g + h\right)} \cdot \sqrt{\left(g - h\right) \cdot \left(g + h\right)}}{g - \sqrt{\left(g - h\right) \cdot \left(g + h\right)}}} + \sqrt[3]{\frac{\sqrt{\left(g - h\right) \cdot \left(g + h\right)} - g}{2}} \cdot \sqrt[3]{\frac{1}{a}}\\ \mathbf{elif}\;g \le 2.400117213160603 \cdot 10^{+70}:\\ \;\;\;\;\sqrt[3]{\frac{\frac{-1}{2}}{a}} \cdot \sqrt[3]{g + g} + \sqrt[3]{\frac{\sqrt{\left(g - h\right) \cdot \left(g + h\right)} - g}{a \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{\sqrt{\left(g - h\right) \cdot \left(g + h\right)} - g}{2}} \cdot \sqrt[3]{\frac{1}{a}} + \sqrt[3]{\sqrt{g + \sqrt{\left(g - h\right) \cdot \left(g + h\right)}} \cdot \sqrt{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.0749396284737093e-175

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

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

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

      \[\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-prod30.1

      \[\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. Using strategy rm
    10. Applied flip-+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}{\frac{g \cdot g - \sqrt{\left(g + h\right) \cdot \left(g - h\right)} \cdot \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}{g - \sqrt{\left(g + h\right) \cdot \left(g - h\right)}}}}\]

    if -1.0749396284737093e-175 < g < 2.400117213160603e+70

    1. Initial program 18.2

      \[\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. Simplified18.1

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

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

      \[\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 2.400117213160603e+70 < g

    1. Initial program 47.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. Simplified47.1

      \[\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-prod43.7

      \[\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-identity43.7

      \[\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-frac43.7

      \[\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-prod43.6

      \[\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. Using strategy rm
    10. Applied add-sqr-sqrt43.6

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

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

Reproduce

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

sample566.0ms

Algorithm
intervals

simplify263.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune35.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 35.3b

localize77.0ms

Local error

Found 4 expressions with local error:

28.9b
(sqrt (* (+ g h) (- g h)))
28.9b
(sqrt (* (+ g h) (- g h)))
10.2b
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
8.3b
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))

rewrite15.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

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

series660.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

336.0ms
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))
234.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
47.0ms
(sqrt (* (+ g h) (- g h)))
43.0ms
(sqrt (* (+ g h) (- g h)))

simplify6.1s

Counts
44 → 76
Calls

44 calls. Slowest were:

424.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
380.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
308.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.4s

Pruning

22 alts after pruning (22 fresh and 0 done)

Merged error: 29.2b

localize19.0ms

Local error

Found 4 expressions with local error:

28.9b
(sqrt (* (+ g h) (- g h)))
28.9b
(sqrt (* (+ g h) (- g h)))
10.2b
(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)))

series318.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

205.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
43.0ms
(- (sqrt (* (+ g h) (- g h))) g)
36.0ms
(sqrt (* (+ g h) (- g h)))
34.0ms
(sqrt (* (+ g h) (- g h)))

simplify4.7s

Counts
38 → 73
Calls

38 calls. Slowest were:

406.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
384.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
337.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))

prune1.4s

Pruning

27 alts after pruning (27 fresh and 0 done)

Merged error: 28.8b

localize28.0ms

Local error

Found 4 expressions with local error:

28.9b
(sqrt (* (+ g h) (- g h)))
28.9b
(sqrt (* (+ g h) (- g h)))
1.7b
(- (sqrt (* (+ g h) (- g h))) g)
1.0b
(+ g (sqrt (* (+ g h) (- g h))))

rewrite9.0ms

Algorithm
rewrite-expression-head
Counts
4 → 55
Calls

4 calls. Slowest were:

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

series182.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

57.0ms
(+ g (sqrt (* (+ g h) (- g h))))
45.0ms
(- (sqrt (* (+ g h) (- g h))) g)
42.0ms
(sqrt (* (+ g h) (- g h)))
39.0ms
(sqrt (* (+ g h) (- g h)))

simplify3.5s

Counts
30 → 67
Calls

30 calls. Slowest were:

386.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
384.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
375.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))

prune1.9s

Pruning

27 alts after pruning (27 fresh and 0 done)

Merged error: 28.8b

localize24.0ms

Local error

Found 4 expressions with local error:

28.9b
(sqrt (* (+ g h) (- g h)))
28.9b
(sqrt (* (+ g h) (- g h)))
1.7b
(- (sqrt (* (+ g h) (- g h))) g)
1.0b
(+ g (sqrt (* (+ g h) (- g h))))

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
4 → 55
Calls

4 calls. Slowest were:

10.0ms
(- (sqrt (* (+ g h) (- g h))) g)
3.0ms
(sqrt (* (+ g h) (- g h)))
2.0ms
(sqrt (* (+ g h) (- g h)))

series176.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

49.0ms
(sqrt (* (+ g h) (- g h)))
46.0ms
(sqrt (* (+ g h) (- g h)))
41.0ms
(- (sqrt (* (+ g h) (- g h))) g)
41.0ms
(+ g (sqrt (* (+ g h) (- g h))))

simplify3.5s

Counts
30 → 67
Calls

30 calls. Slowest were:

459.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
444.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
293.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))

prune1.1s

Pruning

27 alts after pruning (27 fresh and 0 done)

Merged error: 28.8b

regimes783.0ms

Accuracy

54% (0.6b remaining)

Error of 30.1b against oracle of 29.5b and baseline of 30.8b

bsearch2.1s

end0.0ms

sample19.2s

Algorithm
intervals