Average Error: 13.1 → 0.2
Time: 1.1m
Precision: 64
Internal Precision: 128
\[x + \left(\tan \left(y + z\right) - \tan a\right)\]
\[\frac{(\left(\tan y + \tan z\right) \cdot \left(\cos a\right) + \left((\left(\tan y\right) \cdot \left(\tan z\right) + -1)_* \cdot \sin a\right))_*}{\left(1 - \tan z \cdot \tan y\right) \cdot \cos a} + x\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

Derivation

  1. Initial program 13.1

    \[x + \left(\tan \left(y + z\right) - \tan a\right)\]
  2. Using strategy rm
  3. Applied tan-sum0.2

    \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right)\]
  4. Using strategy rm
  5. Applied tan-quot0.2

    \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \color{blue}{\frac{\sin a}{\cos a}}\right)\]
  6. Applied frac-sub0.2

    \[\leadsto x + \color{blue}{\frac{\left(\tan y + \tan z\right) \cdot \cos a - \left(1 - \tan y \cdot \tan z\right) \cdot \sin a}{\left(1 - \tan y \cdot \tan z\right) \cdot \cos a}}\]
  7. Simplified0.2

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

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

Reproduce

herbie shell --seed 2018362 +o rules:numerics
(FPCore (x y z a)
  :name "(+ x (- (tan (+ y z)) (tan a)))"
  :pre (and (or (== x 0) (<= 0.5884142 x 505.5909)) (or (<= -1.796658e+308 y -9.425585e-310) (<= 1.284938e-309 y 1.751224e+308)) (or (<= -1.776707e+308 z -8.599796e-310) (<= 3.293145e-311 z 1.725154e+308)) (or (<= -1.796658e+308 a -9.425585e-310) (<= 1.284938e-309 a 1.751224e+308)))
  (+ x (- (tan (+ y z)) (tan a))))

Details

Time bar (total: 47.7s)Debug log

start570.0ms

Algorithm
intervals

setup62.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 10.4b

localize31.0ms

Local error

Found 3 expressions with local error:

1.6b
(tan (+ y z))
0.1b
(+ x (- (tan (+ y z)) (tan a)))
0.1b
(- (tan (+ y z)) (tan a))

rewrite29.0ms

Algorithm
rewrite-expression-head
Counts
3 → 65
Calls

3 calls. Slowest were:

19.0ms
(- (tan (+ y z)) (tan a))
6.0ms
(+ x (- (tan (+ y z)) (tan a)))
3.0ms
(tan (+ y z))

series344.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

141.0ms
(+ x (- (tan (+ y z)) (tan a)))
139.0ms
(- (tan (+ y z)) (tan a))
64.0ms
(tan (+ y z))

simplify1.1s

Counts
50 → 74
Calls

50 calls. Slowest were:

224.0ms
(- (* (+ (tan y) (tan z)) (cos a)) (* (- 1 (* (tan y) (tan z))) (sin a)))
108.0ms
(* (- 1 (* (tan y) (tan z))) (cos a))
49.0ms
(- (+ (/ (sin (+ z y)) (cos (+ z y))) x) (/ (sin a) (cos a)))

prune915.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0.1b

localize25.0ms

Local error

Found 4 expressions with local error:

0.2b
(* (tan y) (tan z))
0.1b
(+ x (- (/ (+ (tan y) (tan z)) (- 1 (* (tan y) (tan z)))) (tan a)))
0.1b
(- (/ (+ (tan y) (tan z)) (- 1 (* (tan y) (tan z)))) (tan a))
0.1b
(+ (tan y) (tan z))

rewrite116.0ms

Algorithm
rewrite-expression-head
Counts
4 → 199
Calls

4 calls. Slowest were:

58.0ms
(- (/ (+ (tan y) (tan z)) (- 1 (* (tan y) (tan z)))) (tan a))
46.0ms
(+ x (- (/ (+ (tan y) (tan z)) (- 1 (* (tan y) (tan z)))) (tan a)))
4.0ms
(* (tan y) (tan z))

series1.0s

Counts
4 → 12
Calls

4 calls. Slowest were:

421.0ms
(+ x (- (/ (+ (tan y) (tan z)) (- 1 (* (tan y) (tan z)))) (tan a)))
390.0ms
(- (/ (+ (tan y) (tan z)) (- 1 (* (tan y) (tan z)))) (tan a))
108.0ms
(+ (tan y) (tan z))
108.0ms
(* (tan y) (tan z))

simplify14.6s

Counts
220 → 211
Calls

220 calls. Slowest were:

615.0ms
(fma (/ 1 (* (cbrt (- 1 (* (tan y) (tan z)))) (cbrt (- 1 (* (tan y) (tan z)))))) (/ (+ (tan y) (tan z)) (cbrt (- 1 (* (tan y) (tan z))))) (- (* (cbrt (tan a)) (* (cbrt (tan a)) (cbrt (tan a))))))
544.0ms
(fma (/ 1 (* (cbrt (- 1 (* (tan y) (tan z)))) (cbrt (- 1 (* (tan y) (tan z)))))) (/ (+ (tan y) (tan z)) (cbrt (- 1 (* (tan y) (tan z))))) (- (* (cbrt (tan a)) (* (cbrt (tan a)) (cbrt (tan a))))))
523.0ms
(fma (/ 1 (* (cbrt (- 1 (* (tan y) (tan z)))) (cbrt (- 1 (* (tan y) (tan z)))))) (/ (+ (tan y) (tan z)) (cbrt (- 1 (* (tan y) (tan z))))) (- (* (tan a) 1)))

