Average Error: 40.9 → 0.0
Time: 4.8s
Precision: binary64
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}} \]
\[\sqrt{\frac{\mathsf{expm1}\left(x + x\right)}{\mathsf{expm1}\left(x\right)}} \]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
\sqrt{\frac{\mathsf{expm1}\left(x + x\right)}{\mathsf{expm1}\left(x\right)}}
(FPCore (x)
 :precision binary64
 (sqrt (/ (- (exp (* 2.0 x)) 1.0) (- (exp x) 1.0))))
(FPCore (x) :precision binary64 (sqrt (/ (expm1 (+ x x)) (expm1 x))))
double code(double x) {
	return sqrt(((exp((2.0 * x)) - 1.0) / (exp(x) - 1.0)));
}
double code(double x) {
	return sqrt((expm1((x + x)) / expm1(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.9

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

    \[\leadsto \color{blue}{\sqrt{1 + e^{x}}} \]
  3. Applied egg-rr0.0

    \[\leadsto \sqrt{\color{blue}{\frac{\mathsf{expm1}\left(x + x\right)}{\mathsf{expm1}\left(x\right)}}} \]
  4. Final simplification0.0

    \[\leadsto \sqrt{\frac{\mathsf{expm1}\left(x + x\right)}{\mathsf{expm1}\left(x\right)}} \]

Reproduce

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