Average Error: 13.7 → 13.0
Time: 34.7s
Precision: 64
Internal Precision: 128
\[\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\]
\[\begin{array}{l} \mathbf{if}\;F \le 6.32901813840737 \cdot 10^{+172}:\\ \;\;\;\;(\left({\left(\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}\right)}^{\frac{-1}{2}}\right) \cdot \left(\frac{F}{\sin B}\right) + \left(\frac{-x}{\tan B}\right))_*\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-x\right) \cdot \cos B}{\sin B}\\ \end{array}\]

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if F < 6.32901813840737e+172

    1. Initial program 9.7

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

      \[\leadsto \color{blue}{(\left({\left((2 \cdot x + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}}\right) \cdot \left(\frac{F}{\sin B}\right) + \left(\frac{-x}{\tan B}\right))_*}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt9.6

      \[\leadsto (\left({\color{blue}{\left(\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*} \cdot \sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}\right)}}^{\frac{-1}{2}}\right) \cdot \left(\frac{F}{\sin B}\right) + \left(\frac{-x}{\tan B}\right))_*\]
    5. Applied unpow-prod-down9.6

      \[\leadsto (\color{blue}{\left({\left(\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}\right)}^{\frac{-1}{2}}\right)} \cdot \left(\frac{F}{\sin B}\right) + \left(\frac{-x}{\tan B}\right))_*\]

    if 6.32901813840737e+172 < F

    1. Initial program 39.9

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

      \[\leadsto \color{blue}{(\left({\left((2 \cdot x + \left((F \cdot F + 2)_*\right))_*\right)}^{\frac{-1}{2}}\right) \cdot \left(\frac{F}{\sin B}\right) + \left(\frac{-x}{\tan B}\right))_*}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt39.8

      \[\leadsto (\left({\color{blue}{\left(\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*} \cdot \sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}\right)}}^{\frac{-1}{2}}\right) \cdot \left(\frac{F}{\sin B}\right) + \left(\frac{-x}{\tan B}\right))_*\]
    5. Applied unpow-prod-down39.8

      \[\leadsto (\color{blue}{\left({\left(\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}\right)}^{\frac{-1}{2}}\right)} \cdot \left(\frac{F}{\sin B}\right) + \left(\frac{-x}{\tan B}\right))_*\]
    6. Taylor expanded around inf 34.4

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot \cos B}{\sin B}}\]
    7. Simplified34.4

      \[\leadsto \color{blue}{\frac{\cos B \cdot \left(-x\right)}{\sin B}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification13.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le 6.32901813840737 \cdot 10^{+172}:\\ \;\;\;\;(\left({\left(\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}\right)}^{\frac{-1}{2}}\right) \cdot \left(\frac{F}{\sin B}\right) + \left(\frac{-x}{\tan B}\right))_*\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-x\right) \cdot \cos B}{\sin B}\\ \end{array}\]

Reproduce

herbie shell --seed 2019007 +o rules:numerics
(FPCore (F B x)
  :name "VandenBroeck and Keller, Equation (23)"
  (+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2))))))

Details

Time bar (total: 31.7s)Debug log

sample713.0ms

Algorithm
intervals

simplify168.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

167.0ms
(+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2)))))

prune22.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 13.6b

localize45.0ms

Local error

Found 4 expressions with local error:

19.7b
(pow (fma 2 x (fma F F 2)) -1/2)
7.1b
(fma (pow (fma 2 x (fma F F 2)) -1/2) (/ F (sin B)) (/ (- x) (tan B)))
0.2b
(/ (- x) (tan B))
0.1b
(/ F (sin B))

rewrite9.0ms

Algorithm
rewrite-expression-head
Counts
4 → 76
Calls

4 calls. Slowest were:

3.0ms
(/ (- x) (tan B))
3.0ms
(pow (fma 2 x (fma F F 2)) -1/2)
0.0ms
(/ F (sin B))

series706.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

279.0ms
(pow (fma 2 x (fma F F 2)) -1/2)
220.0ms
(fma (pow (fma 2 x (fma F F 2)) -1/2) (/ F (sin B)) (/ (- x) (tan B)))
146.0ms
(/ (- x) (tan B))
61.0ms
(/ F (sin B))

simplify1.7s

Counts
54 → 88
Calls

54 calls. Slowest were:

249.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (/ x B) (/ (* x (* F (sqrt 1/8))) B)))
237.0ms
(- (/ (* F (exp (* -1/2 (- (log 2) (log (/ 1 x)))))) (sin B)) (+ (/ (* x (cos B)) (sin B)) (* 1/2 (/ (* F (exp (* -1/2 (- (log 2) (log (/ 1 x)))))) (* x (sin B))))))
213.0ms
(- (/ (* (exp (* -1/2 (- (log -2) (log (/ -1 x))))) F) (sin B)) (+ (/ (* x (cos B)) (sin B)) (* 1/2 (/ (* (exp (* -1/2 (- (log -2) (log (/ -1 x))))) F) (* x (sin B))))))

prune1.4s

Pruning

15 alts after pruning (15 fresh and 0 done)

Merged error: 13.0b

localize10.0ms

Local error

Found 4 expressions with local error:

19.7b
(pow (fma 2 x (fma F F 2)) -1/2)
7.1b
(fma (pow (fma 2 x (fma F F 2)) -1/2) (* F (/ 1 (sin B))) (/ (- x) (tan B)))
0.2b
(* F (/ 1 (sin B)))
0.2b
(/ (- x) (tan B))

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 77
Calls

4 calls. Slowest were:

