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

Error

Bits error versus B

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.2

    \[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\sin B}\]
  2. Simplified0.2

    \[\leadsto \color{blue}{\frac{1}{\sin B} - \frac{x}{\tan B}}\]
  3. Using strategy rm
  4. Applied tan-quot0.2

    \[\leadsto \frac{1}{\sin B} - \frac{x}{\color{blue}{\frac{\sin B}{\cos B}}}\]
  5. Applied associate-/r/0.2

    \[\leadsto \frac{1}{\sin B} - \color{blue}{\frac{x}{\sin B} \cdot \cos B}\]
  6. Final simplification0.2

    \[\leadsto \frac{1}{\sin B} - \frac{x}{\sin B} \cdot \cos B\]

Reproduce

herbie shell --seed 2019016 +o rules:numerics
(FPCore (B x)
  :name "VandenBroeck and Keller, Equation (24)"
  (+ (- (* x (/ 1 (tan B)))) (/ 1 (sin B))))

Details

Time bar (total: 18.0s)Debug log

sample252.0ms

Algorithm
intervals
Results
293×(pre true 80)
154×(body real 80)
64×(body real 1280)
40×(body real 640)
25×(body real 320)
10×(body real 160)

simplify59.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
59.0ms
(+ (- (* x (/ 1 (tan B)))) (/ 1 (sin B)))

prune16.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.1b

localize17.0ms

Local error

Found 3 expressions with local error:

0.2b
(/ x (tan B))
0.1b
(/ 1 (sin B))
0.0b
(- (/ 1 (sin B)) (/ x (tan B)))

rewrite15.0ms

Algorithm
rewrite-expression-head
Rules
20×prod-diff
18×*-un-lft-identity
17×add-sqr-sqrt
15×add-cube-cbrt
13×div-inv
associate-/r*
add-log-exp
associate-/r/
tan-quot
add-exp-log
fma-neg
pow1
log1p-expm1-u
add-cbrt-cube
expm1-log1p-u
distribute-lft-out--
frac-2neg
clear-num
difference-of-squares
inv-pow
flip--
pow-flip
frac-sub
diff-log
flip3--
sub-neg
rec-exp
Counts
3 → 76
Calls
3 calls:
Slowest
12.0ms
(- (/ 1 (sin B)) (/ x (tan B)))
2.0ms
(/ 1 (sin B))
1.0ms
(/ x (tan B))

series261.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
135.0ms
(- (/ 1 (sin B)) (/ x (tan B)))
112.0ms
(/ x (tan B))
14.0ms
(/ 1 (sin B))

simplify1.7s

Counts
66 → 85
Calls
66 calls:
Slowest
90.0ms
(fma 1 (/ 1 (sin B)) (- (* (/ 1 (tan B)) x)))
67.0ms
(fma (* (cbrt (/ 1 (sin B))) (cbrt (/ 1 (sin B)))) (cbrt (/ 1 (sin B))) (- (* (/ 1 (tan B)) x)))
62.0ms
(fma (sqrt (/ 1 (sin B))) (sqrt (/ 1 (sin B))) (- (* (/ 1 (tan B)) x)))
61.0ms
(fma 1 (/ 1 (sin B)) (- (* (cos B) (/ x (sin B)))))
60.0ms
(fma (* (cbrt (/ 1 (sin B))) (cbrt (/ 1 (sin B)))) (cbrt (/ 1 (sin B))) (- (* (cos B) (/ x (sin B)))))

prune730.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0.0b

localize14.0ms

Local error

Found 4 expressions with local error:

0.2b
(* (/ x (sin B)) (cos B))
0.1b
(/ x (sin B))
0.1b
(/ 1 (sin B))
0.0b
(- (/ 1 (sin B)) (* (/ x (sin B)) (cos B)))

rewrite19.0ms

Algorithm
rewrite-expression-head
Rules
10×add-cube-cbrt
10×*-un-lft-identity
10×add-sqr-sqrt
add-exp-log
pow1
add-log-exp
add-cbrt-cube
associate-/r*
div-inv
log1p-expm1-u
prod-diff
associate-*l*
fma-neg
expm1-log1p-u
associate-*l/
associate-*r*
frac-2neg
clear-num
sub-div
inv-pow
flip--
pow-flip
cbrt-unprod
frac-sub
*-commutative
prod-exp
pow-prod-down
diff-log
flip3--
sub-neg
rec-exp
Counts
4 → 78
Calls
4 calls:
Slowest
9.0ms
(- (/ 1 (sin B)) (* (/ x (sin B)) (cos B)))
7.0ms
(* (/ x (sin B)) (cos B))
1.0ms
(/ 1 (sin B))
1.0ms
(/ x (sin B))

series265.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
104.0ms
(* (/ x (sin B)) (cos B))
86.0ms
(- (/ 1 (sin B)) (* (/ x (sin B)) (cos B)))
56.0ms
(/ x (sin B))
18.0ms
(/ 1 (sin B))

