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

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus a

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 add-sqr-sqrt30.9

    \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \color{blue}{\sqrt{\tan a} \cdot \sqrt{\tan a}}\right)\]
  6. Applied flip--30.9

    \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{\frac{1 \cdot 1 - \left(\tan y \cdot \tan z\right) \cdot \left(\tan y \cdot \tan z\right)}{1 + \tan y \cdot \tan z}}} - \sqrt{\tan a} \cdot \sqrt{\tan a}\right)\]
  7. Applied associate-/r/30.9

    \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 \cdot 1 - \left(\tan y \cdot \tan z\right) \cdot \left(\tan y \cdot \tan z\right)} \cdot \left(1 + \tan y \cdot \tan z\right)} - \sqrt{\tan a} \cdot \sqrt{\tan a}\right)\]
  8. Applied prod-diff30.9

    \[\leadsto x + \color{blue}{\left((\left(\frac{\tan y + \tan z}{1 \cdot 1 - \left(\tan y \cdot \tan z\right) \cdot \left(\tan y \cdot \tan z\right)}\right) \cdot \left(1 + \tan y \cdot \tan z\right) + \left(-\sqrt{\tan a} \cdot \sqrt{\tan a}\right))_* + (\left(-\sqrt{\tan a}\right) \cdot \left(\sqrt{\tan a}\right) + \left(\sqrt{\tan a} \cdot \sqrt{\tan a}\right))_*\right)}\]
  9. Simplified30.9

    \[\leadsto x + \left(\color{blue}{\left(\frac{(\left(\tan y + \tan z\right) \cdot \left(\tan z \cdot \tan y\right) + \left(\tan y + \tan z\right))_*}{1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)} - \tan a\right)} + (\left(-\sqrt{\tan a}\right) \cdot \left(\sqrt{\tan a}\right) + \left(\sqrt{\tan a} \cdot \sqrt{\tan a}\right))_*\right)\]
  10. Simplified0.2

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

    \[\leadsto x + \left(\left(\frac{(\left(\tan y + \tan z\right) \cdot \left(\color{blue}{\frac{\sin z}{\cos z}} \cdot \tan y\right) + \left(\tan y + \tan z\right))_*}{1 - \left(\tan z \cdot \tan y\right) \cdot \left(\tan z \cdot \tan y\right)} - \tan a\right) + 0\right)\]
  13. Applied associate-*l/0.2

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

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

Reproduce

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

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

simplify23.0ms

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

prune9.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 14.8b

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

rewrite26.0ms

Algorithm
rewrite-expression-head
Rules
18×prod-diff
18×*-un-lft-identity
18×add-sqr-sqrt
16×add-cube-cbrt
11×associate-+r+
add-log-exp
tan-quot
log1p-expm1-u
add-exp-log
fma-neg
add-cbrt-cube
pow1
expm1-log1p-u
frac-sub
sub-neg
tan-sum
difference-of-squares
distribute-lft-out--
flip--
flip-+
diff-log
flip3--
flip3-+
associate-+r-
+-commutative
Counts
3 → 65
Calls
3 calls:
Slowest
12.0ms
(+ x (- (tan (+ y z)) (tan a)))
11.0ms
(- (tan (+ y z)) (tan a))
3.0ms
(tan (+ y z))

series291.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
145.0ms
(+ x (- (tan (+ y z)) (tan a)))
101.0ms
(- (tan (+ y z)) (tan a))
45.0ms
(tan (+ y z))

simplify1.1s

Counts
50 → 74
Calls
50 calls:
Slowest
210.0ms
(- (* (+ (tan y) (tan z)) (cos a)) (* (- 1 (* (tan y) (tan z))) (sin a)))
131.0ms
(* (- 1 (* (tan y) (tan z))) (cos a))
45.0ms
(+ (* 1/3 (pow y 3)) (+ z y))
43.0ms
(fma (sqrt (tan (+ y z))) (sqrt (tan (+ y z))) (- (* (sqrt (tan a)) (sqrt (tan a)))))
43.0ms
(- (+ (/ (sin (+ z y)) (cos (+ z y))) x) (/ (sin a) (cos a)))

