Average Error: 1.0 → 0.1
Time: 17.3s
Precision: 64
Internal Precision: 128
\[2 \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)\]
\[\left(\log \left(\sqrt[3]{e^{\log_* (1 + (e^{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}\right))_*\right)} - 1)^*)}} \cdot \sqrt[3]{e^{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}\right))_*\right)}}\right) + \log \left(\sqrt[3]{e^{\cos \left(\frac{2}{3} \cdot \pi\right) \cdot \cos \left(\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}\right) - \sin \left(\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}\right) \cdot \sin \left(\frac{2}{3} \cdot \pi\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. Initial simplification1.0

    \[\leadsto \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-log-exp1.0

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

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

    \[\leadsto \color{blue}{\left(\log \left(\sqrt[3]{e^{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right))_*\right)}} \cdot \sqrt[3]{e^{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right))_*\right)}}\right) + \log \left(\sqrt[3]{e^{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right))_*\right)}}\right)\right)} \cdot 2\]
  8. Using strategy rm
  9. Applied log1p-expm1-u0.1

    \[\leadsto \left(\log \left(\sqrt[3]{e^{\color{blue}{\log_* (1 + (e^{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right))_*\right)} - 1)^*)}}} \cdot \sqrt[3]{e^{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right))_*\right)}}\right) + \log \left(\sqrt[3]{e^{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right))_*\right)}}\right)\right) \cdot 2\]
  10. Using strategy rm
  11. Applied fma-udef0.1

    \[\leadsto \left(\log \left(\sqrt[3]{e^{\log_* (1 + (e^{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right))_*\right)} - 1)^*)}} \cdot \sqrt[3]{e^{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right))_*\right)}}\right) + \log \left(\sqrt[3]{e^{\cos \color{blue}{\left(\frac{2}{3} \cdot \pi + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)}}}\right)\right) \cdot 2\]
  12. Applied cos-sum0.1

    \[\leadsto \left(\log \left(\sqrt[3]{e^{\log_* (1 + (e^{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right))_*\right)} - 1)^*)}} \cdot \sqrt[3]{e^{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right))_*\right)}}\right) + \log \left(\sqrt[3]{e^{\color{blue}{\cos \left(\frac{2}{3} \cdot \pi\right) \cdot \cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right) - \sin \left(\frac{2}{3} \cdot \pi\right) \cdot \sin \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)}}}\right)\right) \cdot 2\]
  13. Final simplification0.1

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

Reproduce

herbie shell --seed 2018360 +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: 8.4s)Debug log

start201.0ms

Algorithm
intervals

setup66.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 1.0b

localize41.0ms

Local error

Found 3 expressions with local error:

1.0b
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
0.9b
(/ (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:

6.0ms
(/ (acos (/ (- g) h)) 3)
4.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
0.0ms
(fma 2/3 PI (/ (acos (/ (- g) h)) 3))

series134.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

95.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
30.0ms
(fma 2/3 PI (/ (acos (/ (- g) h)) 3))
9.0ms
(/ (acos (/ (- g) h)) 3)

simplify225.0ms

Counts
14 → 46
Calls

14 calls. Slowest were:

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

prune672.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 1.0b

localize20.0ms

Local error

Found 4 expressions with local error:

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

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
4 → 55
Calls

4 calls. Slowest were:

6.0ms
(/ (acos (/ (- g) h)) 3)
6.0ms
(log (exp (cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))))
3.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))

series261.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

115.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
95.0ms
(log (exp (cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))))
38.0ms
(fma 2/3 PI (/ (acos (/ (- g) h)) 3))
13.0ms
(/ (acos (/ (- g) h)) 3)

simplify383.0ms

Counts
25 → 67
Calls

25 calls. Slowest were:

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

prune1.2s

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.0b

localize38.0ms

Local error

Found 4 expressions with local error:

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

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
4 → 47
Calls

4 calls. Slowest were:

6.0ms
(/ (acos (/ (- g) h)) 3)
4.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
3.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))

series294.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

116.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
90.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
80.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
7.0ms
(/ (acos (/ (- g) h)) 3)

simplify394.0ms

Counts
19 → 59
Calls

19 calls. Slowest were:

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

prune1.4s

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.0b

localize359.0ms

Local error

Found 4 expressions with local error:

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

rewrite10.0ms

Algorithm
rewrite-expression-head
Counts
4 → 41
Calls

4 calls. Slowest were:

4.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
4.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
2.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))

series469.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

151.0ms
(log1p (expm1 (cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))))
120.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
107.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
90.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))

simplify414.0ms

Counts
16 → 53
Calls

16 calls. Slowest were:

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

prune1.3s

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.0b

regimes389.0ms

Accuracy

0% (0.1b remaining)

Error of 0.1b against oracle of 0.0b and baseline of 0.1b

bsearch4.0ms