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

Error

Bits error versus g

Bits error versus h

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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{\cos^{-1} \left(\frac{-g}{h}\right)}{3} + \frac{\pi}{\frac{3}{2}}\right) \cdot 2}\]
  3. Using strategy rm
  4. Applied distribute-frac-neg1.0

    \[\leadsto \cos \left(\frac{\cos^{-1} \color{blue}{\left(-\frac{g}{h}\right)}}{3} + \frac{\pi}{\frac{3}{2}}\right) \cdot 2\]
  5. Applied acos-neg1.0

    \[\leadsto \cos \left(\frac{\color{blue}{\pi - \cos^{-1} \left(\frac{g}{h}\right)}}{3} + \frac{\pi}{\frac{3}{2}}\right) \cdot 2\]
  6. Applied div-sub1.0

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

    \[\leadsto \cos \color{blue}{\left(\frac{\pi}{3} - \left(\frac{\cos^{-1} \left(\frac{g}{h}\right)}{3} - \frac{\pi}{\frac{3}{2}}\right)\right)} \cdot 2\]
  8. Applied cos-diff0.1

    \[\leadsto \color{blue}{\left(\cos \left(\frac{\pi}{3}\right) \cdot \cos \left(\frac{\cos^{-1} \left(\frac{g}{h}\right)}{3} - \frac{\pi}{\frac{3}{2}}\right) + \sin \left(\frac{\pi}{3}\right) \cdot \sin \left(\frac{\cos^{-1} \left(\frac{g}{h}\right)}{3} - \frac{\pi}{\frac{3}{2}}\right)\right)} \cdot 2\]
  9. Simplified0.1

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

    \[\leadsto \left(\cos \left(\frac{\cos^{-1} \left(\frac{g}{h}\right)}{3} - \frac{\pi}{\frac{3}{2}}\right) \cdot \frac{1}{2} + \sin \color{blue}{\left(\sqrt{\frac{\pi}{3}} \cdot \sqrt{\frac{\pi}{3}}\right)} \cdot \sin \left(\frac{\cos^{-1} \left(\frac{g}{h}\right)}{3} - \frac{\pi}{\frac{3}{2}}\right)\right) \cdot 2\]
  12. Using strategy rm
  13. Applied cos-diff0.0

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

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

Reproduce

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

Details

Time bar (total: 9.1s)Debug log

sample178.0ms

Algorithm
intervals

simplify24.0ms

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

prune18.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 1.0b

localize41.0ms

Local error

Found 4 expressions with local error:

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

rewrite30.0ms

Algorithm
rewrite-expression-head
Rules
*-un-lft-identity
add-log-exp
div-sub
add-cube-cbrt
add-sqr-sqrt
associate-+l-
add-exp-log
add-cbrt-cube
pow1
associate-/l*
distribute-frac-neg
acos-neg
acos-asin
div-inv
frac-2neg
clear-num
cos-diff
distribute-lft-out
flip-+
frac-add
flip3-+
sum-log
cos-sum
+-commutative
Counts
4 → 50
Calls
4 calls:
Slowest
14.0ms
(cos (+ (/ (acos (/ (- g) h)) 3) (/ PI 3/2)))
11.0ms
(+ (/ (acos (/ (- g) h)) 3) (/ PI 3/2))
4.0ms
(/ (acos (/ (- g) h)) 3)
0.0ms
(/ PI 3/2)

series129.0ms

Counts
4 → 10
Calls
4 calls:
Slowest
90.0ms
(cos (+ (/ (acos (/ (- g) h)) 3) (/ PI 3/2)))
31.0ms
(+ (/ (acos (/ (- g) h)) 3) (/ PI 3/2))
8.0ms
(/ (acos (/ (- g) h)) 3)
0.0ms
(/ PI 3/2)

simplify354.0ms

Counts
23 → 60
Calls
23 calls:
Slowest
50.0ms
(* (cos (/ (/ PI 2) 3)) (cos (- (/ (asin (/ (- g) h)) 3) (/ PI 3/2))))
37.0ms
(+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI))
35.0ms
(+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI))
32.0ms
(cos (+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI)))
30.0ms
(+ (* 1/3 (acos (* -1 (/ g h)))) (* 2/3 PI))

prune629.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.0b

localize51.0ms

Local error

Found 4 expressions with local error:

56.5b
(cos (- (/ (acos (/ g h)) 3) (/ PI 3/2)))
1.0b
(sin (/ PI 3))
1.0b
(/ PI 3)
1.0b
(/ PI 3/2)

