Average Error: 34.6 → 30.9
Time: 46.7s
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.6739327644208389 \cdot 10^{-167}:\\ \;\;\;\;\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 \sqrt[3]{\frac{g \cdot g - \sqrt{\left(h + g\right) \cdot \left(g - h\right)} \cdot \sqrt{\left(h + g\right) \cdot \left(g - h\right)}}{g - \sqrt{\left(h + g\right) \cdot \left(g - h\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{\sqrt{\left(h + g\right) \cdot \left(g - h\right)} - g}{a \cdot 2}} + \sqrt[3]{2 \cdot 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 < -1.6739327644208389e-167

    1. Initial program 33.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. Simplified33.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-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 cbrt-div29.5

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

      \[\leadsto \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 \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.6739327644208389e-167 < 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. Simplified35.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-prod32.5

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

      \[\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]{\color{blue}{2 \cdot g}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification30.9

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

Reproduce

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

sample458.0ms

Algorithm
intervals
Results
151.0ms86×body2560valid
128.0ms739×body80nan
48.0ms53×body1280valid
45.0ms33×body5120valid
30.0ms29×body640valid
14.0ms25×body320valid
10.0ms25×body160valid
1.0msbody80valid

simplify266.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
266.0ms
(+ (cbrt (* (/ 1 (* 2 a)) (+ (- g) (sqrt (- (* g g) (* h h)))))) (cbrt (* (/ 1 (* 2 a)) (- (- g) (sqrt (- (* g g) (* h h)))))))

prune18.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 34.1b

localize59.0ms

Local error

Found 4 expressions with local error:

30.6b
(sqrt (* (+ g h) (- g h)))
30.6b
(sqrt (* (+ g h) (- g h)))
9.6b
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))
7.5b
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
16×sqrt-div
10×frac-times
flip-+
flip3-+
cbrt-prod
flip--
add-cube-cbrt
associate-*r/
flip3--
*-un-lft-identity
cbrt-div
add-sqr-sqrt
associate-*l/
add-log-exp
add-exp-log
add-cbrt-cube
pow1
times-frac
sqrt-prod
pow1/3
pow1/2
div-inv
Counts
4 → 64
Calls
4 calls:
Slowest
2.0ms
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))
2.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
1.0ms
(sqrt (* (+ g h) (- g h)))
1.0ms
(sqrt (* (+ g h) (- g h)))

series613.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
282.0ms
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))
239.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
47.0ms
(sqrt (* (+ g h) (- g h)))
45.0ms
(sqrt (* (+ g h) (- g h)))

simplify5.9s

Counts
44 → 76
Calls
44 calls:
Slowest
386.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
371.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
299.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))
299.0ms
(* (cbrt 1/2) (exp (* 1/3 (- (+ (log (/ -1 g)) (+ (log (/ -1 a)) (log -1/2))) (* 2 (log (/ -1 h)))))))
274.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))

prune1.3s

Pruning

18 alts after pruning (18 fresh and 0 done)

Merged error: 31.2b

localize12.0ms

Local error

Found 4 expressions with local error:

30.6b
(sqrt (* (+ g h) (- g h)))
30.6b
(sqrt (* (+ g h) (- g h)))
7.5b
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
3.3b
(+ g (sqrt (* (+ g h) (- g h))))

rewrite15.0ms

Algorithm
rewrite-expression-head
Rules
16×sqrt-div
frac-times
flip-+
flip3-+
cbrt-prod
flip--
add-cube-cbrt
flip3--
*-un-lft-identity
add-sqr-sqrt
add-log-exp
add-exp-log
associate-*r/
associate-*l/
add-cbrt-cube
pow1
times-frac
sqrt-prod
pow1/2
div-inv
pow1/3
cbrt-div
+-commutative
Counts
4 → 60
Calls
4 calls:
Slowest
4.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
2.0ms
(sqrt (* (+ g h) (- g h)))
2.0ms
(+ g (sqrt (* (+ g h) (- g h))))
1.0ms
(sqrt (* (+ g h) (- g h)))

series352.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
219.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
53.0ms
(+ g (sqrt (* (+ g h) (- g h))))
50.0ms
(sqrt (* (+ g h) (- g h)))
29.0ms
(sqrt (* (+ g h) (- g h)))

