Average Error: 0.6 → 0.6
Time: 34.9s
Precision: 64
Internal Precision: 128
\[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)\]
\[\frac{\pi}{2} - \sin^{-1} \left(\frac{(\left(v \cdot v\right) \cdot -5 + 1)_*}{(v \cdot v + -1)_*}\right)\]

Error

Bits error versus v

Derivation

  1. Initial program 0.6

    \[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)\]
  2. Simplified0.6

    \[\leadsto \color{blue}{\cos^{-1} \left(\frac{(\left(-5 \cdot v\right) \cdot v + 1)_*}{(v \cdot v + -1)_*}\right)}\]
  3. Using strategy rm
  4. Applied acos-asin0.6

    \[\leadsto \color{blue}{\frac{\pi}{2} - \sin^{-1} \left(\frac{(\left(-5 \cdot v\right) \cdot v + 1)_*}{(v \cdot v + -1)_*}\right)}\]
  5. Taylor expanded around 0 0.6

    \[\leadsto \frac{\pi}{2} - \sin^{-1} \left(\frac{\color{blue}{1 - 5 \cdot {v}^{2}}}{(v \cdot v + -1)_*}\right)\]
  6. Simplified0.6

    \[\leadsto \frac{\pi}{2} - \sin^{-1} \left(\frac{\color{blue}{(\left(v \cdot v\right) \cdot -5 + 1)_*}}{(v \cdot v + -1)_*}\right)\]
  7. Final simplification0.6

    \[\leadsto \frac{\pi}{2} - \sin^{-1} \left(\frac{(\left(v \cdot v\right) \cdot -5 + 1)_*}{(v \cdot v + -1)_*}\right)\]

Reproduce

herbie shell --seed 2019016 +o rules:numerics
(FPCore (v)
  :name "Falkner and Boettcher, Appendix B, 1"
  (acos (/ (- 1 (* 5 (* v v))) (- (* v v) 1))))

Details

Time bar (total: 33.8s)Debug log

sample252.0ms

Algorithm
intervals
Results
524×(pre true 80)
268×(body nan 80)
94×(body real 2560)
77×(body real 1280)
44×(body real 640)
22×(body real 320)
11×(body real 80)
(body real 160)

simplify600.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
600.0ms
(acos (/ (- 1 (* 5 (* v v))) (- (* v v) 1)))

prune9.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.4b

localize18.0ms

Local error

Found 3 expressions with local error:

0.4b
(acos (/ (fma (* -5 v) v 1) (fma v v -1)))
0.0b
(fma (* -5 v) v 1)
0.0b
(/ (fma (* -5 v) v 1) (fma v v -1))

rewrite5.0ms

Algorithm
rewrite-expression-head
Rules
11×add-cube-cbrt
11×*-un-lft-identity
11×add-sqr-sqrt
times-frac
add-exp-log
add-cbrt-cube
add-log-exp
associate-/l*
log1p-expm1-u
associate-/r*
pow1
expm1-log1p-u
div-inv
fma-udef
div-exp
frac-2neg
clear-num
cbrt-undiv
acos-asin
Counts
3 → 49
Calls
3 calls:
Slowest
3.0ms
(/ (fma (* -5 v) v 1) (fma v v -1))
1.0ms
(acos (/ (fma (* -5 v) v 1) (fma v v -1)))
0.0ms
(fma (* -5 v) v 1)

series67.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
35.0ms
(fma (* -5 v) v 1)
29.0ms
(/ (fma (* -5 v) v 1) (fma v v -1))
3.0ms
(acos (/ (fma (* -5 v) v 1) (fma v v -1)))

simplify2.8s

Counts
34 → 58
Calls
34 calls:
Slowest
559.0ms
(- (+ (* 4 (/ 1 (pow v 4))) (+ 5 (* 4 (/ 1 (pow v 2))))))
496.0ms
(- (+ (* 4 (/ 1 (pow v 4))) (+ 5 (* 4 (/ 1 (pow v 2))))))
397.0ms
(/ (* (* (fma (* -5 v) v 1) (fma (* -5 v) v 1)) (fma (* -5 v) v 1)) (* (* (fma v v -1) (fma v v -1)) (fma v v -1)))
97.0ms
(/ (sqrt (fma (* -5 v) v 1)) (cbrt (fma v v -1)))
96.0ms
(/ (sqrt (fma (* -5 v) v 1)) (sqrt (fma v v -1)))

prune555.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.4b

localize9.0ms

Local error

Found 4 expressions with local error:

