Average Error: 1.0 → 1.0
Time: 13.5s
Precision: 64
Internal Precision: 128
\[2 \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)\]
\[\cos \left((\frac{2}{3} \cdot \pi + \left(\sqrt[3]{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}} \cdot \left(\sqrt[3]{\sqrt{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}}} \cdot \left(\left(\left(\sqrt[3]{\sqrt[3]{\sqrt{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}}}}\right) \cdot \sqrt[3]{\sqrt[3]{\sqrt{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}}}}\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}}\right)\right)\right))_*\right) \cdot 2\]

Error

Bits error versus g

Bits error versus h

Derivation

  1. Initial program 1.0

    \[2 \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)\]
  2. Simplified1.0

    \[\leadsto \color{blue}{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right))_*\right) \cdot 2}\]
  3. Using strategy rm
  4. Applied add-cube-cbrt1.0

    \[\leadsto \cos \left((\frac{2}{3} \cdot \pi + \color{blue}{\left(\left(\sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}} \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right)})_*\right) \cdot 2\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt1.0

    \[\leadsto \cos \left((\frac{2}{3} \cdot \pi + \left(\left(\sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}} \cdot \sqrt[3]{\color{blue}{\sqrt{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}} \cdot \sqrt{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}}}\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right))_*\right) \cdot 2\]
  7. Applied cbrt-prod1.0

    \[\leadsto \cos \left((\frac{2}{3} \cdot \pi + \left(\left(\sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}} \cdot \color{blue}{\left(\sqrt[3]{\sqrt{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}} \cdot \sqrt[3]{\sqrt{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}}\right)}\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right))_*\right) \cdot 2\]
  8. Applied associate-*r*1.0

    \[\leadsto \cos \left((\frac{2}{3} \cdot \pi + \left(\color{blue}{\left(\left(\sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}} \cdot \sqrt[3]{\sqrt{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}}\right) \cdot \sqrt[3]{\sqrt{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}}\right)} \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right))_*\right) \cdot 2\]
  9. Using strategy rm
  10. Applied add-cube-cbrt1.0

    \[\leadsto \cos \left((\frac{2}{3} \cdot \pi + \left(\left(\left(\sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}} \cdot \color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{\sqrt{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}}}\right) \cdot \sqrt[3]{\sqrt[3]{\sqrt{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}}}\right)}\right) \cdot \sqrt[3]{\sqrt{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}}\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right))_*\right) \cdot 2\]
  11. Final simplification1.0

    \[\leadsto \cos \left((\frac{2}{3} \cdot \pi + \left(\sqrt[3]{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}} \cdot \left(\sqrt[3]{\sqrt{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}}} \cdot \left(\left(\left(\sqrt[3]{\sqrt[3]{\sqrt{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}}}}\right) \cdot \sqrt[3]{\sqrt[3]{\sqrt{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}}}}\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}}\right)\right)\right))_*\right) \cdot 2\]

Reproduce

herbie shell --seed 2019004 +o rules:numerics
(FPCore (g h)
  :name "2-ancestry mixing, negative discriminant"
  (* 2 (cos (+ (/ (* 2 PI) 3) (/ (acos (/ (- g) h)) 3)))))

Details

Time bar (total: 13.1s)Debug log

sample197.0ms

Algorithm
intervals

simplify12.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

12.0ms
(* 2 (cos (+ (/ (* 2 PI) 3) (/ (acos (/ (- g) h)) 3))))

prune10.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 1.0b

localize38.0ms

Local error

Found 3 expressions with local error:

1.0b
(/ (acos (/ (- g) h)) 3)
1.0b
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
0.0b
(fma 2/3 PI (/ (acos (/ (- g) h)) 3))

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
3 → 37
Calls

3 calls. Slowest were:

7.0ms
(/ (acos (/ (- g) h)) 3)
3.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
0.0ms
(fma 2/3 PI (/ (acos (/ (- g) h)) 3))

series147.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

104.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
31.0ms
(fma 2/3 PI (/ (acos (/ (- g) h)) 3))
12.0ms
(/ (acos (/ (- g) h)) 3)

