Average Error: 13.2 → 0.2
Time: 34.8s
Precision: 64
Internal Precision: 128
\[x + \left(\tan \left(y + z\right) - \tan a\right)\]
\[\left(\frac{\frac{\cos z \cdot \sin y + \sin z \cdot \cos y}{\cos y \cdot \cos z}}{1 - \tan z \cdot \tan y} - \tan a\right) + x\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 13.2

    \[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 + \color{blue}{\frac{\sin z}{\cos z}}}{1 - \tan y \cdot \tan z} - \tan a\right)\]
  6. Applied tan-quot0.2

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

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

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

Reproduce

herbie shell --seed 2019016 
(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: 33.8s)Debug log

sample536.0ms

Algorithm
intervals
Results
256×(pre true 80)
125×(body real 1280)
67×(body real 640)
31×(body real 80)
21×(body real 320)
12×(body real 160)

simplify462.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
462.0ms
(+ x (- (tan (+ y z)) (tan a)))

prune7.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 14.8b

localize18.0ms

Local error

Found 3 expressions with local error:

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

rewrite11.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
*-un-lft-identity
add-sqr-sqrt
tan-quot
add-cube-cbrt
add-exp-log
add-cbrt-cube
pow1
frac-sub
sub-neg
associate-+r+
tan-sum
difference-of-squares
distribute-lft-out--
flip--
flip-+
diff-log
flip3--
flip3-+
associate-+r-
+-commutative
Counts
3 → 38
Calls
3 calls:
Slowest
5.0ms
(- (tan (+ y z)) (tan a))
4.0ms
(+ x (- (tan (+ y z)) (tan a)))
1.0ms
(tan (+ y z))

series411.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
175.0ms
(+ x (- (tan (+ y z)) (tan a)))
159.0ms
(- (tan (+ y z)) (tan a))
77.0ms
(tan (+ y z))

simplify501.0ms

Counts
21 → 47
Calls
21 calls:
Slowest
175.0ms
(- (* (+ (tan y) (tan z)) (cos a)) (* (- 1 (* (tan y) (tan z))) (sin a)))
139.0ms
(* (- 1 (* (tan y) (tan z))) (cos a))
36.0ms
(- (+ (/ (sin (+ z y)) (cos (+ z y))) x) (/ (sin a) (cos a)))
31.0ms
(+ (* 1/3 (pow y 3)) (+ z y))
27.0ms
(/ (exp (tan (+ y z))) (exp (tan a)))

prune590.0ms

Pruning

6 alts after pruning (6 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))

rewrite83.0ms

Algorithm
rewrite-expression-head
Rules
11×add-sqr-sqrt
10×*-un-lft-identity
add-log-exp
tan-quot
add-cube-cbrt
add-exp-log
add-cbrt-cube
pow1
associate-*l*
associate-*r*
difference-of-squares
flip-+
flip3-+
sub-neg
associate-+r+
+-commutative
distribute-lft-out--
distribute-lft-out
flip--
cbrt-unprod
frac-sub
*-commutative
associate-*r/
prod-exp
frac-add
associate-*l/
pow-prod-down
diff-log
flip3--
times-frac
sum-log
associate-+r-
frac-times
Counts
4 → 62
Calls
4 calls:
Slowest
40.0ms
(- (/ (+ (tan y) (tan z)) (- 1 (* (tan y) (tan z)))) (tan a))
34.0ms
(+ x (- (/ (+ (tan y) (tan z)) (- 1 (* (tan y) (tan z)))) (tan a)))
5.0ms
(+ (tan y) (tan z))
4.0ms
(* (tan y) (tan z))

series1.1s

Counts
4 → 12
Calls
4 calls:
Slowest
438.0ms
(+ x (- (/ (+ (tan y) (tan z)) (- 1 (* (tan y) (tan z)))) (tan a)))
407.0ms
(- (/ (+ (tan y) (tan z)) (- 1 (* (tan y) (tan z)))) (tan a))
122.0ms
(+ (tan y) (tan z))
105.0ms
(* (tan y) (tan z))

simplify2.0s

Counts
39 → 74
Calls
39 calls:
Slowest
371.0ms
(+ (* 1/3 (* (pow z 3) y)) (+ (* 1/3 (* z (pow y 3))) (* z y)))
254.0ms
(- (+ (/ (sin z) (* (cos z) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z)))))) (+ (/ (sin y) (* (cos y) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z)))))) x)) (/ (sin a) (cos a)))
249.0ms
(- (+ (/ (sin z) (* (cos z) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z)))))) (+ (/ (sin y) (* (cos y) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z)))))) x)) (/ (sin a) (cos a)))
232.0ms
(- (+ (/ (sin z) (* (cos z) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z)))))) (/ (sin y) (* (cos y) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z))))))) (/ (sin a) (cos a)))
227.0ms
(- (+ (/ (sin z) (* (cos z) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z)))))) (/ (sin y) (* (cos y) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z))))))) (/ (sin a) (cos a)))

prune1.1s

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0.1b

localize47.0ms

Local error

Found 4 expressions with local error:

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

rewrite136.0ms

