Average Error: 41.4 → 0.3
Time: 4.8s
Precision: binary64
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -1.4142710662085361 \cdot 10^{-05}:\\ \;\;\;\;\sqrt{\frac{{\left(e^{x}\right)}^{2} - 1}{\frac{{\left(e^{x}\right)}^{2} - 1 \cdot 1}{e^{x} + 1}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + \left(2 + x \cdot \left(x \cdot 0.5\right)\right)}\\ \end{array}\]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
\begin{array}{l}
\mathbf{if}\;x \leq -1.4142710662085361 \cdot 10^{-05}:\\
\;\;\;\;\sqrt{\frac{{\left(e^{x}\right)}^{2} - 1}{\frac{{\left(e^{x}\right)}^{2} - 1 \cdot 1}{e^{x} + 1}}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{x + \left(2 + x \cdot \left(x \cdot 0.5\right)\right)}\\

\end{array}
(FPCore (x)
 :precision binary64
 (sqrt (/ (- (exp (* 2.0 x)) 1.0) (- (exp x) 1.0))))
(FPCore (x)
 :precision binary64
 (if (<= x -1.4142710662085361e-05)
   (sqrt
    (/
     (- (pow (exp x) 2.0) 1.0)
     (/ (- (pow (exp x) 2.0) (* 1.0 1.0)) (+ (exp x) 1.0))))
   (sqrt (+ x (+ 2.0 (* x (* x 0.5)))))))
double code(double x) {
	return ((double) sqrt((((double) (((double) exp(((double) (2.0 * x)))) - 1.0)) / ((double) (((double) exp(x)) - 1.0)))));
}
double code(double x) {
	double tmp;
	if ((x <= -1.4142710662085361e-05)) {
		tmp = ((double) sqrt((((double) (((double) pow(((double) exp(x)), 2.0)) - 1.0)) / (((double) (((double) pow(((double) exp(x)), 2.0)) - ((double) (1.0 * 1.0)))) / ((double) (((double) exp(x)) + 1.0))))));
	} else {
		tmp = ((double) sqrt(((double) (x + ((double) (2.0 + ((double) (x * ((double) (x * 0.5))))))))));
	}
	return tmp;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -1.41427106620853615e-5

    1. Initial program Error: 0.1 bits

      \[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
    2. SimplifiedError: 0.1 bits

      \[\leadsto \color{blue}{\sqrt{\frac{{\left(e^{x}\right)}^{2} - 1}{e^{x} - 1}}}\]
    3. Using strategy rm
    4. Applied flip--Error: 0.0 bits

      \[\leadsto \sqrt{\frac{{\left(e^{x}\right)}^{2} - 1}{\color{blue}{\frac{e^{x} \cdot e^{x} - 1 \cdot 1}{e^{x} + 1}}}}\]
    5. SimplifiedError: 0.0 bits

      \[\leadsto \sqrt{\frac{{\left(e^{x}\right)}^{2} - 1}{\frac{\color{blue}{{\left(e^{x}\right)}^{2} - 1 \cdot 1}}{e^{x} + 1}}}\]

    if -1.41427106620853615e-5 < x

    1. Initial program Error: 62.0 bits

      \[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
    2. SimplifiedError: 61.6 bits

      \[\leadsto \color{blue}{\sqrt{\frac{{\left(e^{x}\right)}^{2} - 1}{e^{x} - 1}}}\]
    3. Taylor expanded around 0 Error: 0.4 bits

      \[\leadsto \sqrt{\color{blue}{0.5 \cdot {x}^{2} + \left(x + 2\right)}}\]
    4. SimplifiedError: 0.4 bits

      \[\leadsto \sqrt{\color{blue}{x + \left(2 + x \cdot \left(x \cdot 0.5\right)\right)}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplificationError: 0.3 bits

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.4142710662085361 \cdot 10^{-05}:\\ \;\;\;\;\sqrt{\frac{{\left(e^{x}\right)}^{2} - 1}{\frac{{\left(e^{x}\right)}^{2} - 1 \cdot 1}{e^{x} + 1}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + \left(2 + x \cdot \left(x \cdot 0.5\right)\right)}\\ \end{array}\]

Reproduce

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