Average Error: 30.8 → 0.2
Time: 13.5s
Precision: 64
Internal Precision: 128
\[\log \left(x + \sqrt{x \cdot x - 1}\right)\]
\[\log \left((2 \cdot x + \left(\frac{\frac{-1}{2}}{x}\right))_* - \frac{\frac{\frac{1}{8}}{x}}{x \cdot x}\right)\]

Error

Bits error versus x

Derivation

  1. Initial program 30.8

    \[\log \left(x + \sqrt{x \cdot x - 1}\right)\]
  2. Simplified30.8

    \[\leadsto \color{blue}{\log \left(x + \sqrt{(x \cdot x + -1)_*}\right)}\]
  3. Taylor expanded around inf 0.2

    \[\leadsto \log \color{blue}{\left(2 \cdot x - \left(\frac{1}{8} \cdot \frac{1}{{x}^{3}} + \frac{1}{2} \cdot \frac{1}{x}\right)\right)}\]
  4. Simplified0.2

    \[\leadsto \log \color{blue}{\left((2 \cdot x + \left(\frac{\frac{-1}{2}}{x}\right))_* - \frac{\frac{\frac{1}{8}}{x}}{x \cdot x}\right)}\]
  5. Final simplification0.2

    \[\leadsto \log \left((2 \cdot x + \left(\frac{\frac{-1}{2}}{x}\right))_* - \frac{\frac{\frac{1}{8}}{x}}{x \cdot x}\right)\]

Reproduce

herbie shell --seed 2019016 +o rules:numerics
(FPCore (x)
  :name "Hyperbolic arc-cosine"
  (log (+ x (sqrt (- (* x x) 1)))))

Details

Time bar (total: 13.2s)Debug log

sample149.0ms

Algorithm
intervals
Results
1040×(pre true 80)
514×(body nan 80)
269×(body nan 160)
257×(body real 80)

simplify84.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
84.0ms
(log (+ x (sqrt (- (* x x) 1))))

prune16.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 30.5b

localize30.0ms

Local error

Found 3 expressions with local error:

29.3b
(sqrt (fma x x -1))
0.0b
(+ x (sqrt (fma x x -1)))
0.0b
(log (+ x (sqrt (fma x x -1))))

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
add-sqr-sqrt
add-cube-cbrt
*-un-lft-identity
add-exp-log
pow1
add-log-exp
log1p-expm1-u
sqrt-prod
add-cbrt-cube
log-prod
expm1-log1p-u
flip-+
flip3-+
log-div
log-pow
rem-log-exp
pow1/2
rem-sqrt-square
+-commutative
Counts
3 → 42
Calls
3 calls:
Slowest
2.0ms
(log (+ x (sqrt (fma x x -1))))
2.0ms
(+ x (sqrt (fma x x -1)))
2.0ms
(sqrt (fma x x -1))

series160.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
101.0ms
(log (+ x (sqrt (fma x x -1))))
31.0ms
(sqrt (fma x x -1))
27.0ms
(+ x (sqrt (fma x x -1)))

simplify2.8s

Counts
19 → 51
Calls
19 calls:
Slowest
452.0ms
(- (+ (* 1/2 (/ (pow x 2) (sqrt -1))) (sqrt -1)) (* 1/8 (/ (pow x 4) (pow (sqrt -1) 3))))
410.0ms
(+ (log -1/2) (+ (log (/ -1 x)) (+ (* 3/32 (/ 1 (pow x 4))) (* 1/4 (/ 1 (pow x 2))))))
354.0ms
(log (- (* x x) (* (sqrt (fma x x -1)) (sqrt (fma x x -1)))))
278.0ms
(- (* 2 x) (+ (* 1/8 (/ 1 (pow x 3))) (* 1/2 (/ 1 x))))
271.0ms
(- (+ (log (sqrt -1)) (/ x (sqrt -1))) (* 1/6 (/ (pow x 3) (pow (sqrt -1) 3))))

