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

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 *-un-lft-identity0.3

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

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

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

Reproduce

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

Details

Time bar (total: 23.7s)Debug log

sample190.0ms

Algorithm
intervals

simplify60.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune25.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.3b

localize29.0ms

Local error

Found 4 expressions with local error:

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

rewrite14.0ms

Algorithm
rewrite-expression-head
Counts
4 → 80
Calls

4 calls. Slowest were:

6.0ms
(* (tan x) (tan x))
4.0ms
(/ (- 1 (* (tan x) (tan x))) (fma (tan x) (tan x) 1))
1.0ms
(- 1 (* (tan x) (tan x)))

series254.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

121.0ms
(/ (- 1 (* (tan x) (tan x))) (fma (tan x) (tan x) 1))
53.0ms
(* (tan x) (tan x))
41.0ms
(- 1 (* (tan x) (tan x)))
39.0ms
(fma (tan x) (tan x) 1)

simplify1.6s

Counts
55 → 92
Calls

55 calls. Slowest were:

251.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)))
222.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
195.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))

prune1.0s

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.2b
(* (tan x) (tan x))
0.2b
(/ 1 (/ (fma (tan x) (tan x) 1) (- 1 (* (tan x) (tan x)))))
0.1b
(- 1 (* (tan x) (tan x)))
0.1b
(/ (fma (tan x) (tan x) 1) (- 1 (* (tan x) (tan x))))

rewrite25.0ms

Algorithm
rewrite-expression-head
Counts
4 → 101
Calls

4 calls. Slowest were:

8.0ms
(* (tan x) (tan x))
8.0ms
(/ (fma (tan x) (tan x) 1) (- 1 (* (tan x) (tan x))))
4.0ms
(/ 1 (/ (fma (tan x) (tan x) 1) (- 1 (* (tan x) (tan x)))))

series287.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

121.0ms
(/ (fma (tan x) (tan x) 1) (- 1 (* (tan x) (tan x))))
93.0ms
(/ 1 (/ (fma (tan x) (tan x) 1) (- 1 (* (tan x) (tan x)))))
46.0ms
(* (tan x) (tan x))
26.0ms
(- 1 (* (tan x) (tan x)))

simplify1.9s

Counts
71 → 113
Calls

71 calls. Slowest were:

249.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
245.0ms
(/ (* (* (fma (tan x) (tan x) 1) (fma (tan x) (tan x) 1)) (fma (tan x) (tan x) 1)) (* (* (- 1 (* (tan x) (tan x))) (- 1 (* (tan x) (tan x)))) (- 1 (* (tan x) (tan x)))))
218.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))

prune1.2s

Pruning

12 alts after pruning (11 fresh and 1 done)

Merged error: 0.0b

localize17.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.1b
(- 1 (/ (* (tan x) (sin x)) (cos x)))

rewrite35.0ms

Algorithm
rewrite-expression-head
Counts
4 → 89
Calls

4 calls. Slowest were:

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

series273.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

122.0ms
(/ (- 1 (/ (* (tan x) (sin x)) (cos x))) (fma (tan x) (tan x) 1))
64.0ms
(/ (* (tan x) (sin x)) (cos x))
44.0ms
(* (tan x) (sin x))
42.0ms
(- 1 (/ (* (tan x) (sin x)) (cos x)))

simplify4.1s

Counts
64 → 101
Calls

64 calls. Slowest were:

539.0ms
(/ (* (* (* (tan x) (sin x)) (* (tan x) (sin x))) (* (tan x) (sin x))) (* (* (cos x) (cos x)) (cos x)))
429.0ms
(/ (* (* (* (tan x) (tan x)) (tan x)) (* (* (sin x) (sin x)) (sin x))) (* (* (cos x) (cos x)) (cos x)))
346.0ms
(/ (- 1 (/ (* (tan x) (sin x)) (cos x))) (fma (tan x) (tan x) 1))

prune1.3s

Pruning

14 alts after pruning (13 fresh and 1 done)

Merged error: 0.0b

localize16.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.1b
(+ 1 (- (/ (* (tan x) (sin x)) (cos x))))

rewrite43.0ms

Algorithm
rewrite-expression-head
Counts
4 → 93
Calls

4 calls. Slowest were:

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

series336.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

126.0ms
(/ (+ 1 (- (/ (* (tan x) (sin x)) (cos x)))) (fma (tan x) (tan x) 1))
74.0ms
(/ (* (tan x) (sin x)) (cos x))
69.0ms
(* (tan x) (sin x))
67.0ms
(+ 1 (- (/ (* (tan x) (sin x)) (cos x))))

simplify3.5s

Counts
69 → 105
Calls

69 calls. Slowest were:

538.0ms
(/ (* (* (* (tan x) (tan x)) (tan x)) (* (* (sin x) (sin x)) (sin x))) (* (* (cos x) (cos x)) (cos x)))
525.0ms
(/ (* (* (* (tan x) (sin x)) (* (tan x) (sin x))) (* (tan x) (sin x))) (* (* (cos x) (cos x)) (cos x)))
224.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))

prune1.3s

Pruning

14 alts after pruning (12 fresh and 2 done)

Merged error: 0.0b

regimes252.0ms

Accuracy

0% (0.3b remaining)

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

bsearch2.0ms

end0.0ms

sample5.9s

Algorithm
intervals