Average Error: 13.3 → 13.2
Time: 33.2s
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)}\]
\[(\left({\left(\sqrt{\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}}\right)}^{\frac{-1}{2}} \cdot \left({\left(\sqrt{\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)\right) \cdot \left(\frac{F}{\sin B}\right) + \left(\frac{-x}{\tan B}\right))_*\]

Error

Bits error versus F

Bits error versus B

Bits error versus x

Derivation

  1. Initial program 13.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. Simplified13.2

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

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

    \[\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. Using strategy rm
  7. Applied add-sqr-sqrt13.2

    \[\leadsto (\left({\left(\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{\color{blue}{\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))_*\]
  8. Applied sqrt-prod13.2

    \[\leadsto (\left({\left(\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}\right)}^{\frac{-1}{2}} \cdot {\color{blue}{\left(\sqrt{\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}} \cdot \sqrt{\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))_*\]
  9. Applied unpow-prod-down13.2

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

    \[\leadsto (\color{blue}{\left(\left({\left(\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}\right)}^{\frac{-1}{2}} \cdot {\left(\sqrt{\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}}\right)}^{\frac{-1}{2}}\right) \cdot {\left(\sqrt{\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))_*\]
  11. Final simplification13.2

    \[\leadsto (\left({\left(\sqrt{\sqrt{(2 \cdot x + \left((F \cdot F + 2)_*\right))_*}}\right)}^{\frac{-1}{2}} \cdot \left({\left(\sqrt{\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)\right) \cdot \left(\frac{F}{\sin B}\right) + \left(\frac{-x}{\tan B}\right))_*\]

Reproduce

herbie shell --seed 2019016 +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: 30.8s)Debug log

sample851.0ms

Algorithm
intervals
Results
347×(pre true 80)
155×(body real 80)
62×(body nan 80)
54×(body real 1280)
39×(body real 640)
30×(body real 320)
(body real 160)

simplify152.0ms

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

prune27.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 12.8b

localize67.0ms

Local error

Found 4 expressions with local error:

17.2b
(pow (fma 2 x (fma F F 2)) -1/2)
4.7b
(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))

rewrite16.0ms

Algorithm
rewrite-expression-head
Rules
15×add-cube-cbrt
15×*-un-lft-identity
15×add-sqr-sqrt
12×times-frac
add-exp-log
add-cbrt-cube
associate-/r*
pow1
add-log-exp
associate-/l*
log1p-expm1-u
neg-mul-1
expm1-log1p-u
unpow-prod-down
div-inv
frac-2neg
clear-num
fma-udef
associate-/r/
distribute-frac-neg
tan-quot
pow-exp
div-exp
div-sub
pow-pow
cbrt-undiv
pow-to-exp
neg-sub0
Counts
4 → 76
Calls
4 calls:
Slowest
7.0ms
(/ (- x) (tan B))
4.0ms
(pow (fma 2 x (fma F F 2)) -1/2)
1.0ms
(/ F (sin B))
0.0ms
(fma (pow (fma 2 x (fma F F 2)) -1/2) (/ F (sin B)) (/ (- x) (tan B)))

series674.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
240.0ms
(pow (fma 2 x (fma F F 2)) -1/2)
238.0ms
(fma (pow (fma 2 x (fma F F 2)) -1/2) (/ F (sin B)) (/ (- x) (tan B)))
128.0ms
(/ (- x) (tan B))
67.0ms
(/ F (sin B))

simplify1.8s

Counts
54 → 88
Calls
54 calls:
Slowest
244.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (/ x B) (/ (* x (* F (sqrt 1/8))) B)))
224.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)))
213.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))))))
208.0ms
(- (+ (* 3/8 (/ (exp (* -1/2 (- (log 2) (log (/ 1 x))))) (pow x 2))) (exp (* -1/2 (- (log 2) (log (/ 1 x)))))) (* 1/2 (/ (exp (* -1/2 (- (log 2) (log (/ 1 x))))) x)))
206.0ms
(/ (* (* (- x) (- x)) (- x)) (* (* (tan B) (tan B)) (tan B)))

prune1.5s

Pruning

16 alts after pruning (16 fresh and 0 done)

Merged error: 12.3b

localize20.0ms

Local error

Found 4 expressions with local error:

17.2b
(pow (fma 2 x (fma F F 2)) -1/2)
4.7b
(fma (pow (fma 2 x (fma F F 2)) -1/2) (* F (/ 1 (sin B))) (/ (- x) (tan B)))
0.3b
(* F (/ 1 (sin B)))
0.2b
(/ (- x) (tan B))

rewrite12.0ms

Algorithm
rewrite-expression-head
Rules
15×add-cube-cbrt
15×*-un-lft-identity
15×add-sqr-sqrt
12×times-frac
add-exp-log
add-cbrt-cube
pow1
add-log-exp
associate-/l*
log1p-expm1-u
associate-*r*
neg-mul-1
expm1-log1p-u
unpow-prod-down
associate-/r*
div-inv
fma-udef
*-commutative
un-div-inv
associate-/r/
distribute-frac-neg
associate-*r/
tan-quot
pow-exp
div-exp
div-sub
frac-2neg
pow-pow
clear-num
cbrt-undiv
pow-to-exp
neg-sub0
Counts
4 → 77
Calls
4 calls:
Slowest
6.0ms
(/ (- x) (tan B))
2.0ms
(* F (/ 1 (sin B)))
2.0ms
(pow (fma 2 x (fma F F 2)) -1/2)
0.0ms
(fma (pow (fma 2 x (fma F F 2)) -1/2) (* F (/ 1 (sin B))) (/ (- x) (tan B)))

series676.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
238.0ms
(fma (pow (fma 2 x (fma F F 2)) -1/2) (* F (/ 1 (sin B))) (/ (- x) (tan B)))
214.0ms
(pow (fma 2 x (fma F F 2)) -1/2)
164.0ms
(/ (- x) (tan B))
60.0ms
(* F (/ 1 (sin B)))

simplify1.9s

Counts
57 → 89
Calls
57 calls:
Slowest
272.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (/ x B) (/ (* x (* F (sqrt 1/8))) B)))
240.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))))))
237.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))))))
215.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)))
192.0ms
(/ (* (* (- x) (- x)) (- x)) (* (* (tan B) (tan B)) (tan B)))

