Average Error: 13.6 → 0.3
Time: 34.9s
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.860224735929818 \cdot 10^{+41}:\\ \;\;\;\;\frac{\frac{1}{{F}^{2}} - 1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \le 293756.7212820923:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(x \cdot 2 + \left(F \cdot F + 2\right)\right)}^{\frac{-1}{2}} - \frac{x \cdot \cos B}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \frac{1}{{F}^{2}}}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]

Error

Bits error versus F

Bits error versus B

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if F < -6.860224735929818e+41

    1. Initial program 27.5

      \[\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. Simplified27.5

      \[\leadsto \color{blue}{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}}\]
    3. Using strategy rm
    4. Applied associate-*r/21.4

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

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

      \[\leadsto \frac{\color{blue}{\left({\left(\sqrt{\left(2 + F \cdot F\right) + 2 \cdot x}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{\left(2 + F \cdot F\right) + 2 \cdot x}\right)}^{\frac{-1}{2}}\right)} \cdot F}{\sin B} - \frac{x}{\tan B}\]
    8. Applied associate-*l*21.5

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

      \[\leadsto \frac{\color{blue}{\frac{1}{{F}^{2}} - 1}}{\sin B} - \frac{x}{\tan B}\]

    if -6.860224735929818e+41 < F < 293756.7212820923

    1. Initial program 0.4

      \[\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. Simplified0.3

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

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

    if 293756.7212820923 < F

    1. Initial program 24.6

      \[\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. Simplified24.5

      \[\leadsto \color{blue}{{\left(\left(2 + F \cdot F\right) + 2 \cdot x\right)}^{\frac{-1}{2}} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}}\]
    3. Using strategy rm
    4. Applied associate-*r/19.0

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

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

      \[\leadsto \frac{\color{blue}{\left({\left(\sqrt{\left(2 + F \cdot F\right) + 2 \cdot x}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{\left(2 + F \cdot F\right) + 2 \cdot x}\right)}^{\frac{-1}{2}}\right)} \cdot F}{\sin B} - \frac{x}{\tan B}\]
    8. Applied associate-*l*19.1

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

      \[\leadsto \frac{\color{blue}{1 - \frac{1}{{F}^{2}}}}{\sin B} - \frac{x}{\tan B}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \le -6.860224735929818 \cdot 10^{+41}:\\ \;\;\;\;\frac{\frac{1}{{F}^{2}} - 1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \le 293756.7212820923:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(x \cdot 2 + \left(F \cdot F + 2\right)\right)}^{\frac{-1}{2}} - \frac{x \cdot \cos B}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \frac{1}{{F}^{2}}}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]

Reproduce

herbie shell --seed 2019005 
(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: 33.4s)Debug log

sample540.0ms

Algorithm
intervals

simplify150.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune33.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 13.9b

localize45.0ms

Local error

Found 4 expressions with local error:

16.3b
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
6.9b
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
0.1b
(/ x (tan B))
0.1b
(/ F (sin B))

rewrite50.0ms

Algorithm
rewrite-expression-head
Counts
4 → 63
Calls

4 calls. Slowest were:

24.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
21.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
1.0ms
(/ x (tan B))

series479.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

176.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
135.0ms
(/ x (tan B))
101.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
67.0ms
(/ F (sin B))

simplify1.3s

Counts
38 → 75
Calls

38 calls. Slowest were:

249.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))
244.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))
199.0ms
(* (* (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)) (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)) (* (* (/ F (sin B)) (/ F (sin B))) (/ F (sin B))))

prune1.1s

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize10.0ms

Local error

Found 4 expressions with local error:

16.3b
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
0.7b
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
0.3b
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
0.1b
(/ x (tan B))

rewrite37.0ms

Algorithm
rewrite-expression-head
Counts
4 → 60
Calls

4 calls. Slowest were:

18.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
12.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
5.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)

series405.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

157.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
142.0ms
(/ x (tan B))
61.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
45.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)

simplify2.1s

Counts
38 → 72
Calls

38 calls. Slowest were:

640.0ms
(/ (* (* (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)) (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)) (* (* (sin B) (sin B)) (sin B)))
278.0ms
(- (* F (sqrt 1/2)) (+ (* 1/4 (/ (* x F) (sqrt 1/2))) (* 1/2 (* (pow F 3) (sqrt 1/8)))))
226.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))

prune1.0s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0.0b

localize20.0ms

Local error

Found 4 expressions with local error:

16.2b
(sqrt (+ (+ 2 (* F F)) (* 2 x)))
16.2b
(sqrt (+ (+ 2 (* F F)) (* 2 x)))
0.7b
(/ (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) F)) (sin B))
0.3b
(* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) F))

rewrite73.0ms

Algorithm
rewrite-expression-head
Counts
4 → 73
Calls

4 calls. Slowest were:

38.0ms
(/ (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) F)) (sin B))
27.0ms
(* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) F))
4.0ms
(sqrt (+ (+ 2 (* F F)) (* 2 x)))

series282.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

160.0ms
(/ (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) F)) (sin B))
56.0ms
(* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) F))
35.0ms
(sqrt (+ (+ 2 (* F F)) (* 2 x)))
31.0ms
(sqrt (+ (+ 2 (* F F)) (* 2 x)))

simplify4.6s

Counts
52 → 85
Calls

52 calls. Slowest were:

720.0ms
(sqrt (+ (pow (+ 2 (* F F)) 3) (pow (* 2 x) 3)))
688.0ms
(sqrt (+ (pow (+ 2 (* F F)) 3) (pow (* 2 x) 3)))
483.0ms
(* (* (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2)) (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2)) (* (* (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) F) (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) F)) (* (pow (sqrt (+ (+ 2 (* F F)) (* 2 x))) -1/2) F)))

prune1.5s

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0.0b

localize18.0ms

Local error

Found 4 expressions with local error:

16.3b
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
0.7b
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
0.3b
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
0.3b
(/ 1 (/ (tan B) x))

rewrite38.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

16.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
11.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
8.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)

series378.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

175.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
79.0ms
(/ 1 (/ (tan B) x))
74.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
51.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)

simplify2.1s

Counts
39 → 76
Calls

39 calls. Slowest were:

525.0ms
(/ (* (* (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)) (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)) (* (* (sin B) (sin B)) (sin B)))
276.0ms
(- (* F (sqrt 1/2)) (+ (* 1/4 (/ (* x F) (sqrt 1/2))) (* 1/2 (* (pow F 3) (sqrt 1/8)))))
252.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))

prune1.1s

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0.0b

regimes248.0ms

Accuracy

98% (0.2b remaining)

Error of 0.3b against oracle of 0.1b and baseline of 10.5b

bsearch935.0ms

end0.0ms

sample14.9s

Algorithm
intervals