Average Error: 34.4 → 30.8
Time: 52.6s
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 -7.631475342809927 \cdot 10^{-212}:\\ \;\;\;\;\sqrt[3]{\frac{\frac{-1}{2}}{a} \cdot \left(g + \sqrt{\left(g - h\right) \cdot \left(g + h\right)}\right)} + \sqrt[3]{\frac{\sqrt{\left(g - h\right) \cdot \left(g + h\right)} - g}{2}} \cdot \sqrt[3]{\frac{1}{a}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{\sqrt{\left(g - h\right) \cdot \left(g + h\right)} - g}{a \cdot 2}} + \frac{\sqrt[3]{\frac{-1}{2} \cdot \left(g + g\right)}}{\sqrt[3]{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 < -7.631475342809927e-212

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

      \[\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 *-un-lft-identity33.3

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

      \[\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 \left(g + \sqrt{\left(g + h\right) \cdot \left(g - h\right)}\right)}\]
    6. Applied cbrt-prod30.0

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

    if -7.631475342809927e-212 < g

    1. Initial program 35.5

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

      \[\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 associate-*l/35.5

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

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

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

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

Reproduce

herbie shell --seed 2019010 
(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.1s)Debug log

sample636.0ms

Algorithm
intervals

simplify267.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
267.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: 36.8b

localize54.0ms

Local error

Found 4 expressions with local error:

31.8b
(sqrt (* (+ g h) (- g h)))
31.8b
(sqrt (* (+ g h) (- g h)))
9.3b
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
8.3b
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))

rewrite20.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
4.0ms
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))
3.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
2.0ms
(sqrt (* (+ g h) (- g h)))
2.0ms
(sqrt (* (+ g h) (- g h)))

series598.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
303.0ms
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))
214.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
50.0ms
(sqrt (* (+ g h) (- g h)))
31.0ms
(sqrt (* (+ g h) (- g h)))

simplify6.2s

Counts
44 → 76
Calls
44 calls:
Slowest
619.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)))))))))
446.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
371.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
303.0ms
(* (cbrt 1/2) (exp (* 1/3 (- (+ (log (/ -1 g)) (+ (log (/ -1 a)) (log -1/2))) (* 2 (log (/ -1 h)))))))
281.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))

prune1.3s

Pruning

21 alts after pruning (21 fresh and 0 done)

Merged error: 32.1b

localize18.0ms

Local error

Found 4 expressions with local error:

31.8b
(sqrt (* (+ g h) (- g h)))
31.8b
(sqrt (* (+ g h) (- g h)))
9.3b
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
1.3b
(+ g (sqrt (* (+ g h) (- g h))))

rewrite6.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
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)))
1.0ms
(+ g (sqrt (* (+ g h) (- g h))))

series358.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
230.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
52.0ms
(sqrt (* (+ g h) (- g h)))
39.0ms
(sqrt (* (+ g h) (- g h)))
37.0ms
(+ g (sqrt (* (+ g h) (- g h))))

simplify4.5s

Counts
38 → 72
Calls
38 calls:
Slowest
384.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
356.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
304.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))
294.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)))))))))
284.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))

prune1.3s

Pruning

23 alts after pruning (23 fresh and 0 done)

Merged error: 31.5b

localize16.0ms

Local error

Found 4 expressions with local error:

31.8b
(sqrt (* (+ g h) (- g h)))
31.8b
(sqrt (* (+ g h) (- g h)))
9.3b
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
1.3b
(+ g (sqrt (* (+ g h) (- g h))))

rewrite6.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
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)))
1.0ms
(+ g (sqrt (* (+ g h) (- g h))))

series376.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
241.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
60.0ms
(+ g (sqrt (* (+ g h) (- g h))))
38.0ms
(sqrt (* (+ g h) (- g h)))
37.0ms
(sqrt (* (+ g h) (- g h)))

simplify4.4s

Counts
38 → 72
Calls
38 calls:
Slowest
382.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
305.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
295.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- (pow g 3) (pow h 3))))
286.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))
253.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))

prune1.2s

Pruning

24 alts after pruning (24 fresh and 0 done)

Merged error: 31.5b

localize17.0ms

Local error

Found 4 expressions with local error:

31.8b
(sqrt (* (+ g h) (- g h)))
31.8b
(sqrt (* (+ g h) (- g h)))
9.3b
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
2.9b
(exp (log (+ g (sqrt (* (+ g h) (- g h))))))

rewrite10.0ms

Algorithm
rewrite-expression-head
Rules
16×sqrt-div
add-cube-cbrt
*-un-lft-identity
frac-times
add-sqr-sqrt
flip-+
flip3-+
cbrt-prod
flip--
flip3--
pow1
add-log-exp
add-exp-log
associate-*r/
associate-*l/
add-cbrt-cube
exp-prod
exp-sum
times-frac
log-prod
sqrt-prod
exp-diff
pow1/2
log-div
rem-exp-log
div-inv
log-pow
pow1/3
cbrt-div
Counts
4 → 67
Calls
4 calls:
Slowest
4.0ms
(exp (log (+ 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)))

series338.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
233.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
42.0ms
(exp (log (+ g (sqrt (* (+ g h) (- g h))))))
31.0ms
(sqrt (* (+ g h) (- g h)))
31.0ms
(sqrt (* (+ g h) (- g h)))

simplify5.2s

Counts
47 → 79
Calls
47 calls:
Slowest
371.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
369.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)))))))))
301.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))
287.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))

prune1.4s

Pruning

26 alts after pruning (26 fresh and 0 done)

Merged error: 31.5b

regimes764.0ms

Accuracy

60.3% (1.2b remaining)

Error of 30.8b against oracle of 29.6b and baseline of 32.6b

bsearch1.3s

end0.0ms

sample18.6s

Algorithm
intervals