prune1.5s

Pruning

15 alts after pruning (15 fresh and 0 done)

Merged error: 12.3b

localize22.0ms

Local error

Found 4 expressions with local error:

17.2b
(sqrt (fma 2 x (fma F F 2)))
17.2b
(sqrt (fma 2 x (fma F F 2)))
4.7b
(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))

rewrite21.0ms

Algorithm
rewrite-expression-head
Rules
16×add-exp-log
14×add-sqr-sqrt
12×sqrt-prod
12×add-cube-cbrt
12×*-un-lft-identity
12×unpow-prod-down
prod-exp
associate-*l*
associate-*r*
pow-exp
add-cbrt-cube
pow-to-exp
add-log-exp
log1p-expm1-u
pow1
expm1-log1p-u
pow1/2
rem-sqrt-square
fma-udef
cbrt-unprod
pow-prod-up
*-commutative
pow-prod-down
pow2
Counts
4 → 79
Calls
4 calls:
Slowest
15.0ms
(* (pow (sqrt (fma 2 x (fma F F 2))) -1/2) (pow (sqrt (fma 2 x (fma F F 2))) -1/2))
2.0ms
(sqrt (fma 2 x (fma F F 2)))
2.0ms
(sqrt (fma 2 x (fma F F 2)))
0.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)))

series339.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
162.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)))
68.0ms
(sqrt (fma 2 x (fma F F 2)))
61.0ms
(sqrt (fma 2 x (fma F F 2)))
48.0ms
(* (pow (sqrt (fma 2 x (fma F F 2))) -1/2) (pow (sqrt (fma 2 x (fma F F 2))) -1/2))

simplify1.9s

