Average Error: 40.8 → 0.0
Time: 5.5s
Precision: binary64
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}} \]
\[\mathsf{hypot}\left(1, e^{0.5 \cdot x}\right) \]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
\mathsf{hypot}\left(1, e^{0.5 \cdot x}\right)
(FPCore (x)
 :precision binary64
 (sqrt (/ (- (exp (* 2.0 x)) 1.0) (- (exp x) 1.0))))
(FPCore (x) :precision binary64 (hypot 1.0 (exp (* 0.5 x))))
double code(double x) {
	return sqrt((exp(2.0 * x) - 1.0) / (exp(x) - 1.0));
}
double code(double x) {
	return hypot(1.0, exp(0.5 * x));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 40.8

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

    \[\leadsto \color{blue}{\sqrt{1 + e^{x}}} \]
  3. Applied add-sqr-sqrt_binary640.0

    \[\leadsto \sqrt{1 + \color{blue}{\sqrt{e^{x}} \cdot \sqrt{e^{x}}}} \]
  4. Applied hypot-1-def_binary640.0

    \[\leadsto \color{blue}{\mathsf{hypot}\left(1, \sqrt{e^{x}}\right)} \]
  5. Applied *-un-lft-identity_binary640.0

    \[\leadsto \mathsf{hypot}\left(1, \sqrt{e^{\color{blue}{1 \cdot x}}}\right) \]
  6. Applied exp-prod_binary640.0

    \[\leadsto \mathsf{hypot}\left(1, \sqrt{\color{blue}{{\left(e^{1}\right)}^{x}}}\right) \]
  7. Applied sqrt-pow1_binary640.0

    \[\leadsto \mathsf{hypot}\left(1, \color{blue}{{\left(e^{1}\right)}^{\left(\frac{x}{2}\right)}}\right) \]
  8. Taylor expanded in x around inf 0.0

    \[\leadsto \mathsf{hypot}\left(1, \color{blue}{e^{0.5 \cdot x}}\right) \]
  9. Final simplification0.0

    \[\leadsto \mathsf{hypot}\left(1, e^{0.5 \cdot x}\right) \]

Reproduce

herbie shell --seed 2021280 
(FPCore (x)
  :name "sqrtexp (problem 3.4.4)"
  :precision binary64
  (sqrt (/ (- (exp (* 2.0 x)) 1.0) (- (exp x) 1.0))))