prune427.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0b

localize39.0ms

Local error

Found 1 expressions with local error:

0.1b
(/ (/ 1/8 x) (* x x))

rewrite5.0ms

Algorithm
rewrite-expression-head
Rules
associate-/l*
times-frac
div-inv
add-cube-cbrt
add-exp-log
add-cbrt-cube
*-un-lft-identity
add-sqr-sqrt
associate-/l/
add-log-exp
log1p-expm1-u
div-exp
frac-2neg
associate-/r*
clear-num
cbrt-undiv
pow1
expm1-log1p-u
Counts
1 → 24
Calls
1 calls:
Slowest
5.0ms
(/ (/ 1/8 x) (* x x))

series19.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
19.0ms
(/ (/ 1/8 x) (* x x))

simplify591.0ms

Counts
15 → 27
Calls
15 calls:
Slowest
520.0ms
(/ (* (* (/ 1/8 x) (/ 1/8 x)) (/ 1/8 x)) (* (* (* x x) (* x x)) (* x x)))
44.0ms
(- (log (/ 1/8 x)) (log (* x x)))
5.0ms
(/ (* (cbrt (/ 1/8 x)) (cbrt (/ 1/8 x))) x)
4.0ms
(/ 1/8 (pow x 3))
4.0ms
(/ 1/8 (pow x 3))

prune199.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize18.0ms

Local error

Found 4 expressions with local error:

29.3b
(sqrt (fma x x -1))
29.3b
(sqrt (fma x x -1))
29.3b
(sqrt (fma x x -1))
0.6b
(cbrt (sqrt (fma x x -1)))

rewrite4.0ms

Algorithm
rewrite-expression-head
Rules
12×sqrt-prod
12×add-sqr-sqrt
add-cube-cbrt
*-un-lft-identity
cbrt-prod
add-log-exp
log1p-expm1-u
add-exp-log
add-cbrt-cube
pow1
expm1-log1p-u
pow1/2
rem-sqrt-square
pow1/3
Counts
4 → 58
Calls
4 calls:
Slowest
1.0ms
(sqrt (fma x x -1))
1.0ms
(cbrt (sqrt (fma x x -1)))
1.0ms
(sqrt (fma x x -1))
1.0ms
(sqrt (fma x x -1))

series209.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
132.0ms
(cbrt (sqrt (fma x x -1)))
33.0ms
(sqrt (fma x x -1))
22.0ms
(sqrt (fma x x -1))
22.0ms
(sqrt (fma x x -1))

simplify2.9s

Counts
30 → 70
Calls
30 calls:
Slowest
441.0ms
(- (+ (* 1/2 (/ (pow x 2) (sqrt -1))) (sqrt -1)) (* 1/8 (/ (pow x 4) (pow (sqrt -1) 3))))
434.0ms
(- (+ (* 1/2 (/ (pow x 2) (sqrt -1))) (sqrt -1)) (* 1/8 (/ (pow x 4) (pow (sqrt -1) 3))))
370.0ms
(- (+ (* 1/2 (/ (pow x 2) (sqrt -1))) (sqrt -1)) (* 1/8 (/ (pow x 4) (pow (sqrt -1) 3))))
246.0ms
(- (pow -1 1/6) (+ (* 1/6 (* (pow x 2) (pow -1 1/6))) (* 5/72 (* (pow x 4) (pow -1 1/6)))))
209.0ms
(- x (+ (* 1/8 (/ 1 (pow x 3))) (* 1/2 (/ 1 x))))

prune736.0ms

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes21.0ms

Accuracy

0% (0.2b remaining)

Error of 0.2b against oracle of 0.0b and baseline of 0.2b

bsearch1.0ms

end0.0ms

sample4.8s

Algorithm
intervals
Results
32215×(pre true 80)
16356×(body nan 80)
8000×(body real 80)
7859×(body nan 160)