Average Error: 31.1 → 0.0
Time: 59.6s
Precision: 64
Internal Precision: 128
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.02783012588450388:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.028560118651481507:\\ \;\;\;\;(\left(\frac{9}{40} \cdot x\right) \cdot x + \left((\frac{-27}{2800} \cdot \left({x}^{4}\right) + \frac{-1}{2})_*\right))_*\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right) \cdot \left(\left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right) \cdot \left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right)\right)}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 3 regimes
  2. if x < -0.02783012588450388

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.0

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]

    if -0.02783012588450388 < x < 0.028560118651481507

    1. Initial program 62.8

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around 0 0.0

      \[\leadsto \color{blue}{\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}\]
    3. Simplified0.0

      \[\leadsto \color{blue}{(\left(\frac{9}{40} \cdot x\right) \cdot x + \left((\frac{-27}{2800} \cdot \left({x}^{4}\right) + \frac{-1}{2})_*\right))_*}\]

    if 0.028560118651481507 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.0

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
    4. Using strategy rm
    5. Applied add-cbrt-cube0.1

      \[\leadsto \color{blue}{\sqrt[3]{\left(\left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right) \cdot \left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right)\right) \cdot \left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right)}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.02783012588450388:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{elif}\;x \le 0.028560118651481507:\\ \;\;\;\;(\left(\frac{9}{40} \cdot x\right) \cdot x + \left((\frac{-27}{2800} \cdot \left({x}^{4}\right) + \frac{-1}{2})_*\right))_*\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right) \cdot \left(\left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right) \cdot \left(\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\right)\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2019004 +o rules:numerics
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  (/ (- x (sin x)) (- x (tan x))))

Details

Time bar (total: 58.9s)Debug log

sample682.0ms

Algorithm
intervals

simplify32.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

31.0ms
(/ (- x (sin x)) (- x (tan x)))

prune11.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 27.6b

localize35.0ms

Local error

Found 3 expressions with local error:

2.2b
(- x (sin x))
2.1b
(- x (tan x))
0.0b
(/ (- x (sin x)) (- x (tan x)))

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
3 → 60
Calls

3 calls. Slowest were:

6.0ms
(/ (- x (sin x)) (- x (tan x)))
3.0ms
(- x (sin x))
1.0ms
(- x (tan x))

series648.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

444.0ms
(- x (sin x))
119.0ms
(/ (- x (sin x)) (- x (tan x)))
86.0ms
(- x (tan x))

simplify1.5s

Counts
39 → 69
Calls

39 calls. Slowest were:

324.0ms
(- (+ 1 (+ (/ (pow (sin x) 2) (* (pow (cos x) 2) (pow x 2))) (/ (sin x) (* (cos x) x)))) (+ (/ (sin x) x) (/ (pow (sin x) 2) (* (cos x) (pow x 2)))))
260.0ms
(- (+ 1 (+ (/ (pow (sin x) 2) (* (pow (cos x) 2) (pow x 2))) (/ (sin x) (* (cos x) x)))) (+ (/ (sin x) x) (/ (pow (sin x) 2) (* (cos x) (pow x 2)))))
218.0ms
(- (+ (* 1/3 (pow x 3)) (+ (* 2/15 (pow x 5)) (* 17/315 (pow x 7)))))

prune717.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.1b

localize9.0ms

Local error

Found 4 expressions with local error:

2.1b
(- x (tan x))
2.1b
(- x (tan x))
1.8b
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
0.1b
(/ (sin x) (- x (tan x)))

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
4 → 175
Calls

4 calls. Slowest were:

9.0ms
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
4.0ms
(/ (sin x) (- x (tan x)))
0.0ms
(- x (tan x))

series487.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

298.0ms
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
77.0ms
(/ (sin x) (- x (tan x)))
60.0ms
(- x (tan x))
52.0ms
(- x (tan x))

simplify32.3s

Counts
239 → 187
Calls

239 calls. Slowest were:

604.0ms
(fma (/ x (- (* x x) (* (tan x) (tan x)))) (+ x (tan x)) (- (* (/ (sin x) (- x (tan x))) 1)))
532.0ms
(fma (/ x (- (* x x) (* (tan x) (tan x)))) (+ x (tan x)) (- (* (/ (sin x) (- x (tan x))) (/ 1 1))))
505.0ms
(fma (sqrt (/ x (- x (tan x)))) (sqrt (/ x (- x (tan x)))) (- (* (/ (sin x) (cbrt (- x (tan x)))) (/ 1 (* (cbrt (- x (tan x))) (cbrt (- x (tan x))))))))

prune1.7s

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.1b

localize11.0ms

Local error

Found 4 expressions with local error:

2.1b
(- x (tan x))
2.1b
(- x (tan x))
2.1b
(- x (tan x))
2.1b
(- x (tan x))

rewrite2.0ms

Algorithm
rewrite-expression-head
Counts
4 → 52
Calls

4 calls. Slowest were:

0.0ms
(- x (tan x))
0.0ms
(- x (tan x))
0.0ms
(- x (tan x))

series197.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

51.0ms
(- x (tan x))
50.0ms
(- x (tan x))
48.0ms
(- x (tan x))
47.0ms
(- x (tan x))

simplify931.0ms

Counts
12 → 64
Calls

12 calls. Slowest were:

231.0ms
(- (+ (* 1/3 (pow x 3)) (+ (* 2/15 (pow x 5)) (* 17/315 (pow x 7)))))
226.0ms
(- (+ (* 1/3 (pow x 3)) (+ (* 2/15 (pow x 5)) (* 17/315 (pow x 7)))))
218.0ms
(- (+ (* 1/3 (pow x 3)) (+ (* 2/15 (pow x 5)) (* 17/315 (pow x 7)))))

prune787.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.1b

localize15.0ms

Local error

Found 3 expressions with local error:

0.2b
(* 9/40 x)
0.1b
(fma -27/2800 (pow x 4) -1/2)
0.0b
(fma (* 9/40 x) x (fma -27/2800 (pow x 4) -1/2))

rewrite1.0ms

Algorithm
rewrite-expression-head
Counts
3 → 30
Calls

3 calls. Slowest were:

0.0ms
(* 9/40 x)
0.0ms
(fma -27/2800 (pow x 4) -1/2)
0.0ms
(fma (* 9/40 x) x (fma -27/2800 (pow x 4) -1/2))

series76.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

46.0ms
(fma -27/2800 (pow x 4) -1/2)
20.0ms
(fma (* 9/40 x) x (fma -27/2800 (pow x 4) -1/2))
10.0ms
(* 9/40 x)

simplify273.0ms

Counts
9 → 39
Calls

9 calls. Slowest were:

82.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
79.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
74.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))

prune380.0ms

Pruning

5 alts after pruning (2 fresh and 3 done)

Merged error: 0.1b

regimes56.0ms

Accuracy

100% (0.0b remaining)

Error of 0.0b against oracle of 0.0b and baseline of 31.1b

bsearch128.0ms

end0.0ms

sample17.9s

Algorithm
intervals