0.5b
(asin (/ (fma (* -5 v) v 1) (fma v v -1)))
0.0b
(- (/ PI 2) (asin (/ (fma (* -5 v) v 1) (fma v v -1))))
0.0b
(fma (* -5 v) v 1)
0.0b
(/ (fma (* -5 v) v 1) (fma v v -1))

rewrite14.0ms

Algorithm
rewrite-expression-head
Rules
22×*-un-lft-identity
22×add-sqr-sqrt
20×add-cube-cbrt
12×prod-diff
times-frac
add-log-exp
add-exp-log
add-cbrt-cube
div-inv
log1p-expm1-u
fma-neg
pow1
expm1-log1p-u
associate-/l*
associate-/r*
asin-acos
difference-of-squares
associate--r-
distribute-lft-out--
flip--
fma-udef
div-exp
diff-log
flip3--
frac-2neg
sub-neg
clear-num
cbrt-undiv
Counts
4 → 82
Calls
4 calls:
Slowest
8.0ms
(- (/ PI 2) (asin (/ (fma (* -5 v) v 1) (fma v v -1))))
4.0ms
(/ (fma (* -5 v) v 1) (fma v v -1))
1.0ms
(asin (/ (fma (* -5 v) v 1) (fma v v -1)))
0.0ms
(fma (* -5 v) v 1)

series116.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
42.0ms
(/ (fma (* -5 v) v 1) (fma v v -1))
40.0ms
(- (/ PI 2) (asin (/ (fma (* -5 v) v 1) (fma v v -1))))
31.0ms
(fma (* -5 v) v 1)
3.0ms
(asin (/ (fma (* -5 v) v 1) (fma v v -1)))

simplify5.6s

Counts
68 → 94
Calls
68 calls:
Slowest
554.0ms
(- (+ (* 4 (/ 1 (pow v 4))) (+ 5 (* 4 (/ 1 (pow v 2))))))
506.0ms
(- (+ (* 4 (/ 1 (pow v 4))) (+ 5 (* 4 (/ 1 (pow v 2))))))
378.0ms
(/ (* (* (fma (* -5 v) v 1) (fma (* -5 v) v 1)) (fma (* -5 v) v 1)) (* (* (fma v v -1) (fma v v -1)) (fma v v -1)))
119.0ms
(/ (exp (/ PI 2)) (exp (asin (/ (fma (* -5 v) v 1) (fma v v -1)))))
117.0ms
(fma (- (asin (/ (fma (* -5 v) v 1) (fma v v -1)))) 1 (* (asin (/ (fma (* -5 v) v 1) (fma v v -1))) 1))

prune955.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.4b

localize28.0ms

Local error

Found 4 expressions with local error:

0.5b
(asin (/ (fma (* v v) -5 1) (fma v v -1)))
0.0b
(- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1))))
0.0b
(fma (* v v) -5 1)
0.0b
(/ (fma (* v v) -5 1) (fma v v -1))

rewrite10.0ms

Algorithm
rewrite-expression-head
Rules
22×*-un-lft-identity
22×add-sqr-sqrt
20×add-cube-cbrt
12×prod-diff
times-frac
add-log-exp
add-exp-log
add-cbrt-cube
div-inv
log1p-expm1-u
fma-neg
pow1
expm1-log1p-u
associate-/l*
associate-/r*
asin-acos
difference-of-squares
associate--r-
distribute-lft-out--
flip--
fma-udef
div-exp
diff-log
flip3--
frac-2neg
sub-neg
clear-num
cbrt-undiv
Counts
4 → 82
Calls
4 calls:
Slowest
5.0ms
(- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1))))
3.0ms
(/ (fma (* v v) -5 1) (fma v v -1))
1.0ms
(asin (/ (fma (* v v) -5 1) (fma v v -1)))
0.0ms
(fma (* v v) -5 1)

series100.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
38.0ms
(/ (fma (* v v) -5 1) (fma v v -1))
35.0ms
(- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1))))
24.0ms
(fma (* v v) -5 1)
3.0ms
(asin (/ (fma (* v v) -5 1) (fma v v -1)))

simplify5.3s