rewrite19.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
add-cube-cbrt
add-exp-log
add-cbrt-cube
*-un-lft-identity
pow1
add-sqr-sqrt
div-inv
frac-2neg
clear-num
cos-sum
sin-PI/3
sub-neg
cos-diff
Counts
4 → 38
Calls
4 calls:
Slowest
14.0ms
(cos (- (/ (acos (/ g h)) 3) (/ PI 3/2)))
3.0ms
(sin (/ PI 3))
0.0ms
(/ PI 3)
0.0ms
(/ PI 3/2)

series104.0ms

Counts
4 → 6
Calls
4 calls:
Slowest
104.0ms
(cos (- (/ (acos (/ g h)) 3) (/ PI 3/2)))
0.0ms
(sin (/ PI 3))
0.0ms
(/ PI 3)
0.0ms
(/ PI 3/2)

simplify611.0ms

Counts
10 → 44
Calls
10 calls:
Slowest
199.0ms
(* (+ (* (cos (- (/ (acos (/ g h)) 3) (/ PI 3/2))) 1/2) (* (sin (/ PI 3)) (sin (- (/ (acos (/ g h)) 3) (/ PI 3/2))))) 2)
184.0ms
(* (+ (* (cos (- (/ (acos (/ g h)) 3) (/ PI 3/2))) 1/2) (* (sin (/ PI 3)) (sin (- (/ (acos (/ g h)) 3) (/ PI 3/2))))) 2)
164.0ms
(* (+ (* (cos (- (/ (acos (/ g h)) 3) (/ PI 3/2))) 1/2) (* (sin (/ PI 3)) (sin (- (/ (acos (/ g h)) 3) (/ PI 3/2))))) 2)
14.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))
10.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))

prune766.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

localize41.0ms

Local error

Found 4 expressions with local error:

60.6b
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))
1.0b
(sin (/ PI 3))
1.0b
(/ PI 3/2)
1.0b
(* 2/3 PI)

rewrite18.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
add-cube-cbrt
add-exp-log
add-cbrt-cube
*-un-lft-identity
pow1
add-sqr-sqrt
cos-sum
div-inv
*-commutative
frac-2neg
sin-PI/3
sub-neg
clear-num
cos-diff
Counts
4 → 36
Calls
4 calls:
Slowest
14.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))
3.0ms
(sin (/ PI 3))
0.0ms
(/ PI 3/2)
0.0ms
(* 2/3 PI)

series111.0ms

Counts
4 → 6
Calls
4 calls:
Slowest
111.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))
0.0ms
(sin (/ PI 3))
0.0ms
(* 2/3 PI)
0.0ms
(/ PI 3/2)

simplify89.0ms

Counts
10 → 42
Calls
10 calls:
Slowest
15.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))
13.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))
11.0ms
(* (cos (* 1/3 (acos (/ g h)))) (cos (- (* 2/3 PI))))
11.0ms
(* (cos (* 1/3 (acos (/ g h)))) (cos (- (* 2/3 PI))))
8.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))

prune637.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize33.0ms

Local error

Found 4 expressions with local error:

56.5b
(cos (- (/ (acos (/ g h)) 3) (/ PI 3/2)))
1.0b
(/ PI 3/2)
1.0b
(/ PI 3/2)
1.0b
(sin (* (sqrt (/ PI 3)) (sqrt (/ PI 3))))

rewrite26.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
add-cube-cbrt
add-exp-log
add-cbrt-cube
*-un-lft-identity
pow1
add-sqr-sqrt
div-inv
frac-2neg
clear-num
cos-sum
sub-neg
cos-diff
Counts
4 → 37
Calls
4 calls:
Slowest
15.0ms
(cos (- (/ (acos (/ g h)) 3) (/ PI 3/2)))
10.0ms
(sin (* (sqrt (/ PI 3)) (sqrt (/ PI 3))))
0.0ms
(/ PI 3/2)
0.0ms
(/ PI 3/2)

series113.0ms

Counts
4 → 6
Calls
4 calls:
Slowest
113.0ms
(cos (- (/ (acos (/ g h)) 3) (/ PI 3/2)))
0.0ms
(/ PI 3/2)
0.0ms
(/ PI 3/2)
0.0ms
(sin (* (sqrt (/ PI 3)) (sqrt (/ PI 3))))

simplify63.0ms

Counts
6 → 43
Calls
6 calls:
Slowest
16.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))
12.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))
9.0ms
(* (cos (/ (acos (/ g h)) 3)) (cos (- (/ PI 3/2))))
8.0ms
(* (cos (/ (acos (/ g h)) 3)) (cos (- (/ PI 3/2))))
7.0ms
(cos (- (* 1/3 (acos (/ g h))) (* 2/3 PI)))

prune819.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0b

regimes114.0ms

Accuracy

0% (0.0b remaining)

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

bsearch3.0ms

end0.0ms

sample4.1s

Algorithm
intervals