Average Error: 4.7 → 0.8
Time: 6.7s
Precision: 64
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
\[\begin{array}{l} \mathbf{if}\;x \le -8.6055153790992069 \cdot 10^{-5}:\\ \;\;\;\;\sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{1}} \cdot \sqrt{\frac{\sqrt{e^{2 \cdot x}} - \sqrt{1}}{e^{x} - 1}}\\ \mathbf{else}:\\ \;\;\;\;\left(0.25 \cdot \frac{{x}^{2}}{\sqrt{2}} + \left(\sqrt{2} + 0.5 \cdot \frac{x}{\sqrt{2}}\right)\right) - 0.125 \cdot \frac{{x}^{2}}{{\left(\sqrt{2}\right)}^{3}}\\ \end{array}\]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
\begin{array}{l}
\mathbf{if}\;x \le -8.6055153790992069 \cdot 10^{-5}:\\
\;\;\;\;\sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{1}} \cdot \sqrt{\frac{\sqrt{e^{2 \cdot x}} - \sqrt{1}}{e^{x} - 1}}\\

\mathbf{else}:\\
\;\;\;\;\left(0.25 \cdot \frac{{x}^{2}}{\sqrt{2}} + \left(\sqrt{2} + 0.5 \cdot \frac{x}{\sqrt{2}}\right)\right) - 0.125 \cdot \frac{{x}^{2}}{{\left(\sqrt{2}\right)}^{3}}\\

\end{array}
double code(double x) {
	return sqrt(((exp((2.0 * x)) - 1.0) / (exp(x) - 1.0)));
}
double code(double x) {
	double VAR;
	if ((x <= -8.605515379099207e-05)) {
		VAR = (sqrt(((sqrt(exp((2.0 * x))) + sqrt(1.0)) / 1.0)) * sqrt(((sqrt(exp((2.0 * x))) - sqrt(1.0)) / (exp(x) - 1.0))));
	} else {
		VAR = (((0.25 * (pow(x, 2.0) / sqrt(2.0))) + (sqrt(2.0) + (0.5 * (x / sqrt(2.0))))) - (0.125 * (pow(x, 2.0) / pow(sqrt(2.0), 3.0))));
	}
	return VAR;
}

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 < -8.605515379099207e-05

    1. Initial program 0.1

      \[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity0.1

      \[\leadsto \sqrt{\frac{e^{2 \cdot x} - 1}{\color{blue}{1 \cdot \left(e^{x} - 1\right)}}}\]
    4. Applied add-sqr-sqrt0.1

      \[\leadsto \sqrt{\frac{e^{2 \cdot x} - \color{blue}{\sqrt{1} \cdot \sqrt{1}}}{1 \cdot \left(e^{x} - 1\right)}}\]
    5. Applied add-sqr-sqrt0.1

      \[\leadsto \sqrt{\frac{\color{blue}{\sqrt{e^{2 \cdot x}} \cdot \sqrt{e^{2 \cdot x}}} - \sqrt{1} \cdot \sqrt{1}}{1 \cdot \left(e^{x} - 1\right)}}\]
    6. Applied difference-of-squares0.0

      \[\leadsto \sqrt{\frac{\color{blue}{\left(\sqrt{e^{2 \cdot x}} + \sqrt{1}\right) \cdot \left(\sqrt{e^{2 \cdot x}} - \sqrt{1}\right)}}{1 \cdot \left(e^{x} - 1\right)}}\]
    7. Applied times-frac0.0

      \[\leadsto \sqrt{\color{blue}{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{1} \cdot \frac{\sqrt{e^{2 \cdot x}} - \sqrt{1}}{e^{x} - 1}}}\]
    8. Applied sqrt-prod0.0

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

    if -8.605515379099207e-05 < x

    1. Initial program 35.0

      \[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
    2. Using strategy rm
    3. Applied flip3--35.4

      \[\leadsto \sqrt{\frac{e^{2 \cdot x} - 1}{\color{blue}{\frac{{\left(e^{x}\right)}^{3} - {1}^{3}}{e^{x} \cdot e^{x} + \left(1 \cdot 1 + e^{x} \cdot 1\right)}}}}\]
    4. Applied associate-/r/35.4

      \[\leadsto \sqrt{\color{blue}{\frac{e^{2 \cdot x} - 1}{{\left(e^{x}\right)}^{3} - {1}^{3}} \cdot \left(e^{x} \cdot e^{x} + \left(1 \cdot 1 + e^{x} \cdot 1\right)\right)}}\]
    5. Applied sqrt-prod35.4

      \[\leadsto \color{blue}{\sqrt{\frac{e^{2 \cdot x} - 1}{{\left(e^{x}\right)}^{3} - {1}^{3}}} \cdot \sqrt{e^{x} \cdot e^{x} + \left(1 \cdot 1 + e^{x} \cdot 1\right)}}\]
    6. Taylor expanded around 0 6.3

      \[\leadsto \color{blue}{\left(0.25 \cdot \frac{{x}^{2}}{\sqrt{2}} + \left(\sqrt{2} + 0.5 \cdot \frac{x}{\sqrt{2}}\right)\right) - 0.125 \cdot \frac{{x}^{2}}{{\left(\sqrt{2}\right)}^{3}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -8.6055153790992069 \cdot 10^{-5}:\\ \;\;\;\;\sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{1}} \cdot \sqrt{\frac{\sqrt{e^{2 \cdot x}} - \sqrt{1}}{e^{x} - 1}}\\ \mathbf{else}:\\ \;\;\;\;\left(0.25 \cdot \frac{{x}^{2}}{\sqrt{2}} + \left(\sqrt{2} + 0.5 \cdot \frac{x}{\sqrt{2}}\right)\right) - 0.125 \cdot \frac{{x}^{2}}{{\left(\sqrt{2}\right)}^{3}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020079 
(FPCore (x)
  :name "sqrtexp (problem 3.4.4)"
  :precision binary64
  (sqrt (/ (- (exp (* 2 x)) 1) (- (exp x) 1))))