Average Error: 0.3 → 0.4
Time: 22.3s
Precision: 64
Internal Precision: 128
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[\frac{1 - \frac{1}{\frac{\cos x}{\tan x \cdot \sin x}}}{(\left(\tan x\right) \cdot \left(\tan x\right) + 1)_*}\]

Error

Bits error versus x

Derivation

  1. Initial program 0.3

    \[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
  2. Simplified0.3

    \[\leadsto \color{blue}{\frac{1 - \tan x \cdot \tan x}{(\left(\tan x\right) \cdot \left(\tan x\right) + 1)_*}}\]
  3. Using strategy rm
  4. Applied tan-quot0.4

    \[\leadsto \frac{1 - \tan x \cdot \color{blue}{\frac{\sin x}{\cos x}}}{(\left(\tan x\right) \cdot \left(\tan x\right) + 1)_*}\]
  5. Applied associate-*r/0.4

    \[\leadsto \frac{1 - \color{blue}{\frac{\tan x \cdot \sin x}{\cos x}}}{(\left(\tan x\right) \cdot \left(\tan x\right) + 1)_*}\]
  6. Using strategy rm
  7. Applied clear-num0.4

    \[\leadsto \frac{1 - \color{blue}{\frac{1}{\frac{\cos x}{\tan x \cdot \sin x}}}}{(\left(\tan x\right) \cdot \left(\tan x\right) + 1)_*}\]
  8. Final simplification0.4

    \[\leadsto \frac{1 - \frac{1}{\frac{\cos x}{\tan x \cdot \sin x}}}{(\left(\tan x\right) \cdot \left(\tan x\right) + 1)_*}\]

Reproduce

herbie shell --seed 2019007 +o rules:numerics
(FPCore (x)
  :name "Trigonometry B"
  (/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x)))))

Details

Time bar (total: 20.9s)Debug log

sample397.0ms

Algorithm
intervals

simplify95.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

94.0ms
(/ (- 1 (* (tan x) (tan x))) (+ 1 (* (tan x) (tan x))))

prune23.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.3b

localize36.0ms

Local error

Found 4 expressions with local error:

0.3b
(* (tan x) (tan x))
0.2b
(/ (- 1 (* (tan x) (tan x))) (fma (tan x) (tan x) 1))
0.2b
(- 1 (* (tan x) (tan x)))
0.1b
(fma (tan x) (tan x) 1)

rewrite24.0ms

Algorithm
rewrite-expression-head
Counts
4 → 80
Calls

4 calls. Slowest were:

10.0ms
(* (tan x) (tan x))
7.0ms
(/ (- 1 (* (tan x) (tan x))) (fma (tan x) (tan x) 1))
2.0ms
(- 1 (* (tan x) (tan x)))

series239.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

91.0ms
(/ (- 1 (* (tan x) (tan x))) (fma (tan x) (tan x) 1))
82.0ms
(* (tan x) (tan x))
34.0ms
(- 1 (* (tan x) (tan x)))
32.0ms
(fma (tan x) (tan x) 1)

simplify1.5s

Counts
55 → 92
Calls

55 calls. Slowest were:

236.0ms
(/ (* (* (- 1 (* (tan x) (tan x))) (- 1 (* (tan x) (tan x)))) (- 1 (* (tan x) (tan x)))) (* (* (fma (tan x) (tan x) 1) (fma (tan x) (tan x) 1)) (fma (tan x) (tan x) 1)))
225.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
154.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))

prune857.0ms

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.0b

localize12.0ms

Local error

Found 4 expressions with local error:

0.3b
(* (tan x) (tan x))
0.3b
(* (tan x) (tan x))
0.2b
(/ (- 1 (* (tan x) (tan x))) (+ (* (tan x) (tan x)) 1))
0.2b
(- 1 (* (tan x) (tan x)))

rewrite35.0ms

Algorithm
rewrite-expression-head
Counts
4 → 97
Calls

4 calls. Slowest were:

16.0ms
(/ (- 1 (* (tan x) (tan x))) (+ (* (tan x) (tan x)) 1))
8.0ms
(* (tan x) (tan x))
8.0ms
(* (tan x) (tan x))

