Average Error: 13.7 → 0.3
Time: 32.0s
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 -1.7288022267860176 \cdot 10^{+23}:\\ \;\;\;\;\frac{\frac{1}{{F}^{2}} - 1}{\sin B} - x \cdot \frac{1}{\tan B}\\ \mathbf{elif}\;F \le 9811.311554800664:\\ \;\;\;\;\left({\left(\sqrt{2 \cdot x + \left(2 + F \cdot F\right)}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{2 \cdot x + \left(2 + F \cdot F\right)}\right)}^{\frac{-1}{2}}\right) \cdot \frac{F}{\sin B} - \frac{x}{\tan 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 < -1.7288022267860176e+23

    1. Initial program 25.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. Simplified25.6

      \[\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/20.2

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

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

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

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

    if -1.7288022267860176e+23 < F < 9811.311554800664

    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. Using strategy rm
    4. Applied add-sqr-sqrt0.4

      \[\leadsto {\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 \frac{F}{\sin B} - \frac{x}{\tan B}\]
    5. Applied unpow-prod-down0.4

      \[\leadsto \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 \frac{F}{\sin B} - \frac{x}{\tan B}\]

    if 9811.311554800664 < F

    1. Initial program 25.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. Simplified25.4

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

      \[\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. Taylor expanded around inf 0.1

      \[\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 -1.7288022267860176 \cdot 10^{+23}:\\ \;\;\;\;\frac{\frac{1}{{F}^{2}} - 1}{\sin B} - x \cdot \frac{1}{\tan B}\\ \mathbf{elif}\;F \le 9811.311554800664:\\ \;\;\;\;\left({\left(\sqrt{2 \cdot x + \left(2 + F \cdot F\right)}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{2 \cdot x + \left(2 + F \cdot F\right)}\right)}^{\frac{-1}{2}}\right) \cdot \frac{F}{\sin B} - \frac{x}{\tan B}\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - \frac{1}{{F}^{2}}}{\sin B} - \frac{x}{\tan B}\\ \end{array}\]

Reproduce

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

sample570.0ms

Algorithm
intervals

simplify138.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune19.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 13.6b

localize61.0ms

Local error

Found 4 expressions with local error:

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

rewrite23.0ms

Algorithm
rewrite-expression-head
Counts
4 → 63
Calls

4 calls. Slowest were:

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

series395.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

134.0ms
(/ x (tan B))
117.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
81.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
62.0ms
(/ F (sin B))

simplify1.3s

Counts
38 → 75
Calls

38 calls. Slowest were:

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

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.0b

localize21.0ms

Local error

Found 4 expressions with local error:

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

rewrite43.0ms

Algorithm
rewrite-expression-head
Counts
4 → 60
Calls

4 calls. Slowest were:

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

series324.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

124.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
107.0ms
(/ x (tan B))
55.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
39.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)

simplify1.8s

Counts
38 → 72
Calls

38 calls. Slowest were:

572.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)))
231.0ms
(- (* F (sqrt 1/2)) (+ (* 1/4 (/ (* x F) (sqrt 1/2))) (* 1/2 (* (pow F 3) (sqrt 1/8)))))
213.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

11 alts after pruning (11 fresh and 0 done)

Merged error: 0.0b

localize9.0ms

Local error

Found 4 expressions with local error:

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

rewrite24.0ms

Algorithm
rewrite-expression-head
Counts
4 → 64
Calls

4 calls. Slowest were:

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

series347.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

131.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
92.0ms
(/ 1 (/ (tan B) x))
62.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
62.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)

simplify2.0s

Counts
39 → 76
Calls

39 calls. Slowest were:

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

prune1.2s

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 0.0b

localize16.0ms

Local error

Found 4 expressions with local error:

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

rewrite51.0ms

Algorithm
rewrite-expression-head
Counts
4 → 60
Calls

4 calls. Slowest were:

20.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
17.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
7.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)

series333.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

127.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
87.0ms
(* (/ 1 (tan B)) x)
62.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
57.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)

simplify2.0s

Counts
38 → 72
Calls

38 calls. Slowest were:

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

prune1.1s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0.0b

regimes408.0ms

Accuracy

98% (0.2b remaining)

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

bsearch1.4s

end0.0ms

sample14.4s

Algorithm
intervals