Counts
50 → 91
Calls
50 calls:
Slowest
293.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (/ x B) (/ (* x (* F (sqrt 1/8))) B)))
225.0ms
(- (+ (sqrt 2) (* x (sqrt 1/2))) (* 1/2 (* (pow x 2) (sqrt 1/8))))
172.0ms
(- (+ (sqrt 2) (* x (sqrt 1/2))) (* 1/2 (* (pow x 2) (sqrt 1/8))))
157.0ms
(- (+ (* 3/2 (* (sqrt 1/32) (pow x 2))) (sqrt 1/2)) (* x (sqrt 1/8)))
83.0ms
(* -1 (/ (* x (cos B)) (sin B)))

prune1.7s

Pruning

13 alts after pruning (13 fresh and 0 done)

Merged error: 11.2b

localize19.0ms

Local error

Found 4 expressions with local error:

17.2b
(sqrt (fma 2 x (fma F F 2)))
17.2b
(sqrt (fma 2 x (fma F F 2)))
17.2b
(sqrt (fma 2 x (fma F F 2)))
4.7b
(fma (* (* (pow (sqrt (fma 2 x (fma F F 2))) -1/2) (pow (sqrt (sqrt (fma 2 x (fma F F 2)))) -1/2)) (pow (sqrt (sqrt (fma 2 x (fma F F 2)))) -1/2)) (/ F (sin B)) (/ (- x) (tan B)))

rewrite3.0ms

Algorithm
rewrite-expression-head
Rules
10×add-sqr-sqrt
sqrt-prod
add-cube-cbrt
*-un-lft-identity
add-log-exp
log1p-expm1-u
add-exp-log
add-cbrt-cube
pow1
expm1-log1p-u
pow1/2
rem-sqrt-square
fma-udef
Counts
4 → 52
Calls
4 calls:
Slowest
1.0ms
(sqrt (fma 2 x (fma F F 2)))
1.0ms
(sqrt (fma 2 x (fma F F 2)))
1.0ms
(sqrt (fma 2 x (fma F F 2)))
0.0ms
(fma (* (* (pow (sqrt (fma 2 x (fma F F 2))) -1/2) (pow (sqrt (sqrt (fma 2 x (fma F F 2)))) -1/2)) (pow (sqrt (sqrt (fma 2 x (fma F F 2)))) -1/2)) (/ F (sin B)) (/ (- x) (tan B)))

series350.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
183.0ms
(fma (* (* (pow (sqrt (fma 2 x (fma F F 2))) -1/2) (pow (sqrt (sqrt (fma 2 x (fma F F 2)))) -1/2)) (pow (sqrt (sqrt (fma 2 x (fma F F 2)))) -1/2)) (/ F (sin B)) (/ (- x) (tan B)))
62.0ms
(sqrt (fma 2 x (fma F F 2)))
55.0ms
(sqrt (fma 2 x (fma F F 2)))
49.0ms
(sqrt (fma 2 x (fma F F 2)))

simplify1.0s

Counts
24 → 64
Calls
24 calls:
Slowest
232.0ms
(- (/ (* F (sqrt 1/2)) B) (+ (/ x B) (/ (* x (* F (sqrt 1/8))) B)))
199.0ms
(- (+ (sqrt 2) (* x (sqrt 1/2))) (* 1/2 (* (pow x 2) (sqrt 1/8))))
199.0ms
(- (+ (sqrt 2) (* x (sqrt 1/2))) (* 1/2 (* (pow x 2) (sqrt 1/8))))
142.0ms
(- (+ (sqrt 2) (* x (sqrt 1/2))) (* 1/2 (* (pow x 2) (sqrt 1/8))))
42.0ms
(sqrt (* (cbrt (fma 2 x (fma F F 2))) (cbrt (fma 2 x (fma F F 2)))))

prune1.3s

Pruning

13 alts after pruning (12 fresh and 1 done)

Merged error: 11.2b

regimes386.0ms

Accuracy

0% (2.1b remaining)

Error of 13.2b against oracle of 11.1b and baseline of 13.2b

bsearch2.0ms

end0.0ms

sample14.6s

Algorithm
intervals
Results
10561×(pre true 80)
4701×(body real 80)
1719×(body real 1280)
1695×(body nan 80)
1389×(body real 640)
714×(body real 320)
343×(body real 160)