prune992.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.1b

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

rewrite107.0ms

Algorithm
rewrite-expression-head
Rules
145×*-un-lft-identity
108×prod-diff
104×add-sqr-sqrt
99×add-cube-cbrt
85×times-frac
56×associate-+r+
22×distribute-lft-out
18×fma-neg
14×associate-/r/
add-log-exp
flip--
flip3--
div-inv
tan-quot
add-exp-log
add-cbrt-cube
pow1
log1p-expm1-u
expm1-log1p-u
associate-*l*
associate-*r*
fma-def
difference-of-squares
flip-+
flip3-+
sub-neg
+-commutative
distribute-lft-out--
cbrt-unprod
frac-sub
*-commutative
associate-*r/
prod-exp
frac-add
associate-*l/
pow-prod-down
diff-log
sum-log
associate-+r-
frac-times
Counts
4 → 199
Calls
4 calls:
Slowest
58.0ms
(- (/ (+ (tan y) (tan z)) (- 1 (* (tan y) (tan z)))) (tan a))
32.0ms
(+ x (- (/ (+ (tan y) (tan z)) (- 1 (* (tan y) (tan z)))) (tan a)))
9.0ms
(* (tan y) (tan z))
4.0ms
(+ (tan y) (tan z))

series1.2s

Counts
4 → 12
Calls
4 calls:
Slowest
485.0ms
(+ x (- (/ (+ (tan y) (tan z)) (- 1 (* (tan y) (tan z)))) (tan a)))
467.0ms
(- (/ (+ (tan y) (tan z)) (- 1 (* (tan y) (tan z)))) (tan a))
139.0ms
(+ (tan y) (tan z))
107.0ms
(* (tan y) (tan z))

simplify13.6s

Counts
220 → 211
Calls
220 calls:
Slowest
607.0ms
(fma (/ 1 (sqrt (- 1 (* (tan y) (tan z))))) (/ (+ (tan y) (tan z)) (sqrt (- 1 (* (tan y) (tan z))))) (- (* (sqrt (tan a)) (sqrt (tan a)))))
543.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)))
464.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))))))
419.0ms
(fma (/ (+ (tan y) (tan z)) (- (pow 1 3) (pow (* (tan y) (tan z)) 3))) (+ (* 1 1) (+ (* (* (tan y) (tan z)) (* (tan y) (tan z))) (* 1 (* (tan y) (tan z))))) (- (* (sqrt (tan a)) (sqrt (tan a)))))
393.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))))) (- (* (sqrt (tan a)) (sqrt (tan a)))))

prune2.9s

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.3b
(* (* (tan z) (tan y)) (* (tan z) (tan y)))
0.2b
(* (tan z) (tan y))
0.2b
(* (tan z) (tan y))
0.2b
(* (tan z) (tan y))

rewrite41.0ms

Algorithm
rewrite-expression-head
Rules
44×tan-quot
37×pow1
22×add-exp-log
22×add-cbrt-cube
20×frac-times
16×pow-prod-down
14×associate-*r/
14×associate-*l/
11×cbrt-unprod
11×prod-exp
10×add-cube-cbrt
10×associate-*l*
10×associate-*r*
10×*-un-lft-identity
10×add-sqr-sqrt
add-log-exp
log1p-expm1-u
pow-prod-up
*-commutative
expm1-log1p-u
pow-plus
pow2
Counts
4 → 112
Calls
4 calls:
Slowest
23.0ms
(* (* (tan z) (tan y)) (* (tan z) (tan y)))
8.0ms
(* (tan z) (tan y))
4.0ms
(* (tan z) (tan y))
4.0ms
(* (tan z) (tan y))