series168.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

88.0ms
(/ (- 1 (* (tan x) (tan x))) (+ (* (tan x) (tan x)) 1))
30.0ms
(* (tan x) (tan x))
26.0ms
(* (tan x) (tan x))
24.0ms
(- 1 (* (tan x) (tan x)))

simplify2.1s

Counts
72 → 109
Calls

72 calls. Slowest were:

588.0ms
(/ (* (* (- 1 (* (tan x) (tan x))) (- 1 (* (tan x) (tan x)))) (- 1 (* (tan x) (tan x)))) (* (* (+ (* (tan x) (tan x)) 1) (+ (* (tan x) (tan x)) 1)) (+ (* (tan x) (tan x)) 1)))
335.0ms
(+ (* (* (tan x) (tan x)) (* (tan x) (tan x))) (- (* 1 1) (* (* (tan x) (tan x)) 1)))
189.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))

prune1.0s

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0.0b

localize48.0ms

Local error

Found 4 expressions with local error:

0.4b
(pow (* (tan x) (tan x)) 3)
0.3b
(* (tan x) (tan x))
0.3b
(* (tan x) (tan x))
0.3b
(* (tan x) (tan x))

rewrite34.0ms

Algorithm
rewrite-expression-head
Counts
4 → 101
Calls

4 calls. Slowest were:

8.0ms
(* (tan x) (tan x))
8.0ms
(* (tan x) (tan x))
8.0ms
(* (tan x) (tan x))

series161.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

64.0ms
(pow (* (tan x) (tan x)) 3)
40.0ms
(* (tan x) (tan x))
31.0ms
(* (tan x) (tan x))
26.0ms
(* (tan x) (tan x))

simplify526.0ms

Counts
71 → 113
Calls

71 calls. Slowest were:

46.0ms
(pow (* (tan x) (sin x)) 3)
34.0ms
(pow (* (sin x) (tan x)) 3)
33.0ms
(* (* (* (tan x) (tan x)) (tan x)) (* (* (tan x) (tan x)) (tan x)))

prune1.6s

Pruning

13 alts after pruning (13 fresh and 0 done)

Merged error: 0.0b

localize29.0ms

Local error

Found 4 expressions with local error:

0.2b
(/ (* (tan x) (sin x)) (cos x))
0.2b
(* (tan x) (sin x))
0.2b
(/ (- 1 (/ (* (tan x) (sin x)) (cos x))) (fma (tan x) (tan x) 1))
0.2b
(- 1 (/ (* (tan x) (sin x)) (cos x)))

rewrite35.0ms

Algorithm
rewrite-expression-head
Counts
4 → 89
Calls

4 calls. Slowest were:

14.0ms
(/ (* (tan x) (sin x)) (cos x))
9.0ms
(/ (- 1 (/ (* (tan x) (sin x)) (cos x))) (fma (tan x) (tan x) 1))
8.0ms
(* (tan x) (sin x))

series295.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

100.0ms
(/ (- 1 (/ (* (tan x) (sin x)) (cos x))) (fma (tan x) (tan x) 1))
81.0ms
(/ (* (tan x) (sin x)) (cos x))
63.0ms
(- 1 (/ (* (tan x) (sin x)) (cos x)))
51.0ms
(* (tan x) (sin x))

simplify3.9s

Counts
64 → 101
Calls

64 calls. Slowest were:

553.0ms
(/ (* (* (* (tan x) (tan x)) (tan x)) (* (* (sin x) (sin x)) (sin x))) (* (* (cos x) (cos x)) (cos x)))
496.0ms
(/ (* (* (* (tan x) (sin x)) (* (tan x) (sin x))) (* (tan x) (sin x))) (* (* (cos x) (cos x)) (cos x)))
290.0ms
(/ (- 1 (/ (* (tan x) (sin x)) (cos x))) (fma (tan x) (tan x) 1))

prune1.1s

Pruning

13 alts after pruning (12 fresh and 1 done)

Merged error: 0.0b

regimes318.0ms

Accuracy

0% (0.3b remaining)

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

bsearch3.0ms

end0.0ms

sample6.4s

Algorithm
intervals