Algorithm
rewrite-expression-head
Rules
13×add-sqr-sqrt
11×add-exp-log
11×add-cbrt-cube
10×*-un-lft-identity
add-cube-cbrt
add-log-exp
pow1
times-frac
tan-quot
associate-*l*
associate-*r*
associate-/r*
difference-of-squares
cbrt-unprod
prod-exp
associate-*l/
div-exp
sub-neg
associate-+r+
cbrt-undiv
associate-/l/
distribute-lft-out--
associate-/l*
flip--
div-inv
flip-+
frac-sub
*-commutative
pow-prod-down
diff-log
flip3--
flip3-+
frac-2neg
associate-+r-
clear-num
+-commutative
Counts
4 → 69
Calls
4 calls:
Slowest
60.0ms
(- (/ (+ (tan y) (tan z)) (- 1 (/ (* (tan y) (sin z)) (cos z)))) (tan a))
49.0ms
(+ x (- (/ (+ (tan y) (tan z)) (- 1 (/ (* (tan y) (sin z)) (cos z)))) (tan a)))
19.0ms
(/ (* (tan y) (sin z)) (cos z))
8.0ms
(* (tan y) (sin z))

series1.0s

Counts
4 → 12
Calls
4 calls:
Slowest
447.0ms
(- (/ (+ (tan y) (tan z)) (- 1 (/ (* (tan y) (sin z)) (cos z)))) (tan a))
375.0ms
(+ x (- (/ (+ (tan y) (tan z)) (- 1 (/ (* (tan y) (sin z)) (cos z)))) (tan a)))
117.0ms
(/ (* (tan y) (sin z)) (cos z))
101.0ms
(* (tan y) (sin z))

simplify3.7s

Counts
47 → 81
Calls
47 calls:
Slowest
543.0ms
(/ (* (* (* (tan y) (sin z)) (* (tan y) (sin z))) (* (tan y) (sin z))) (* (* (cos z) (cos z)) (cos z)))
508.0ms
(/ (* (* (* (tan y) (tan y)) (tan y)) (* (* (sin z) (sin z)) (sin z))) (* (* (cos z) (cos z)) (cos z)))
279.0ms
(+ (* 1/3 (* (pow z 3) y)) (+ (* 1/3 (* z (pow y 3))) (* z y)))
278.0ms
(- (+ (/ (sin z) (* (cos z) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z)))))) (+ (/ (sin y) (* (cos y) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z)))))) x)) (/ (sin a) (cos a)))
272.0ms
(- (+ (* 1/3 (* z (pow y 3))) (* z y)) (* 1/6 (* (pow z 3) y)))

prune1.4s

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0.0b

localize4.0ms

Local error

Found 4 expressions with local error:

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

rewrite219.0ms

Algorithm
rewrite-expression-head
Rules
13×add-sqr-sqrt
11×add-exp-log
11×add-cbrt-cube
10×*-un-lft-identity
add-cube-cbrt
add-log-exp
pow1
times-frac
tan-quot
associate-*l*
associate-*r*
associate-/r*
difference-of-squares
cbrt-unprod
prod-exp
associate-*l/
div-exp
sub-neg
associate-+l+
cbrt-undiv
associate-/l/
distribute-lft-out--
associate-/l*
flip--
div-inv
flip-+
associate-+l-
frac-sub
*-commutative
pow-prod-down
diff-log
flip3--
flip3-+
frac-2neg
clear-num
+-commutative
Counts
4 → 69
Calls
4 calls:
Slowest
169.0ms
(+ (- (/ (+ (tan y) (tan z)) (- 1 (/ (* (tan y) (sin z)) (cos z)))) (tan a)) x)
39.0ms
(- (/ (+ (tan y) (tan z)) (- 1 (/ (* (tan y) (sin z)) (cos z)))) (tan a))
7.0ms
(/ (* (tan y) (sin z)) (cos z))
4.0ms
(* (tan y) (sin z))

series1.5s

Counts
4 → 12
Calls
4 calls:
Slowest
933.0ms
(+ (- (/ (+ (tan y) (tan z)) (- 1 (/ (* (tan y) (sin z)) (cos z)))) (tan a)) x)
393.0ms
(- (/ (+ (tan y) (tan z)) (- 1 (/ (* (tan y) (sin z)) (cos z)))) (tan a))
95.0ms
(/ (* (tan y) (sin z)) (cos z))
70.0ms
(* (tan y) (sin z))

simplify3.7s

Counts
47 → 81
Calls
47 calls:
Slowest
509.0ms
(/ (* (* (* (tan y) (sin z)) (* (tan y) (sin z))) (* (tan y) (sin z))) (* (* (cos z) (cos z)) (cos z)))
461.0ms
(/ (* (* (* (tan y) (tan y)) (tan y)) (* (* (sin z) (sin z)) (sin z))) (* (* (cos z) (cos z)) (cos z)))
290.0ms
(- (+ (/ (sin z) (* (cos z) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z)))))) (/ (sin y) (* (cos y) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z))))))) (/ (sin a) (cos a)))
286.0ms
(- (+ (/ (sin z) (* (cos z) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z)))))) (+ (/ (sin y) (* (cos y) (- 1 (/ (* (sin z) (sin y)) (* (cos y) (cos z)))))) x)) (/ (sin a) (cos a)))
281.0ms
(- (+ (* 1/3 (* z (pow y 3))) (* z y)) (* 1/6 (* (pow z 3) y)))

prune1.3s

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0.0b

regimes431.0ms

Accuracy

0% (0.1b remaining)

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

bsearch2.0ms

end0.0ms

sample13.5s

Algorithm
intervals
Results
8000×(pre true 80)
3936×(body real 1280)
1957×(body real 640)
1124×(body real 80)
713×(body real 320)
270×(body real 160)