simplify941.0ms

Counts
43 → 90
Calls
43 calls:
Slowest
149.0ms
(+ (* 1/6 B) (+ (/ 1 B) (* 7/360 (pow B 3))))
146.0ms
(- (* 1 (sin B)) (* (sin B) (* x (cos B))))
107.0ms
(* (* (* (/ x (sin B)) (/ x (sin B))) (/ x (sin B))) (* (* (cos B) (cos B)) (cos B)))
53.0ms
(- (/ 1 (sin B)) (/ (* x (cos B)) (sin B)))
48.0ms
(- (+ (* 1/6 B) (/ 1 B)) (/ x B))

prune818.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0.0b

localize15.0ms

Local error

Found 2 expressions with local error:

0.2b
(* x (cos B))
0.1b
(/ (- 1 (* x (cos B))) (sin B))

rewrite10.0ms

Algorithm
rewrite-expression-head
Rules
11×add-cube-cbrt
11×*-un-lft-identity
11×add-sqr-sqrt
times-frac
add-exp-log
add-cbrt-cube
associate-/l*
associate-*r*
associate-/r*
associate-/l/
add-log-exp
log1p-expm1-u
pow1
expm1-log1p-u
flip--
div-inv
*-commutative
div-exp
div-sub
flip3--
frac-2neg
clear-num
cbrt-undiv
Counts
2 → 45
Calls
2 calls:
Slowest
6.0ms
(/ (- 1 (* x (cos B))) (sin B))
3.0ms
(* x (cos B))

series135.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
82.0ms
(/ (- 1 (* x (cos B))) (sin B))
53.0ms
(* x (cos B))

simplify1.0s

Counts
37 → 51
Calls
37 calls:
Slowest
346.0ms
(- (pow 1 3) (pow (* x (cos B)) 3))
197.0ms
(/ (* (* (- 1 (* x (cos B))) (- 1 (* x (cos B)))) (- 1 (* x (cos B)))) (* (* (sin B) (sin B)) (sin B)))
45.0ms
(- (/ 1 (sin B)) (/ (* x (cos B)) (sin B)))
36.0ms
(/ (- 1 (* x (cos B))) (sin B))
34.0ms
(- (* 1 1) (* (* x (cos B)) (* x (cos B))))

prune828.0ms

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 0.0b

localize8.0ms

Local error

Found 4 expressions with local error:

0.3b
(* x (/ 1 (tan B)))
0.2b
(/ 1 (tan B))
0.1b
(/ 1 (sin B))
0.0b
(- (/ 1 (sin B)) (* x (/ 1 (tan B))))

rewrite19.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
add-exp-log
associate-/r*
pow1
div-inv
associate-*r*
log1p-expm1-u
prod-diff
fma-neg
add-cbrt-cube
expm1-log1p-u
inv-pow
pow-flip
frac-sub
un-div-inv
associate-/r/
associate-*r/
tan-quot
frac-2neg
clear-num
rec-exp
flip--
*-commutative
diff-log
flip3--
sub-neg
Counts
4 → 78
Calls
4 calls:
Slowest
11.0ms
(- (/ 1 (sin B)) (* x (/ 1 (tan B))))
3.0ms
(* x (/ 1 (tan B)))
2.0ms
(/ 1 (tan B))
2.0ms
(/ 1 (sin B))

series278.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
124.0ms
(* x (/ 1 (tan B)))
97.0ms
(- (/ 1 (sin B)) (* x (/ 1 (tan B))))
34.0ms
(/ 1 (tan B))
24.0ms
(/ 1 (sin B))

simplify952.0ms

Counts
43 → 90
Calls
43 calls:
Slowest
210.0ms
(- (/ 1 B) (+ (* 1/3 B) (* 1/45 (pow B 3))))
73.0ms
(fma (* (cbrt (/ 1 (sin B))) (cbrt (/ 1 (sin B)))) (cbrt (/ 1 (sin B))) (- (* (/ 1 (tan B)) x)))
70.0ms
(fma 1 (/ 1 (sin B)) (- (* (/ 1 (tan B)) x)))
60.0ms
(fma 1 (/ 1 (sin B)) (- (* (/ 1 (tan B)) x)))
53.0ms
(/ (exp (/ 1 (sin B))) (exp (* x (/ 1 (tan B)))))

prune809.0ms

Pruning

6 alts after pruning (3 fresh and 3 done)

Merged error: 0.0b

regimes103.0ms

Accuracy

0% (0.2b remaining)

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

bsearch1.0ms

end0.0ms

sample8.8s

Algorithm
intervals
Results
9115×(pre true 80)
4899×(body real 80)
1754×(body real 1280)
1403×(body real 640)
694×(body real 320)
365×(body real 160)