Counts
68 → 94
Calls
68 calls:
Slowest
512.0ms
(- (+ (* 4 (/ 1 (pow v 4))) (+ 5 (* 4 (/ 1 (pow v 2))))))
473.0ms
(- (+ (* 4 (/ 1 (pow v 4))) (+ 5 (* 4 (/ 1 (pow v 2))))))
317.0ms
(/ (* (* (fma (* v v) -5 1) (fma (* v v) -5 1)) (fma (* v v) -5 1)) (* (* (fma v v -1) (fma v v -1)) (fma v v -1)))
130.0ms
(fma (sqrt (/ PI 2)) (sqrt (/ PI 2)) (- (* (cbrt (asin (/ (fma (* v v) -5 1) (fma v v -1)))) (* (cbrt (asin (/ (fma (* v v) -5 1) (fma v v -1)))) (cbrt (asin (/ (fma (* v v) -5 1) (fma v v -1))))))))
117.0ms
(fma (- (cbrt (asin (/ (fma (* v v) -5 1) (fma v v -1))))) (* (cbrt (asin (/ (fma (* v v) -5 1) (fma v v -1)))) (cbrt (asin (/ (fma (* v v) -5 1) (fma v v -1))))) (* (cbrt (asin (/ (fma (* v v) -5 1) (fma v v -1)))) (* (cbrt (asin (/ (fma (* v v) -5 1) (fma v v -1)))) (cbrt (asin (/ (fma (* v v) -5 1) (fma v v -1)))))))

prune1.0s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0.4b

localize10.0ms

Local error

Found 4 expressions with local error:

1.0b
(* (sqrt (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1))))) (sqrt (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1))))))
1.0b
(sqrt (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1)))))
1.0b
(sqrt (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1)))))
0.5b
(asin (/ (fma (* v v) -5 1) (fma v v -1)))

rewrite38.0ms

Algorithm
rewrite-expression-head
Rules
20×sqrt-prod
20×add-sqr-sqrt
18×*-un-lft-identity
16×sqrt-div
10×add-cube-cbrt
pow1
flip--
associate-*l*
associate-*r*
flip3--
add-exp-log
pow1/2
add-cbrt-cube
difference-of-squares
add-log-exp
distribute-lft-out--
log1p-expm1-u
frac-times
expm1-log1p-u
pow-prod-up
associate-*r/
associate-*l/
pow-prod-down
rem-sqrt-square
cbrt-unprod
*-commutative
prod-exp
sqrt-unprod
pow-plus
rem-square-sqrt
asin-acos
pow2
Counts
4 → 90
Calls
4 calls:
Slowest
24.0ms
(* (sqrt (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1))))) (sqrt (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1))))))
7.0ms
(sqrt (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1)))))
5.0ms
(sqrt (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1)))))
1.0ms
(asin (/ (fma (* v v) -5 1) (fma v v -1)))

series146.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
58.0ms
(sqrt (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1)))))
52.0ms
(sqrt (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1)))))
32.0ms
(* (sqrt (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1))))) (sqrt (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1))))))
3.0ms
(asin (/ (fma (* v v) -5 1) (fma v v -1)))

simplify6.5s

Counts
67 → 102
Calls
67 calls:
Slowest
317.0ms
(* (sqrt (- (* (/ PI 2) (/ PI 2)) (* (asin (/ (fma (* v v) -5 1) (fma v v -1))) (asin (/ (fma (* v v) -5 1) (fma v v -1)))))) (sqrt (- (pow (/ PI 2) 3) (pow (asin (/ (fma (* v v) -5 1) (fma v v -1))) 3))))
282.0ms
(* (sqrt (- (pow (/ PI 2) 3) (pow (asin (/ (fma (* v v) -5 1) (fma v v -1))) 3))) (sqrt (- (* (/ PI 2) (/ PI 2)) (* (asin (/ (fma (* v v) -5 1) (fma v v -1))) (asin (/ (fma (* v v) -5 1) (fma v v -1)))))))
268.0ms
(* (sqrt (- (* (/ PI 2) (/ PI 2)) (* (asin (/ (fma (* v v) -5 1) (fma v v -1))) (asin (/ (fma (* v v) -5 1) (fma v v -1)))))) (sqrt (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1))))))
254.0ms
(* (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1)))) (- (/ PI 2) (asin (/ (fma (* v v) -5 1) (fma v v -1)))))
243.0ms
(sqrt (- (* (/ PI 2) (/ PI 2)) (* (asin (/ (fma (* v v) -5 1) (fma v v -1))) (asin (/ (fma (* v v) -5 1) (fma v v -1))))))

prune1.3s

Pruning

9 alts after pruning (7 fresh and 2 done)

Merged error: 0.4b

regimes51.0ms

Accuracy

0% (0.0b remaining)

Error of 0.6b against oracle of 0.6b and baseline of 0.6b

bsearch1.0ms

end0.0ms

sample8.2s

Algorithm
intervals
Results
16013×(pre true 80)
8012×(body nan 80)
2960×(body real 2560)
2506×(body real 1280)
1236×(body real 640)
639×(body real 320)
434×(body real 160)
226×(body real 80)