series406.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
129.0ms
(* (* (tan z) (tan y)) (* (tan z) (tan y)))
95.0ms
(* (tan z) (tan y))
95.0ms
(* (tan z) (tan y))
87.0ms
(* (tan z) (tan y))

simplify4.5s

Counts
96 → 124
Calls
96 calls:
Slowest
599.0ms
(* (* (* (* (tan z) (tan y)) (* (tan z) (tan y))) (* (tan z) (tan y))) (* (* (* (tan z) (tan z)) (tan z)) (* (* (tan y) (tan y)) (tan y))))
541.0ms
(* (* (* (* (tan z) (tan z)) (tan z)) (* (* (tan y) (tan y)) (tan y))) (* (* (* (tan z) (tan y)) (* (tan z) (tan y))) (* (tan z) (tan y))))
533.0ms
(* (* (* (* (tan z) (tan y)) (* (tan z) (tan y))) (* (tan z) (tan y))) (* (* (* (tan z) (tan y)) (* (tan z) (tan y))) (* (tan z) (tan y))))
376.0ms
(/ (* (pow (sin z) 2) (pow (sin y) 2)) (* (pow (cos y) 2) (pow (cos z) 2)))
360.0ms
(/ (* (pow (sin z) 2) (pow (sin y) 2)) (* (pow (cos y) 2) (pow (cos z) 2)))

prune2.0s

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0.0b

localize37.0ms

Local error

Found 4 expressions with local error:

0.3b
(* (* (tan z) (tan y)) (* (tan z) (tan y)))
0.2b
(* (sin z) (tan y))
0.2b
(* (tan z) (tan y))
0.2b
(* (tan z) (tan y))

rewrite34.0ms

Algorithm
rewrite-expression-head
Rules
41×tan-quot
37×pow1
22×add-exp-log
22×add-cbrt-cube
19×frac-times
16×pow-prod-down
14×associate-*r/
13×associate-*l/
11×cbrt-unprod
11×prod-exp
10×add-cube-cbrt
10×associate-*l*
10×associate-*r*
10×*-un-lft-identity
10×add-sqr-sqrt
add-log-exp
log1p-expm1-u
pow-prod-up
*-commutative
expm1-log1p-u
pow-plus
pow2
Counts
4 → 110
Calls
4 calls:
Slowest
19.0ms
(* (* (tan z) (tan y)) (* (tan z) (tan y)))
4.0ms
(* (tan z) (tan y))
4.0ms
(* (tan z) (tan y))
4.0ms
(* (sin z) (tan y))

series395.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
109.0ms
(* (sin z) (tan y))
106.0ms
(* (* (tan z) (tan y)) (* (tan z) (tan y)))
94.0ms
(* (tan z) (tan y))
86.0ms
(* (tan z) (tan y))

simplify3.5s

Counts
93 → 122
Calls
93 calls:
Slowest
476.0ms
(* (* (* (* (tan z) (tan y)) (* (tan z) (tan y))) (* (tan z) (tan y))) (* (* (* (tan z) (tan z)) (tan z)) (* (* (tan y) (tan y)) (tan y))))
449.0ms
(* (* (* (* (tan z) (tan z)) (tan z)) (* (* (tan y) (tan y)) (tan y))) (* (* (* (tan z) (tan y)) (* (tan z) (tan y))) (* (tan z) (tan y))))
413.0ms
(* (* (* (* (tan z) (tan y)) (* (tan z) (tan y))) (* (tan z) (tan y))) (* (* (* (tan z) (tan y)) (* (tan z) (tan y))) (* (tan z) (tan y))))
327.0ms
(/ (* (pow (sin z) 2) (pow (sin y) 2)) (* (pow (cos y) 2) (pow (cos z) 2)))
283.0ms
(/ (* (pow (sin z) 2) (pow (sin y) 2)) (* (pow (cos y) 2) (pow (cos z) 2)))

prune1.9s

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 0.0b

regimes366.0ms

Accuracy

0% (0.1b remaining)

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

bsearch3.0ms

end0.0ms

sample11.8s

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)