6.0ms
(/ (- x) (tan B))
3.0ms
(* F (/ 1 (sin B)))
2.0ms
(pow (fma 2 x (fma F F 2)) -1/2)

series619.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

248.0ms
(fma (pow (fma 2 x (fma F F 2)) -1/2) (* F (/ 1 (sin B))) (/ (- x) (tan B)))
193.0ms
(pow (fma 2 x (fma F F 2)) -1/2)
114.0ms
(/ (- x) (tan B))
63.0ms
(* F (/ 1 (sin B)))

simplify1.7s

Counts
57 → 89
Calls

57 calls. Slowest were:

273.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (/ x B) (/ (* x (* F (sqrt 1/8))) B)))
251.0ms
(- (+ (exp (* -1/2 (- (log -2) (log (/ -1 x))))) (* 3/8 (/ (exp (* -1/2 (- (log -2) (log (/ -1 x))))) (pow x 2)))) (* 1/2 (/ (exp (* -1/2 (- (log -2) (log (/ -1 x))))) x)))
222.0ms
(- (/ (* F (exp (* -1/2 (- (log 2) (log (/ 1 x)))))) (sin B)) (+ (/ (* x (cos B)) (sin B)) (* 1/2 (/ (* F (exp (* -1/2 (- (log 2) (log (/ 1 x)))))) (* x (sin B))))))

prune1.7s

Pruning

16 alts after pruning (16 fresh and 0 done)

Merged error: 13.0b

localize24.0ms

Local error

Found 4 expressions with local error:

19.7b
(pow (fma 2 x (fma F F 2)) -1/2)
7.1b
(fma (pow (fma 2 x (fma F F 2)) -1/2) (* F (/ 1 (sin B))) (/ (* (cos B) (- x)) (sin B)))
0.2b
(* F (/ 1 (sin B)))
0.2b
(/ (* (cos B) (- x)) (sin B))

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

12.0ms
(/ (* (cos B) (- x)) (sin B))
2.0ms
(pow (fma 2 x (fma F F 2)) -1/2)
2.0ms
(* F (/ 1 (sin B)))

series557.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

233.0ms
(fma (pow (fma 2 x (fma F F 2)) -1/2) (* F (/ 1 (sin B))) (/ (* (cos B) (- x)) (sin B)))
189.0ms
(pow (fma 2 x (fma F F 2)) -1/2)
72.0ms
(/ (* (cos B) (- x)) (sin B))
63.0ms
(* F (/ 1 (sin B)))

simplify1.7s

Counts
38 → 77
Calls

38 calls. Slowest were:

265.0ms
(- (+ (exp (* -1/2 (- (log -2) (log (/ -1 x))))) (* 3/8 (/ (exp (* -1/2 (- (log -2) (log (/ -1 x))))) (pow x 2)))) (* 1/2 (/ (exp (* -1/2 (- (log -2) (log (/ -1 x))))) x)))
257.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (/ x B) (/ (* x (* F (sqrt 1/8))) B)))
241.0ms
(- (/ (* (exp (* -1/2 (- (log -2) (log (/ -1 x))))) F) (sin B)) (+ (/ (* x (cos B)) (sin B)) (* 1/2 (/ (* (exp (* -1/2 (- (log -2) (log (/ -1 x))))) F) (* x (sin B))))))

prune1.4s

Pruning

17 alts after pruning (16 fresh and 1 done)

Merged error: 13.0b

localize17.0ms

Local error

Found 4 expressions with local error:

19.7b
(sqrt (fma 2 x (fma F F 2)))
19.7b
(sqrt (fma 2 x (fma F F 2)))
7.1b
(fma (* (pow (sqrt (fma 2 x (fma F F 2))) -1/2) (pow (sqrt (fma 2 x (fma F F 2))) -1/2)) (/ F (sin B)) (/ (- x) (tan B)))
0.7b
(* (pow (sqrt (fma 2 x (fma F F 2))) -1/2) (pow (sqrt (fma 2 x (fma F F 2))) -1/2))

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 79
Calls

4 calls. Slowest were:

7.0ms
(* (pow (sqrt (fma 2 x (fma F F 2))) -1/2) (pow (sqrt (fma 2 x (fma F F 2))) -1/2))
3.0ms
(sqrt (fma 2 x (fma F F 2)))
1.0ms
(sqrt (fma 2 x (fma F F 2)))

series339.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

181.0ms
(fma (* (pow (sqrt (fma 2 x (fma F F 2))) -1/2) (pow (sqrt (fma 2 x (fma F F 2))) -1/2)) (/ F (sin B)) (/ (- x) (tan B)))
64.0ms
(sqrt (fma 2 x (fma F F 2)))
59.0ms
(sqrt (fma 2 x (fma F F 2)))
35.0ms
(* (pow (sqrt (fma 2 x (fma F F 2))) -1/2) (pow (sqrt (fma 2 x (fma F F 2))) -1/2))

simplify1.7s

Counts
50 → 91
Calls

50 calls. Slowest were:

207.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (/ x B) (/ (* x (* F (sqrt 1/8))) B)))
189.0ms
(- (+ (sqrt 2) (* x (sqrt 1/2))) (* 1/2 (* (pow x 2) (sqrt 1/8))))
156.0ms
(- (+ (sqrt 2) (* x (sqrt 1/2))) (* 1/2 (* (pow x 2) (sqrt 1/8))))

prune1.5s

Pruning

17 alts after pruning (16 fresh and 1 done)

Merged error: 11.4b

regimes531.0ms

Accuracy

33% (1.5b remaining)

Error of 13.0b against oracle of 11.5b and baseline of 13.7b

bsearch426.0ms

end0.0ms

sample14.5s

Algorithm
intervals