Average Error: 31.7 → 0.0
Time: 1.0m
Precision: 64
Internal Precision: 128
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.028357622078054152 \lor \neg \left(x \le 0.030441991086110624\right):\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;(\left(\frac{9}{40} \cdot x\right) \cdot x + \left((\frac{-27}{2800} \cdot \left({x}^{4}\right) + \frac{-1}{2})_*\right))_*\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -0.028357622078054152 or 0.030441991086110624 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Initial simplification0.1

      \[\leadsto \frac{x - \sin x}{x - \tan x}\]
    3. Using strategy rm
    4. Applied div-sub0.1

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

    if -0.028357622078054152 < x < 0.030441991086110624

    1. Initial program 62.7

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Initial simplification62.7

      \[\leadsto \frac{x - \sin x}{x - \tan x}\]
    3. 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)}\]
    4. 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))_*}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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

Details

Time bar (total: 41.1s)Debug log

start1.0s

Algorithm
intervals

setup25.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 33.6b

localize32.0ms

Local error

Found 3 expressions with local error:

2.0b
(- x (tan x))
1.8b
(- x (sin x))
0.0b
(/ (- x (sin x)) (- x (tan x)))

rewrite15.0ms

Algorithm
rewrite-expression-head
Counts
3 → 60
Calls

3 calls. Slowest were:

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

series245.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

106.0ms
(- x (tan x))
101.0ms
(/ (- x (sin x)) (- x (tan x)))
37.0ms
(- x (sin x))

simplify1.3s

Counts
39 → 69
Calls

39 calls. Slowest were:

270.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)))))
214.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)))))
201.0ms
(- (+ (* 1/3 (pow x 3)) (+ (* 2/15 (pow x 5)) (* 17/315 (pow x 7)))))

prune598.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

localize15.0ms

Local error

Found 3 expressions with local error:

0.2b
(* 9/40 x)
0.0b
(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))

series109.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

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

simplify229.0ms

Counts
9 → 39
Calls

9 calls. Slowest were:

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

prune573.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize26.0ms

Local error

Found 4 expressions with local error:

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

rewrite19.0ms

Algorithm
rewrite-expression-head
Counts
4 → 42
Calls

4 calls. Slowest were:

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

series164.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

58.0ms
(fma -27/2800 (pow x 4) -1/2)
49.0ms
(cbrt (* (* (fma -27/2800 (pow x 4) -1/2) (fma -27/2800 (pow x 4) -1/2)) (fma -27/2800 (pow x 4) -1/2)))
47.0ms
(fma -27/2800 (pow x 4) -1/2)
10.0ms
(* 9/40 x)

simplify190.0ms

Counts
13 → 54
Calls

13 calls. Slowest were:

48.0ms
(cbrt (* (fma -27/2800 (pow x 4) -1/2) (fma -27/2800 (pow x 4) -1/2)))
20.0ms
(- (+ (* 27/2800 (pow x 4)) 1/2))
20.0ms
(- (+ (* 27/2800 (pow x 4)) 1/2))

prune754.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.0b

localize8.0ms

Local error

Found 4 expressions with local error:

2.0b
(- x (tan x))
2.0b
(- x (tan x))
1.4b
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
0.1b
(/ (sin x) (- x (tan x)))

rewrite21.0ms

Algorithm
rewrite-expression-head
Counts
4 → 175
Calls

4 calls. Slowest were:

7.0ms
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
6.0ms
(/ (sin x) (- x (tan x)))
0.0ms
(- x (tan x))

series508.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

284.0ms
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
80.0ms
(/ (sin x) (- x (tan x)))
79.0ms
(- x (tan x))
65.0ms
(- x (tan x))

simplify33.1s

Counts
239 → 187
Calls

239 calls. Slowest were:

572.0ms
(fma (- (/ (cbrt (sin x)) (- x (tan x)))) (/ (* (cbrt (sin x)) (cbrt (sin x))) 1) (* (/ (cbrt (sin x)) (- x (tan x))) (/ (* (cbrt (sin x)) (cbrt (sin x))) 1)))
566.0ms
(fma (/ x (- (* x x) (* (tan x) (tan x)))) (+ x (tan x)) (- (* (cbrt (/ (sin x) (- x (tan x)))) (* (cbrt (/ (sin x) (- x (tan x)))) (cbrt (/ (sin x) (- x (tan x))))))))
552.0ms
(fma (/ x (- (* x x) (* (tan x) (tan x)))) (+ x (tan x)) (- (* (sqrt (/ (sin x) (- x (tan x)))) (sqrt (/ (sin x) (- x (tan x)))))))

prune1.8s

Pruning

4 alts after pruning (1 fresh and 3 done)

Merged error: 0.0b

regimes81.0ms

Accuracy

100% (0.0b remaining)

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

bsearch170.0ms