prune3.5s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0.0b

localize42.0ms

Local error

Found 4 expressions with local error:

0.2b
(* (sin y) (tan z))
0.2b
(/ (* (sin y) (tan z)) (cos y))
0.1b
(+ x (- (/ (+ (tan y) (tan z)) (- 1 (/ (* (sin y) (tan z)) (cos y)))) (tan a)))
0.1b
(- (/ (+ (tan y) (tan z)) (- 1 (/ (* (sin y) (tan z)) (cos y)))) (tan a))

rewrite113.0ms

Algorithm
rewrite-expression-head
Counts
4 → 203
Calls

4 calls. Slowest were:

55.0ms
(- (/ (+ (tan y) (tan z)) (- 1 (/ (* (sin y) (tan z)) (cos y)))) (tan a))
39.0ms
(+ x (- (/ (+ (tan y) (tan z)) (- 1 (/ (* (sin y) (tan z)) (cos y)))) (tan a)))
7.0ms
(/ (* (sin y) (tan z)) (cos y))

series1.1s

Counts
4 → 12
Calls

4 calls. Slowest were:

501.0ms
(- (/ (+ (tan y) (tan z)) (- 1 (/ (* (sin y) (tan z)) (cos y)))) (tan a))
409.0ms
(+ x (- (/ (+ (tan y) (tan z)) (- 1 (/ (* (sin y) (tan z)) (cos y)))) (tan a)))
136.0ms
(/ (* (sin y) (tan z)) (cos y))
86.0ms
(* (sin y) (tan z))

simplify15.2s

Counts
226 → 215
Calls

226 calls. Slowest were:

508.0ms
(fma (/ 1 (* (cbrt (- 1 (/ (* (sin y) (tan z)) (cos y)))) (cbrt (- 1 (/ (* (sin y) (tan z)) (cos y)))))) (/ (+ (tan y) (tan z)) (cbrt (- 1 (/ (* (sin y) (tan z)) (cos y))))) (- (* (sqrt (tan a)) (sqrt (tan a)))))
480.0ms
(/ (* (* (* (sin y) (tan z)) (* (sin y) (tan z))) (* (sin y) (tan z))) (* (* (cos y) (cos y)) (cos y)))
458.0ms
(fma (sqrt (/ (+ (tan y) (tan z)) (- 1 (/ (* (sin y) (tan z)) (cos y))))) (sqrt (/ (+ (tan y) (tan z)) (- 1 (/ (* (sin y) (tan z)) (cos y))))) (- (* (sqrt (tan a)) (sqrt (tan a)))))

prune3.1s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0.0b

localize25.0ms

Local error

Found 4 expressions with local error:

0.2b
(/ (fma (+ (tan y) (tan z)) (cos a) (* (fma (tan y) (tan z) -1) (sin a))) (* (- 1 (* (tan y) (tan z))) (cos a)))
0.2b
(* (tan y) (tan z))
0.1b
(fma (+ (tan y) (tan z)) (cos a) (* (fma (tan y) (tan z) -1) (sin a)))
0.1b
(+ x (/ (fma (+ (tan y) (tan z)) (cos a) (* (fma (tan y) (tan z) -1) (sin a))) (* (- 1 (* (tan y) (tan z))) (cos a))))

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 69
Calls

4 calls. Slowest were:

6.0ms
(/ (fma (+ (tan y) (tan z)) (cos a) (* (fma (tan y) (tan z) -1) (sin a))) (* (- 1 (* (tan y) (tan z))) (cos a)))
4.0ms
(* (tan y) (tan z))
2.0ms
(+ x (/ (fma (+ (tan y) (tan z)) (cos a) (* (fma (tan y) (tan z) -1) (sin a))) (* (- 1 (* (tan y) (tan z))) (cos a))))

series1.1s

Counts
4 → 12
Calls

4 calls. Slowest were:

428.0ms
(+ x (/ (fma (+ (tan y) (tan z)) (cos a) (* (fma (tan y) (tan z) -1) (sin a))) (* (- 1 (* (tan y) (tan z))) (cos a))))
383.0ms
(/ (fma (+ (tan y) (tan z)) (cos a) (* (fma (tan y) (tan z) -1) (sin a))) (* (- 1 (* (tan y) (tan z))) (cos a)))
242.0ms
(fma (+ (tan y) (tan z)) (cos a) (* (fma (tan y) (tan z) -1) (sin a)))
82.0ms
(* (tan y) (tan z))

simplify2.9s

Counts
39 → 81
Calls

39 calls. Slowest were:

276.0ms
(/ (- (+ (/ (* (cos a) (sin z)) (cos z)) (+ (/ (* (sin a) (* (sin z) (sin y))) (* (cos y) (cos z))) (/ (* (cos a) (sin y)) (cos y)))) (sin a)) (* (cos a) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z))))))
259.0ms
(/ (- (+ (/ (* (cos a) (sin z)) (cos z)) (+ (/ (* (sin a) (* (sin z) (sin y))) (* (cos y) (cos z))) (/ (* (cos a) (sin y)) (cos y)))) (sin a)) (* (cos a) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z))))))
200.0ms
(+ (* 1/3 (* (pow z 3) y)) (+ (* 1/3 (* z (pow y 3))) (* z y)))

prune1.2s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 0.0b

regimes472.0ms

Accuracy

0% (0.1b remaining)

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

bsearch3.0ms