Average Error: 0.2 → 0.2
Time: 20.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: 19.7s)Debug log

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

simplify103.0ms

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

prune26.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.1b

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

rewrite33.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
15.0ms
(/ x (tan B))
13.0ms
(- (/ 1 (sin B)) (/ x (tan B)))
2.0ms
(/ 1 (sin B))

series361.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
190.0ms
(/ x (tan B))
146.0ms
(- (/ 1 (sin B)) (/ x (tan B)))
24.0ms
(/ 1 (sin B))

simplify2.0s

Counts
66 → 85
Calls
66 calls:
Slowest
95.0ms
(fma 1 (/ 1 (sin B)) (- (* (/ 1 (tan B)) x)))
89.0ms
(fma (* (cbrt (/ 1 (sin B))) (cbrt (/ 1 (sin B)))) (cbrt (/ 1 (sin B))) (- (* (/ 1 (tan B)) x)))
89.0ms
(fma 1 (/ 1 (sin B)) (- (* (/ 1 (tan B)) x)))
66.0ms
(+ (* 1/6 B) (+ (/ 1 B) (* 7/360 (pow B 3))))
62.0ms
(fma (sqrt (/ 1 (sin B))) (sqrt (/ 1 (sin B))) (- (* (/ 1 (tan B)) x)))

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

rewrite27.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
15.0ms
(- (/ 1 (sin B)) (* (/ x (sin B)) (cos B)))
9.0ms
(* (/ x (sin B)) (cos B))
2.0ms
(/ 1 (sin B))
1.0ms
(/ x (sin B))

series343.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
157.0ms
(* (/ x (sin B)) (cos B))
96.0ms
(- (/ 1 (sin B)) (* (/ x (sin B)) (cos B)))
76.0ms
(/ x (sin B))
13.0ms
(/ 1 (sin B))

simplify1.5s

Counts
43 → 90
Calls
43 calls:
Slowest
418.0ms
(+ (* 1/6 B) (+ (/ 1 B) (* 7/360 (pow B 3))))
178.0ms
(- (* 1 (sin B)) (* (sin B) (* x (cos B))))
177.0ms
(* (* (* (/ x (sin B)) (/ x (sin B))) (/ x (sin B))) (* (* (cos B) (cos B)) (cos B)))
60.0ms
(fma 1 (/ 1 (sin B)) (- (* (cos B) (/ x (sin B)))))
55.0ms
(fma (- (cos B)) (/ x (sin B)) (* (cos B) (/ x (sin B))))

prune852.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0.0b

localize8.0ms

Local error

Found 2 expressions with local error:

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

rewrite5.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
3.0ms
(/ (- 1 (* x (cos B))) (sin B))
1.0ms
(* x (cos B))

series110.0ms

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

simplify1.2s

Counts
37 → 51
Calls
37 calls:
Slowest
388.0ms
(- (pow 1 3) (pow (* x (cos B)) 3))
200.0ms
(/ (* (* (- 1 (* x (cos B))) (- 1 (* x (cos B)))) (- 1 (* x (cos B)))) (* (* (sin B) (sin B)) (sin B)))
57.0ms
(/ (- 1 (* x (cos B))) (sqrt (sin B)))
55.0ms
(/ (- 1 (* x (cos B))) (sin B))
54.0ms
(- (* 1 1) (* (* x (cos B)) (* x (cos B))))

prune514.0ms

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 0.0b

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

rewrite21.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))))
2.0ms
(* x (/ 1 (tan B)))
2.0ms
(/ 1 (tan B))
1.0ms
(/ 1 (sin B))

series358.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
147.0ms
(- (/ 1 (sin B)) (* x (/ 1 (tan B))))
141.0ms
(* x (/ 1 (tan B)))
47.0ms
(/ 1 (tan B))
23.0ms
(/ 1 (sin B))

simplify917.0ms

Counts
43 → 90
Calls
43 calls:
Slowest
204.0ms
(- (/ 1 B) (+ (* 1/3 B) (* 1/45 (pow B 3))))
90.0ms
(fma 1 (/ 1 (sin B)) (- (* (/ 1 (tan B)) x)))
63.0ms
(fma 1 (/ 1 (sin B)) (- (* (/ 1 (tan B)) x)))
62.0ms
(fma (* (cbrt (/ 1 (sin B))) (cbrt (/ 1 (sin B)))) (cbrt (/ 1 (sin B))) (- (* (/ 1 (tan B)) x)))
55.0ms
(fma (sqrt (/ 1 (sin B))) (sqrt (/ 1 (sin B))) (- (* (/ 1 (tan B)) x)))

prune893.0ms

Pruning

6 alts after pruning (3 fresh and 3 done)

Merged error: 0.0b

regimes112.0ms

Accuracy

0% (0.2b remaining)

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

bsearch2.0ms

end0.0ms

sample8.9s

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)