Average Error: 34.6 → 31.2
Time: 51.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}\;\frac{1}{a \cdot 2} \le 7.572626811676115 \cdot 10^{-270}:\\ \;\;\;\;\sqrt[3]{\frac{\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g}{a \cdot 2}} + \frac{\sqrt[3]{\left(g + \sqrt{\left(g + h\right) \cdot \left(g - h\right)}\right) \cdot \frac{-1}{2}}}{\sqrt[3]{a}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{1}{a \cdot 2}} \cdot \sqrt[3]{\sqrt{\sqrt{\left(g + h\right) \cdot \left(g - h\right)}} \cdot \sqrt{\sqrt{\left(g + h\right) \cdot \left(g - h\right)}} - g} + \sqrt[3]{\frac{\frac{-1}{2}}{a} \cdot \left(g + \sqrt{\left(g + h\right) \cdot \left(g - h\right)}\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 (/ 1 (* 2 a)) < 7.572626811676115e-270

    1. Initial program 35.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. Simplified35.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 associate-*l/35.3

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

      \[\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}}}\]

    if 7.572626811676115e-270 < (/ 1 (* 2 a))

    1. Initial program 33.7

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

      \[\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 div-inv33.7

      \[\leadsto \sqrt[3]{\color{blue}{\left(\sqrt{\left(g + h\right) \cdot \left(g - h\right)} - g\right) \cdot \frac{1}{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 cbrt-prod30.5

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

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

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

Reproduce

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

sample1.0s

Algorithm
intervals

simplify305.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune32.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 32.0b

localize44.0ms

Local error

Found 4 expressions with local error:

26.9b
(sqrt (* (+ g h) (- g h)))
26.9b
(sqrt (* (+ g h) (- g h)))
8.4b
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))
8.0b
(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 (* (/ -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)))

series613.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

311.0ms
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))
240.0ms
(cbrt (/ (- (sqrt (* (+ g h) (- g h))) g) (* a 2)))
31.0ms
(sqrt (* (+ g h) (- g h)))
30.0ms
(sqrt (* (+ g h) (- g h)))

simplify5.9s

Counts
44 → 76
Calls

44 calls. Slowest were:

383.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
322.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))
317.0ms
(* (cbrt 1/2) (exp (* 1/3 (- (+ (log (/ -1 g)) (+ (log (/ -1 a)) (log -1/2))) (* 2 (log (/ -1 h)))))))

prune1.3s

Pruning

20 alts after pruning (20 fresh and 0 done)

Merged error: 28.0b

localize30.0ms

Local error

Found 4 expressions with local error:

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

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 58
Calls

4 calls. Slowest were:

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

series416.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

280.0ms
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))
49.0ms
(sqrt (* (+ g h) (- g h)))
49.0ms
(sqrt (* (+ g h) (- g h)))
38.0ms
(+ g (sqrt (* (+ g h) (- g h))))

simplify4.5s

Counts
36 → 70
Calls

36 calls. Slowest were:

419.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
305.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
304.0ms
(sqrt (* (+ (pow g 3) (pow h 3)) (- g h)))

prune1.4s

Pruning

23 alts after pruning (23 fresh and 0 done)

Merged error: 27.7b

localize19.0ms

Local error

Found 4 expressions with local error:

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

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
4 → 58
Calls

4 calls. Slowest were:

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

series409.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

284.0ms
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))
57.0ms
(+ g (sqrt (* (+ g h) (- g h))))
38.0ms
(sqrt (* (+ g h) (- g h)))
30.0ms
(sqrt (* (+ g h) (- g h)))

simplify4.1s

Counts
36 → 70
Calls

36 calls. Slowest were:

403.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
283.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
275.0ms
(* (cbrt 1/2) (exp (* 1/3 (- (+ (log (/ -1 g)) (+ (log (/ -1 a)) (log -1/2))) (* 2 (log (/ -1 h)))))))

prune1.3s

Pruning

24 alts after pruning (24 fresh and 0 done)

Merged error: 27.7b

localize38.0ms

Local error

Found 4 expressions with local error:

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

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 58
Calls

4 calls. Slowest were:

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

series480.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

324.0ms
(cbrt (* (/ -1/2 a) (+ g (sqrt (* (+ g h) (- g h))))))
57.0ms
(+ g (sqrt (* (+ g h) (- g h))))
50.0ms
(sqrt (* (+ g h) (- g h)))
49.0ms
(sqrt (* (+ g h) (- g h)))

simplify4.7s

Counts
36 → 70
Calls

36 calls. Slowest were:

706.0ms
(* (cbrt 1/2) (exp (* 1/3 (- (+ (log (/ -1 g)) (+ (log (/ -1 a)) (log -1/2))) (* 2 (log (/ -1 h)))))))
368.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))
280.0ms
(sqrt (* (+ g h) (- (* g g) (* h h))))

prune1.3s

Pruning

24 alts after pruning (23 fresh and 1 done)

Merged error: 27.7b

regimes1.6s

Accuracy

49.4% (1.5b remaining)

Error of 31.2b against oracle of 29.7b and baseline of 32.7b

bsearch11.0ms

end0.0ms

sample18.7s

Algorithm
intervals