simplify257.0ms

Counts
14 → 46
Calls

14 calls. Slowest were:

40.0ms
(cos (+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI)))
39.0ms
(cos (+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI)))
38.0ms
(+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI))

prune527.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 1.0b

localize34.0ms

Local error

Found 4 expressions with local error:

1.0b
(* (cbrt (/ (acos (/ (- g) h)) 3)) (cbrt (/ (acos (/ (- g) h)) 3)))
1.0b
(/ (acos (/ (- g) h)) 3)
1.0b
(/ (acos (/ (- g) h)) 3)
1.0b
(/ (acos (/ (- g) h)) 3)

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
4 → 86
Calls

4 calls. Slowest were:

6.0ms
(* (cbrt (/ (acos (/ (- g) h)) 3)) (cbrt (/ (acos (/ (- g) h)) 3)))
3.0ms
(/ (acos (/ (- g) h)) 3)
3.0ms
(/ (acos (/ (- g) h)) 3)

series144.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

120.0ms
(* (cbrt (/ (acos (/ (- g) h)) 3)) (cbrt (/ (acos (/ (- g) h)) 3)))
8.0ms
(/ (acos (/ (- g) h)) 3)
8.0ms
(/ (acos (/ (- g) h)) 3)
7.0ms
(/ (acos (/ (- g) h)) 3)

simplify398.0ms

Counts
50 → 98
Calls

50 calls. Slowest were:

30.0ms
(* (pow (cbrt 1/3) 2) (pow (pow (acos (* -1 (/ g h))) 2) 1/3))
27.0ms
(* (/ (acos (/ (- g) h)) 3) (/ (acos (/ (- g) h)) 3))
26.0ms
(* 1/3 (acos (* -1 (/ g h))))

prune1.5s

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 1.0b

localize47.0ms

Local error

Found 4 expressions with local error:

1.5b
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))
1.5b
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))
1.0b
(/ (acos (/ (- g) h)) 3)
1.0b
(/ (acos (/ (- g) h)) 3)

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
4 → 70
Calls

4 calls. Slowest were:

7.0ms
(/ (acos (/ (- g) h)) 3)
6.0ms
(/ (acos (/ (- g) h)) 3)
2.0ms
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))

series410.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

224.0ms
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))
167.0ms
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))
12.0ms
(/ (acos (/ (- g) h)) 3)
8.0ms
(/ (acos (/ (- g) h)) 3)

simplify498.0ms

Counts
36 → 82
Calls

36 calls. Slowest were:

39.0ms
(* (pow (acos (* -1 (/ g h))) 1/6) (pow (sqrt 1/3) 1/3))
37.0ms
(* (pow (acos (* -1 (/ g h))) 1/6) (pow (sqrt 1/3) 1/3))
37.0ms
(* (pow (acos (* -1 (/ g h))) 1/6) (pow (sqrt 1/3) 1/3))

prune1.4s

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 1.0b

localize61.0ms

Local error

Found 4 expressions with local error:

1.5b
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))
1.5b
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))
1.5b
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))
1.5b
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))

rewrite8.0ms

Algorithm
rewrite-expression-head
Counts
4 → 72
Calls

4 calls. Slowest were:

2.0ms
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))
2.0ms
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))
2.0ms
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))

series839.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

255.0ms
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))
206.0ms
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))
194.0ms
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))
184.0ms
(cbrt (sqrt (/ (acos (/ (- g) h)) 3)))

simplify472.0ms

Counts
44 → 84
Calls

44 calls. Slowest were:

38.0ms
(* (pow (acos (* -1 (/ g h))) 1/6) (pow (sqrt 1/3) 1/3))
37.0ms
(* (pow (acos (* -1 (/ g h))) 1/6) (pow (sqrt 1/3) 1/3))
37.0ms
(* (pow (acos (* -1 (/ g h))) 1/6) (pow (sqrt 1/3) 1/3))

prune1.7s

Pruning

1 alts after pruning (0 fresh and 1 done)

Merged error: 1.0b

end0.0ms

sample4.3s

Algorithm
intervals