Average Error: 1.0 → 0.0
Time: 12.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)\]
\[2 \cdot \left(\sqrt[3]{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right))_*\right)} \cdot \sqrt[3]{\cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right))_*\right) \cdot \cos \left((\frac{2}{3} \cdot \pi + \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right))_*\right)}\right)\]

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-cbrt-cube1.5

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

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

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

Reproduce

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

sample209.0ms

Algorithm
intervals

simplify32.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
32.0ms
(* 2 (cos (+ (/ (* 2 PI) 3) (/ (acos (/ (- g) h)) 3))))

prune26.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 1.0b

localize46.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))

rewrite12.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
associate-/l*
log1p-expm1-u
add-exp-log
add-cbrt-cube
pow1
expm1-log1p-u
fma-udef
div-sub
div-inv
distribute-frac-neg
frac-2neg
clear-num
cos-sum
acos-neg
acos-asin
Counts
3 → 37
Calls
3 calls:
Slowest
7.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))

series150.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
100.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
38.0ms
(fma 2/3 PI (/ (acos (/ (- g) h)) 3))
12.0ms
(/ (acos (/ (- g) h)) 3)

simplify258.0ms

Counts
14 → 46
Calls
14 calls:
Slowest
40.0ms
(+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI))
38.0ms
(cos (+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI)))
28.0ms
(cos (+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI)))
27.0ms
(+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI))
25.0ms
(* 1/3 (acos (* -1 (/ g h))))

prune565.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.9b

localize39.0ms

Local error

Found 4 expressions with local error:

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

rewrite16.0ms

Algorithm
rewrite-expression-head
Rules
20×cbrt-prod
11×add-cube-cbrt
11×*-un-lft-identity
11×add-sqr-sqrt
pow1
associate-*l*
associate-*r*
pow1/3
cbrt-div
add-exp-log
div-inv
add-log-exp
log1p-expm1-u
add-cbrt-cube
expm1-log1p-u
pow-prod-up
pow-prod-down
cbrt-unprod
*-commutative
associate-*r/
prod-exp
associate-*l/
pow-plus
frac-times
pow2
Counts
4 → 80
Calls
4 calls:
Slowest
11.0ms
(* (cbrt (/ (acos (/ (- g) h)) 3)) (cbrt (/ (acos (/ (- g) h)) 3)))
1.0ms
(cbrt (/ (acos (/ (- g) h)) 3))
1.0ms
(cbrt (/ (acos (/ (- g) h)) 3))
1.0ms
(cbrt (/ (acos (/ (- g) h)) 3))

series412.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
149.0ms
(* (cbrt (/ (acos (/ (- g) h)) 3)) (cbrt (/ (acos (/ (- g) h)) 3)))
101.0ms
(cbrt (/ (acos (/ (- g) h)) 3))
86.0ms
(cbrt (/ (acos (/ (- g) h)) 3))
76.0ms
(cbrt (/ (acos (/ (- g) h)) 3))

simplify478.0ms

Counts
53 → 92
Calls
53 calls:
Slowest
36.0ms
(* (cbrt 1/3) (pow (acos (* -1 (/ g h))) 1/3))
31.0ms
(* (pow (cbrt 1/3) 2) (pow (pow (acos (* -1 (/ g h))) 2) 1/3))
30.0ms
(* (pow (cbrt 1/3) 2) (pow (pow (acos (* -1 (/ g h))) 2) 1/3))
28.0ms
(* (pow (cbrt 1/3) 2) (pow (pow (acos (* -1 (/ g h))) 2) 1/3))
25.0ms
(* (/ (acos (/ (- g) h)) 3) (/ (acos (/ (- g) h)) 3))

prune1.3s

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.9b

localize22.0ms

Local error

Found 4 expressions with local error:

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

rewrite12.0ms

Algorithm
rewrite-expression-head
Rules
log1p-expm1-u
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
add-exp-log
add-cbrt-cube
pow1
expm1-log1p-u
associate-/l*
div-sub
expm1-udef
div-inv
fma-udef
distribute-frac-neg
log1p-expm1
frac-2neg
clear-num
expm1-log1p
log1p-udef
cos-sum
acos-neg
acos-asin
Counts
4 → 49
Calls
4 calls:
Slowest
7.0ms
(/ (acos (/ (- g) h)) 3)
4.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
1.0ms
(expm1 (cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3))))
0.0ms
(log1p (expm1 (cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))))

series345.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
133.0ms
(log1p (expm1 (cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))))
113.0ms
(expm1 (cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3))))
88.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
11.0ms
(/ (acos (/ (- g) h)) 3)

simplify328.0ms

Counts
19 → 61
Calls
19 calls:
Slowest
38.0ms
(cos (+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI)))
29.0ms
(- (exp (cos (+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI)))) 1)
29.0ms
(cos (+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI)))
29.0ms
(- (exp (cos (+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI)))) 1)
28.0ms
(- (exp (cos (+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI)))) 1)

prune819.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.9b

localize24.0ms

Local error

Found 4 expressions with local error:

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

rewrite34.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
log1p-expm1-u
add-cube-cbrt
add-exp-log
add-cbrt-cube
*-un-lft-identity
pow1
expm1-log1p-u
add-sqr-sqrt
fma-udef
cos-sum
rem-cbrt-cube
cos-mult
associate-*l/
pow3
pow1/3
cbrt-div
cbrt-prod
Counts
4 → 43
Calls
4 calls:
Slowest
21.0ms
(cbrt (* (* (cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3))) (cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))) (cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))))
4.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
4.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
4.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))

series379.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
116.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
98.0ms
(cbrt (* (* (cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3))) (cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))) (cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))))
86.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))
79.0ms
(cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))

simplify523.0ms

Counts
18 → 55
Calls
18 calls:
Slowest
86.0ms
(cbrt (* (+ (cos (+ (fma 2/3 PI (/ (acos (/ (- g) h)) 3)) (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))) (cos (- (fma 2/3 PI (/ (acos (/ (- g) h)) 3)) (fma 2/3 PI (/ (acos (/ (- g) h)) 3))))) (cos (fma 2/3 PI (/ (acos (/ (- g) h)) 3)))))
40.0ms
(cos (+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI)))
39.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
(cos (+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI)))

prune691.0ms

Pruning

5 alts after pruning (2 fresh and 3 done)

Merged error: 0b

regimes350.0ms

Accuracy

0% (0.0b remaining)

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

bsearch2.0ms

end0.0ms

sample4.2s

Algorithm
intervals