Average Error: 14.3 → 0.3
Time: 31.4s
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.9920120047445207 \cdot 10^{+28}:\\ \;\;\;\;\frac{\frac{1}{{F}^{2}} - 1}{\sin B} - \frac{x}{\tan B}\\ \mathbf{elif}\;F \le 0.028712724924549283:\\ \;\;\;\;\frac{{\left(x \cdot 2 + \left(F \cdot F + 2\right)\right)}^{\frac{-1}{2}}}{\frac{\sin B}{F}} - \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.9920120047445207e+28

    1. Initial program 28.0

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

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

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

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

    if -1.9920120047445207e+28 < F < 0.028712724924549283

    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 associate-*r/0.3

      \[\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 associate-/l*0.3

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

    if 0.028712724924549283 < F

    1. Initial program 24.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. Simplified24.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/19.5

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

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

Reproduce

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

sample616.0ms

Algorithm
intervals

simplify147.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
147.0ms
(+ (- (* x (/ 1 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2) (* 2 x)) (- (/ 1 2)))))

prune37.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 13.6b

localize88.0ms

Local error

Found 4 expressions with local error:

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

rewrite36.0ms

Algorithm
rewrite-expression-head
Rules
10×add-cube-cbrt
10×add-exp-log
10×*-un-lft-identity
10×add-sqr-sqrt
associate-*l*
add-cbrt-cube
unpow-prod-down
associate-/r*
pow1
add-log-exp
associate-*r*
div-inv
prod-exp
pow-exp
frac-2neg
clear-num
pow-to-exp
cbrt-unprod
*-commutative
associate-/r/
associate-*r/
tan-quot
pow-pow
Counts
4 → 63
Calls
4 calls:
Slowest
20.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
10.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
1.0ms
(/ x (tan B))
1.0ms
(/ F (sin B))

series408.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
141.0ms
(/ x (tan B))
119.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) (/ F (sin B)))
94.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
53.0ms
(/ F (sin B))

simplify1.1s

Counts
38 → 75
Calls
38 calls:
Slowest
238.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))
186.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))))
170.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))
84.0ms
(+ (* (log (+ (+ 2 (* F F)) (* 2 x))) -1/2) (log (/ F (sin B))))
48.0ms
(+ (* (log (+ (+ 2 (* F F)) (* 2 x))) -1/2) (log (/ F (sin B))))

prune1.1s

Pruning

13 alts after pruning (13 fresh and 0 done)

Merged error: 0.0b

localize11.0ms

Local error

Found 4 expressions with local error:

17.0b
(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) (sin B))
0.2b
(/ x (tan B))

rewrite36.0ms

Algorithm
rewrite-expression-head
Rules
10×add-cube-cbrt
10×*-un-lft-identity
10×add-sqr-sqrt
add-exp-log
associate-*l*
add-cbrt-cube
unpow-prod-down
associate-/r*
pow1
add-log-exp
times-frac
div-inv
frac-2neg
clear-num
associate-/l*
*-commutative
associate-/r/
tan-quot
pow-exp
div-exp
pow-pow
cbrt-undiv
pow-to-exp
Counts
4 → 60
Calls
4 calls:
Slowest
19.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
11.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
4.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
1.0ms
(/ x (tan B))

series376.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
131.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
126.0ms
(/ x (tan B))
64.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
56.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)

simplify1.9s

Counts
38 → 72
Calls
38 calls:
Slowest
593.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)))
281.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))
195.0ms
(- (* F (sqrt 1/2)) (+ (* 1/4 (/ (* x F) (sqrt 1/2))) (* 1/2 (* (pow F 3) (sqrt 1/8)))))
178.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))
75.0ms
(- (log (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)) (log (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:

17.0b
(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) (sin B))
0.2b
(* (/ x (sin B)) (cos B))

rewrite30.0ms

Algorithm
rewrite-expression-head
Rules
11×add-cube-cbrt
11×*-un-lft-identity
11×add-sqr-sqrt
10×associate-*l*
add-exp-log
add-cbrt-cube
pow1
unpow-prod-down
add-log-exp
associate-*r*
times-frac
associate-/r*
div-inv
*-commutative
associate-/l*
cbrt-unprod
prod-exp
pow-exp
associate-*l/
pow-prod-down
div-exp
frac-2neg
pow-pow
clear-num
cbrt-undiv
pow-to-exp
Counts
4 → 65
Calls
4 calls:
Slowest
12.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
9.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
4.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
4.0ms
(* (/ x (sin B)) (cos B))

series357.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
141.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
120.0ms
(* (/ x (sin B)) (cos B))
59.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
38.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)

simplify1.8s

Counts
43 → 77
Calls
43 calls:
Slowest
461.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)))
238.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (* 1/2 (/ (* (pow F 3) (sqrt 1/8)) B)) (* 1/4 (/ (* x F) (* B (sqrt 1/2))))))
202.0ms
(- (* F (sqrt 1/2)) (+ (* 1/4 (/ (* x F) (sqrt 1/2))) (* 1/2 (* (pow F 3) (sqrt 1/8)))))
158.0ms
(- (pow 2 -1/2) (+ (* 1/2 (* (pow F 2) (sqrt 1/8))) (* 1/2 (* x (sqrt 1/2)))))
141.0ms
(* (* (* (/ x (sin B)) (/ x (sin B))) (/ x (sin B))) (* (* (cos B) (cos B)) (cos B)))

prune1.0s

Pruning

13 alts after pruning (12 fresh and 1 done)

Merged error: 0.0b

localize13.0ms

Local error

Found 4 expressions with local error:

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

rewrite34.0ms

Algorithm
rewrite-expression-head
Rules
10×add-cube-cbrt
10×*-un-lft-identity
10×add-sqr-sqrt
add-exp-log
associate-/r*
associate-*l*
add-cbrt-cube
unpow-prod-down
pow1
add-log-exp
div-inv
times-frac
frac-2neg
clear-num
inv-pow
associate-/l*
pow-flip
*-commutative
associate-/r/
pow-exp
div-exp
pow-pow
rec-exp
cbrt-undiv
pow-to-exp
Counts
4 → 64
Calls
4 calls:
Slowest
15.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)
9.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
8.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
1.0ms
(/ 1 (/ (tan B) x))

series375.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
170.0ms
(/ (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F) (sin B))
84.0ms
(/ 1 (/ (tan B) x))
64.0ms
(pow (+ (+ 2 (* F F)) (* 2 x)) -1/2)
56.0ms
(* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)

simplify1.8s

Counts
39 → 76
Calls
39 calls:
Slowest
509.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)))
274.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)))))
204.0ms
(- (* F (sqrt 1/2)) (+ (* 1/4 (/ (* x F) (sqrt 1/2))) (* 1/2 (* (pow F 3) (sqrt 1/8)))))
57.0ms
(- (log (* (pow (+ (+ 2 (* F F)) (* 2 x)) -1/2) F)) (log (sin B)))

prune1.1s

Pruning

13 alts after pruning (11 fresh and 2 done)

Merged error: 0.0b

regimes427.0ms

Accuracy

97.5% (0.3b remaining)

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

bsearch994.0ms

end0.0ms

sample14.3s

Algorithm
intervals