Average Error: 0.3 → 0.4
Time: 27.0s
Precision: 64
Internal Precision: 128
\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}\]
\[(e^{\log_* (1 + \frac{1 - \tan x \cdot \tan x}{(\left(\tan x\right) \cdot \left(\tan x\right) + 1)_*})} - 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 expm1-log1p-u0.4

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

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

Reproduce

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

Details

Time bar (total: 25.7s)Debug log

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

prune14.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.3b

localize18.0ms

Local error

Found 4 expressions with local error:

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

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 80
Calls

4 calls. Slowest were:

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

series216.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

87.0ms
(/ (- 1 (* (tan x) (tan x))) (fma (tan x) (tan x) 1))
58.0ms
(* (tan x) (tan x))
39.0ms
(- 1 (* (tan x) (tan x)))
31.0ms
(fma (tan x) (tan x) 1)

simplify1.6s

Counts
55 → 92
Calls

55 calls. Slowest were:

266.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)))
219.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
193.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))

prune828.0ms

Pruning

13 alts after pruning (13 fresh and 0 done)

Merged error: 0.0b

localize7.0ms

Local error

Found 4 expressions with local error:

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

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
4 → 60
Calls

4 calls. Slowest were:

7.0ms
(* (tan x) (tan x))
3.0ms
(- 1 (* (tan x) (tan x)))
0.0ms
(expm1 (log1p (/ (- 1 (* (tan x) (tan x))) (fma (tan x) (tan x) 1))))

series557.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

255.0ms
(expm1 (log1p (/ (- 1 (* (tan x) (tan x))) (fma (tan x) (tan x) 1))))
243.0ms
(log1p (/ (- 1 (* (tan x) (tan x))) (fma (tan x) (tan x) 1)))
34.0ms
(- 1 (* (tan x) (tan x)))
25.0ms
(* (tan x) (tan x))

simplify1.1s

Counts
29 → 72
Calls

29 calls. Slowest were:

198.0ms
(- (/ 1 (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1)) (/ (pow (sin x) 2) (* (pow (cos x) 2) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))))
198.0ms
(log (- (+ (/ 1 (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1)) 1) (/ (pow (sin x) 2) (* (pow (cos x) 2) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1)))))
150.0ms
(- (/ 1 (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1)) (/ (pow (sin x) 2) (* (pow (cos x) 2) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))))

prune870.0ms

Pruning

13 alts after pruning (12 fresh and 1 done)

Merged error: 0.0b

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

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 101
Calls

4 calls. Slowest were:

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

series254.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

115.0ms
(/ (fma (tan x) (tan x) 1) (- 1 (* (tan x) (tan x))))
86.0ms
(/ 1 (/ (fma (tan x) (tan x) 1) (- 1 (* (tan x) (tan x)))))
32.0ms
(* (tan x) (tan x))
22.0ms
(- 1 (* (tan x) (tan x)))

simplify1.8s

Counts
71 → 113
Calls

71 calls. Slowest were:

236.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))
223.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)))))
183.0ms
(/ (- 1 (/ (pow (sin x) 2) (pow (cos x) 2))) (+ (/ (pow (sin x) 2) (pow (cos x) 2)) 1))

prune1.1s

Pruning

13 alts after pruning (12 fresh and 1 done)

Merged error: 0.0b

localize8.0ms

Local error

Found 4 expressions with local error:

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

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 109
Calls

4 calls. Slowest were:

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

series241.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

111.0ms
(/ (/ 1 (fma (tan x) (tan x) 1)) (/ 1 (- 1 (* (tan x) (tan x)))))
67.0ms
(/ 1 (fma (tan x) (tan x) 1))
38.0ms
(- 1 (* (tan x) (tan x)))
26.0ms
(* (tan x) (tan x))

simplify9.2s

Counts
93 → 121
Calls

93 calls. Slowest were:

1.8s
(/ (* (* (/ 1 (fma (tan x) (tan x) 1)) (/ 1 (fma (tan x) (tan x) 1))) (/ 1 (fma (tan x) (tan x) 1))) (* (* (/ 1 (- 1 (* (tan x) (tan x)))) (/ 1 (- 1 (* (tan x) (tan x))))) (/ 1 (- 1 (* (tan x) (tan x))))))
677.0ms
(/ (* (cbrt (/ 1 (fma (tan x) (tan x) 1))) (cbrt (/ 1 (fma (tan x) (tan x) 1)))) (/ 1 (- (pow 1 3) (pow (* (tan x) (tan x)) 3))))
409.0ms
(/ (sqrt (/ 1 (fma (tan x) (tan x) 1))) (/ 1 (- (pow 1 3) (pow (* (tan x) (tan x)) 3))))

prune1.2s

Pruning

12 alts after pruning (10 fresh and 2 done)

Merged error: 0.0b

regimes155.0ms

Accuracy

0% (0.3b remaining)

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

bsearch2.0ms

end0.0ms

sample6.0s

Algorithm
intervals