simplify4.3s

Counts
38 → 72
Calls
38 calls:
Slowest
375.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
348.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))
324.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
320.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))
255.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.3s

Pruning

22 alts after pruning (22 fresh and 0 done)

Merged error: 30.6b

localize18.0ms

Local error

Found 4 expressions with local error:

30.6b
(sqrt (* (+ g h) (- g h)))
30.6b
(sqrt (* (+ g h) (- g h)))
3.3b
(+ g (sqrt (* (+ g h) (- g h))))
2.2b
(- (sqrt (* (+ g h) (- g h))) g)

rewrite10.0ms

Algorithm
rewrite-expression-head
Rules
16×sqrt-div
frac-times
flip--
flip-+
flip3--
flip3-+
add-log-exp
add-cube-cbrt
add-exp-log
associate-*r/
associate-*l/
add-cbrt-cube
*-un-lft-identity
pow1
add-sqr-sqrt
sqrt-prod
pow1/2
sub-neg
+-commutative
Counts
4 → 55
Calls
4 calls:
Slowest
5.0ms
(- (sqrt (* (+ g h) (- g h))) g)
3.0ms
(sqrt (* (+ g h) (- g h)))
2.0ms
(sqrt (* (+ g h) (- g h)))
1.0ms
(+ g (sqrt (* (+ g h) (- g h))))

series149.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
40.0ms
(sqrt (* (+ g h) (- g h)))
38.0ms
(sqrt (* (+ g h) (- g h)))
35.0ms
(+ g (sqrt (* (+ g h) (- g h))))
35.0ms
(- (sqrt (* (+ g h) (- g h))) g)

simplify3.3s

Counts
30 → 67
Calls
30 calls:
Slowest
502.0ms
(sqrt (* (- (* g g) (* h h)) (- (* g g) (* h h))))
338.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
333.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
282.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))
227.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- (pow g 3) (pow h 3))))

prune1.2s

Pruning

22 alts after pruning (22 fresh and 0 done)

Merged error: 30.5b

localize16.0ms

Local error

Found 4 expressions with local error:

30.6b
(sqrt (* (+ g h) (- g h)))
30.6b
(sqrt (* (+ g h) (- g h)))
3.3b
(+ g (sqrt (* (+ g h) (- g h))))
2.2b
(- (sqrt (* (+ g h) (- g h))) g)

rewrite9.0ms

Algorithm
rewrite-expression-head
Rules
16×sqrt-div
frac-times
flip--
flip-+
flip3--
flip3-+
add-log-exp
add-cube-cbrt
add-exp-log
associate-*r/
associate-*l/
add-cbrt-cube
*-un-lft-identity
pow1
add-sqr-sqrt
sqrt-prod
pow1/2
sub-neg
+-commutative
Counts
4 → 55
Calls
4 calls:
Slowest
5.0ms
(- (sqrt (* (+ g h) (- g h))) g)
2.0ms
(sqrt (* (+ g h) (- g h)))
1.0ms
(sqrt (* (+ g h) (- g h)))
1.0ms
(+ g (sqrt (* (+ g h) (- g h))))

series162.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
45.0ms
(+ g (sqrt (* (+ g h) (- g h))))
43.0ms
(sqrt (* (+ g h) (- g h)))
41.0ms
(- (sqrt (* (+ g h) (- g h))) g)
33.0ms
(sqrt (* (+ g h) (- g h)))

simplify2.9s

Counts
30 → 67
Calls
30 calls:
Slowest
376.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
358.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
282.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))
279.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))
208.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- (pow g 3) (pow h 3))))

prune1.2s

Pruning

22 alts after pruning (22 fresh and 0 done)

Merged error: 30.5b

regimes574.0ms

Accuracy

64.9% (1.0b remaining)

Error of 30.9b against oracle of 29.8b and baseline of 32.8b

bsearch678.0ms

end0.0ms

sample18.7s

Algorithm
intervals
Results
5.4s23779×body80nan
4.6s2639×body2560valid
2.9s1928×body1280valid
2.9s1174×body5120valid
1.3s1074×body640valid
692.0ms599×body320valid
199.0ms427×body160valid
34.0ms159×body80valid