Average Error: 4.6 → 0.1
Time: 6.1s
Precision: 64
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.79195243520060967 \cdot 10^{-15}:\\ \;\;\;\;\sqrt{\frac{\sqrt[3]{{\left(\sqrt{e^{2 \cdot x}}\right)}^{3}} + \sqrt{1}}{\frac{e^{x} - 1}{{\left(e^{x}\right)}^{\left(\frac{2}{2}\right)} - \sqrt{1}}}}\\ \mathbf{elif}\;x \le 1.11017384914148877 \cdot 10^{-16}:\\ \;\;\;\;0.5 \cdot \frac{x}{\sqrt{2}} + \left(\sqrt{2} + \frac{{x}^{2}}{\sqrt{2}} \cdot \left(0.25 - \frac{0.125}{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{{\left(e^{x}\right)}^{\left(\frac{2}{2}\right)} + \sqrt{1}}{\frac{e^{x} - 1}{{\left(e^{x}\right)}^{\left(\frac{2}{2}\right)} - \sqrt{1}}}}\\ \end{array}\]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
\begin{array}{l}
\mathbf{if}\;x \le -3.79195243520060967 \cdot 10^{-15}:\\
\;\;\;\;\sqrt{\frac{\sqrt[3]{{\left(\sqrt{e^{2 \cdot x}}\right)}^{3}} + \sqrt{1}}{\frac{e^{x} - 1}{{\left(e^{x}\right)}^{\left(\frac{2}{2}\right)} - \sqrt{1}}}}\\

\mathbf{elif}\;x \le 1.11017384914148877 \cdot 10^{-16}:\\
\;\;\;\;0.5 \cdot \frac{x}{\sqrt{2}} + \left(\sqrt{2} + \frac{{x}^{2}}{\sqrt{2}} \cdot \left(0.25 - \frac{0.125}{2}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{{\left(e^{x}\right)}^{\left(\frac{2}{2}\right)} + \sqrt{1}}{\frac{e^{x} - 1}{{\left(e^{x}\right)}^{\left(\frac{2}{2}\right)} - \sqrt{1}}}}\\

\end{array}
double code(double x) {
	return ((double) sqrt(((double) (((double) (((double) exp(((double) (2.0 * x)))) - 1.0)) / ((double) (((double) exp(x)) - 1.0))))));
}
double code(double x) {
	double VAR;
	if ((x <= -3.79195243520061e-15)) {
		VAR = ((double) sqrt(((double) (((double) (((double) cbrt(((double) pow(((double) sqrt(((double) exp(((double) (2.0 * x)))))), 3.0)))) + ((double) sqrt(1.0)))) / ((double) (((double) (((double) exp(x)) - 1.0)) / ((double) (((double) pow(((double) exp(x)), ((double) (2.0 / 2.0)))) - ((double) sqrt(1.0))))))))));
	} else {
		double VAR_1;
		if ((x <= 1.1101738491414888e-16)) {
			VAR_1 = ((double) (((double) (0.5 * ((double) (x / ((double) sqrt(2.0)))))) + ((double) (((double) sqrt(2.0)) + ((double) (((double) (((double) pow(x, 2.0)) / ((double) sqrt(2.0)))) * ((double) (0.25 - ((double) (0.125 / 2.0))))))))));
		} else {
			VAR_1 = ((double) sqrt(((double) (((double) (((double) pow(((double) exp(x)), ((double) (2.0 / 2.0)))) + ((double) sqrt(1.0)))) / ((double) (((double) (((double) exp(x)) - 1.0)) / ((double) (((double) pow(((double) exp(x)), ((double) (2.0 / 2.0)))) - ((double) sqrt(1.0))))))))));
		}
		VAR = VAR_1;
	}
	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 3 regimes
  2. if x < -3.79195243520061e-15

    1. Initial program 0.8

      \[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt0.8

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

      \[\leadsto \sqrt{\frac{\color{blue}{\sqrt{e^{2 \cdot x}} \cdot \sqrt{e^{2 \cdot x}}} - \sqrt{1} \cdot \sqrt{1}}{e^{x} - 1}}\]
    5. Applied difference-of-squares0.2

      \[\leadsto \sqrt{\frac{\color{blue}{\left(\sqrt{e^{2 \cdot x}} + \sqrt{1}\right) \cdot \left(\sqrt{e^{2 \cdot x}} - \sqrt{1}\right)}}{e^{x} - 1}}\]
    6. Applied associate-/l*0.2

      \[\leadsto \sqrt{\color{blue}{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{e^{x} - 1}{\sqrt{e^{2 \cdot x}} - \sqrt{1}}}}}\]
    7. Using strategy rm
    8. Applied *-commutative0.2

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

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

      \[\leadsto \sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{e^{x} - 1}{\color{blue}{{\left(e^{x}\right)}^{\left(\frac{2}{2}\right)}} - \sqrt{1}}}}\]
    11. Using strategy rm
    12. Applied add-cbrt-cube0.0

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

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

    if -3.79195243520061e-15 < x < 1.1101738491414888e-16

    1. Initial program 60.5

      \[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
    2. Taylor expanded around 0 0.1

      \[\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. Simplified0.1

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

    if 1.1101738491414888e-16 < x

    1. Initial program 15.8

      \[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt15.8

      \[\leadsto \sqrt{\frac{e^{2 \cdot x} - \color{blue}{\sqrt{1} \cdot \sqrt{1}}}{e^{x} - 1}}\]
    4. Applied add-sqr-sqrt13.3

      \[\leadsto \sqrt{\frac{\color{blue}{\sqrt{e^{2 \cdot x}} \cdot \sqrt{e^{2 \cdot x}}} - \sqrt{1} \cdot \sqrt{1}}{e^{x} - 1}}\]
    5. Applied difference-of-squares5.7

      \[\leadsto \sqrt{\frac{\color{blue}{\left(\sqrt{e^{2 \cdot x}} + \sqrt{1}\right) \cdot \left(\sqrt{e^{2 \cdot x}} - \sqrt{1}\right)}}{e^{x} - 1}}\]
    6. Applied associate-/l*5.7

      \[\leadsto \sqrt{\color{blue}{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{e^{x} - 1}{\sqrt{e^{2 \cdot x}} - \sqrt{1}}}}}\]
    7. Using strategy rm
    8. Applied *-commutative5.7

      \[\leadsto \sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{e^{x} - 1}{\sqrt{e^{\color{blue}{x \cdot 2}}} - \sqrt{1}}}}\]
    9. Applied exp-prod2.3

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

      \[\leadsto \sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{e^{x} - 1}{\color{blue}{{\left(e^{x}\right)}^{\left(\frac{2}{2}\right)}} - \sqrt{1}}}}\]
    11. Using strategy rm
    12. Applied *-commutative2.3

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

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

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

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

Reproduce

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