Average Error: 13.7 → 0.3
Time: 42.1s
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.26640685551953 \cdot 10^{+29}:\\ \;\;\;\;\left(\frac{1}{{F}^{2}} - 1\right) \cdot \frac{1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \le 7.689949620103517 \cdot 10^{+16}:\\ \;\;\;\;\frac{F}{\sin B} \cdot {\left(2 \cdot x + \left(2 + F \cdot F\right)\right)}^{\frac{-1}{2}} - \frac{\cos B \cdot x}{\sin B}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{\sin B} - \frac{1}{\sin B \cdot {F}^{2}}\right) - \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.26640685551953e+29

    1. Initial program 26.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. Initial simplification26.6

      \[\leadsto {\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 div-inv26.6

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

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

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

    if -6.26640685551953e+29 < F < 7.689949620103517e+16

    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. Initial simplification0.3

      \[\leadsto {\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 7.689949620103517e+16 < F

    1. Initial program 26.3

      \[\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. Initial simplification26.2

      \[\leadsto {\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 div-inv26.2

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

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

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

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

Reproduce

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

start1.8s

Algorithm
intervals

setup194.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 15.3b

localize43.0ms

Local error

Found 4 expressions with local error:

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

rewrite28.0ms

Algorithm
rewrite-expression-head
Counts
4 → 63
Calls

4 calls. Slowest were:

18.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
7.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
0.0ms
(/ x (tan B))

series422.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

164.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
109.0ms
(/ x (tan B))
95.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
53.0ms
(/ F (sin B))

simplify1.3s

Counts
38 → 75
Calls

38 calls. Slowest were:

242.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))
239.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))))
196.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))

prune1.3s

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize15.0ms

Local error

Found 4 expressions with local error:

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

rewrite43.0ms

Algorithm
rewrite-expression-head
Counts
4 → 60
Calls

4 calls. Slowest were:

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

series412.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

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

simplify1.9s

Counts
37 → 72
Calls

37 calls. Slowest were:

374.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)) (* (* (/ 1 (sin B)) (/ 1 (sin B))) (/ 1 (sin B))))
262.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))
230.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))

prune1.4s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0.0b

localize22.0ms

Local error

Found 4 expressions with local error:

18.7b
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
0.3b
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
0.2b
(* (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (/ 1 (sin B)))
0.2b
(* (/ x (sin B)) (cos B))

rewrite45.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

20.0ms
(* (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (/ 1 (sin B)))
10.0ms
(* (/ x (sin B)) (cos B))
9.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)

series370.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

144.0ms
(* (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (/ 1 (sin B)))
123.0ms
(* (/ x (sin B)) (cos B))
61.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
43.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)

simplify2.0s

Counts
42 → 77
Calls

42 calls. Slowest were:

309.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)) (* (* (/ 1 (sin B)) (/ 1 (sin B))) (/ 1 (sin B))))
248.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))
225.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))

prune1.5s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0.0b

localize19.0ms

Local error

Found 4 expressions with local error:

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

rewrite49.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

20.0ms
(* (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (/ 1 (sin B)))
18.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
8.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)

series361.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

156.0ms
(* (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (/ 1 (sin B)))
112.0ms
(/ 1 (/ (tan B) x))
51.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
42.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)

simplify1.8s

Counts
38 → 76
Calls

38 calls. Slowest were:

367.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)) (* (* (/ 1 (sin B)) (/ 1 (sin B))) (/ 1 (sin B))))
261.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))
257.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))

prune1.5s

Pruning

10 alts after pruning (8 fresh and 2 done)

Merged error: 0.0b

regimes287.0ms

Accuracy

98.1% (0.2b remaining)

Error of 0.3b against oracle of 0.0b and baseline of 10.9b

bsearch992.0ms