Average Error: 4.2 → 0.1
Time: 13.7s
Precision: 64
Internal Precision: 128
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
\[\sqrt{(\left(\sqrt{e^{x}}\right) \cdot \left(\sqrt{e^{x}}\right) + 1)_*}\]

Error

Bits error versus x

Derivation

  1. Initial program 4.2

    \[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
  2. Simplified0.1

    \[\leadsto \color{blue}{\sqrt{e^{x} + 1}}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt0.1

    \[\leadsto \sqrt{\color{blue}{\sqrt{e^{x}} \cdot \sqrt{e^{x}}} + 1}\]
  5. Applied fma-def0.1

    \[\leadsto \sqrt{\color{blue}{(\left(\sqrt{e^{x}}\right) \cdot \left(\sqrt{e^{x}}\right) + 1)_*}}\]
  6. Final simplification0.1

    \[\leadsto \sqrt{(\left(\sqrt{e^{x}}\right) \cdot \left(\sqrt{e^{x}}\right) + 1)_*}\]

Reproduce

herbie shell --seed 2019016 +o rules:numerics
(FPCore (x)
  :name "sqrtexp (problem 3.4.4)"
  (sqrt (/ (- (exp (* 2 x)) 1) (- (exp x) 1))))

Details

Time bar (total: 13.0s)Debug log

sample457.0ms

Algorithm
intervals
Results
814×(pre true 80)
372×(body nan 80)
244×(body real 80)
183×(body exit 10240)
15×(body real 160)

simplify98.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
98.0ms
(sqrt (/ (- (exp (* 2 x)) 1) (- (exp x) 1)))

prune52.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 0.0b

localize795.0ms

Local error

Found 2 expressions with local error:

0.0b
(sqrt (+ (exp x) 1))
0.0b
(+ (exp x) 1)

rewrite15.0ms

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

series56.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
44.0ms
(sqrt (+ (exp x) 1))
11.0ms
(+ (exp x) 1)

simplify292.0ms

Counts
14 → 37
Calls
14 calls:
Slowest
131.0ms
(- (+ (sqrt 2) (+ (* 1/4 (/ (pow x 2) (sqrt 2))) (* 1/2 (/ x (sqrt 2))))) (* 1/8 (/ (pow x 2) (pow (sqrt 2) 3))))
75.0ms
(sqrt (- (* (exp x) (exp x)) (* 1 1)))
35.0ms
(+ x (+ (* 1/2 (pow x 2)) 2))
18.0ms
(sqrt (+ (pow (exp x) 3) (pow 1 3)))
6.0ms
(sqrt (* (cbrt (+ (exp x) 1)) (cbrt (+ (exp x) 1))))

prune294.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize8.0ms

Local error

Found 4 expressions with local error:

0.0b
(fma (sqrt (exp x)) (sqrt (exp x)) 1)
0.0b
(sqrt (fma (sqrt (exp x)) (sqrt (exp x)) 1))
0.0b
(sqrt (exp x))
0.0b
(sqrt (exp x))

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 (sqrt (exp x)) (sqrt (exp x)) 1))
1.0ms
(sqrt (exp x))
1.0ms
(sqrt (exp x))
0.0ms
(fma (sqrt (exp x)) (sqrt (exp x)) 1)

series150.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
72.0ms
(sqrt (fma (sqrt (exp x)) (sqrt (exp x)) 1))
45.0ms
(fma (sqrt (exp x)) (sqrt (exp x)) 1)
19.0ms
(sqrt (exp x))
14.0ms
(sqrt (exp x))

simplify346.0ms

Counts
24 → 64
Calls
24 calls:
Slowest
143.0ms
(- (+ (sqrt 2) (+ (* 1/4 (/ (pow x 2) (sqrt 2))) (* 1/2 (/ x (sqrt 2))))) (* 1/8 (/ (pow x 2) (pow (sqrt 2) 3))))
67.0ms
(+ (* 1/2 x) (+ (* 1/8 (pow x 2)) 1))
61.0ms
(+ (* 1/2 x) (+ (* 1/8 (pow x 2)) 1))
29.0ms
(+ x (+ (* 1/2 (pow x 2)) 2))
6.0ms
(sqrt (* (cbrt (fma (sqrt (exp x)) (sqrt (exp x)) 1)) (cbrt (fma (sqrt (exp x)) (sqrt (exp x)) 1))))

prune595.0ms

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes35.0ms

Accuracy

0% (0.0b remaining)

Error of 0.1b against oracle of 0.1b and baseline of 0.1b

bsearch2.0ms

end0.0ms

sample9.8s

Algorithm
intervals
Results
27061×(pre true 80)
12412×(body nan 80)
7431×(body real 80)
6508×(body exit 10240)
710×(body real 160)