Average Error: 4.6 → 0.1
Time: 24.1s
Precision: 64
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
\[\begin{array}{l} \mathbf{if}\;x \le -9.813313662631737005199832057922293415686 \cdot 10^{-6}:\\ \;\;\;\;\sqrt{\frac{\sqrt{1} + \sqrt{e^{2 \cdot x}}}{\frac{e^{x} - 1}{{\left(e^{2}\right)}^{\left(\frac{x}{2}\right)} - \sqrt{1}}}}\\ \mathbf{elif}\;x \le 1.578024241221897350305036072937170388286 \cdot 10^{-6}:\\ \;\;\;\;\sqrt{2 + x \cdot \left(x \cdot 0.5 + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{\sqrt{1} + \sqrt{e^{2 \cdot x}}}{\frac{e^{x} - 1}{{\left(e^{2}\right)}^{\left(\frac{x}{2}\right)} - \sqrt{1}}}}\\ \end{array}\]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
\begin{array}{l}
\mathbf{if}\;x \le -9.813313662631737005199832057922293415686 \cdot 10^{-6}:\\
\;\;\;\;\sqrt{\frac{\sqrt{1} + \sqrt{e^{2 \cdot x}}}{\frac{e^{x} - 1}{{\left(e^{2}\right)}^{\left(\frac{x}{2}\right)} - \sqrt{1}}}}\\

\mathbf{elif}\;x \le 1.578024241221897350305036072937170388286 \cdot 10^{-6}:\\
\;\;\;\;\sqrt{2 + x \cdot \left(x \cdot 0.5 + 1\right)}\\

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

\end{array}
double f(double x) {
        double r1257788 = 2.0;
        double r1257789 = x;
        double r1257790 = r1257788 * r1257789;
        double r1257791 = exp(r1257790);
        double r1257792 = 1.0;
        double r1257793 = r1257791 - r1257792;
        double r1257794 = exp(r1257789);
        double r1257795 = r1257794 - r1257792;
        double r1257796 = r1257793 / r1257795;
        double r1257797 = sqrt(r1257796);
        return r1257797;
}

double f(double x) {
        double r1257798 = x;
        double r1257799 = -9.813313662631737e-06;
        bool r1257800 = r1257798 <= r1257799;
        double r1257801 = 1.0;
        double r1257802 = sqrt(r1257801);
        double r1257803 = 2.0;
        double r1257804 = r1257803 * r1257798;
        double r1257805 = exp(r1257804);
        double r1257806 = sqrt(r1257805);
        double r1257807 = r1257802 + r1257806;
        double r1257808 = exp(r1257798);
        double r1257809 = r1257808 - r1257801;
        double r1257810 = exp(r1257803);
        double r1257811 = 2.0;
        double r1257812 = r1257798 / r1257811;
        double r1257813 = pow(r1257810, r1257812);
        double r1257814 = r1257813 - r1257802;
        double r1257815 = r1257809 / r1257814;
        double r1257816 = r1257807 / r1257815;
        double r1257817 = sqrt(r1257816);
        double r1257818 = 1.5780242412218974e-06;
        bool r1257819 = r1257798 <= r1257818;
        double r1257820 = 0.5;
        double r1257821 = r1257798 * r1257820;
        double r1257822 = r1257821 + r1257801;
        double r1257823 = r1257798 * r1257822;
        double r1257824 = r1257803 + r1257823;
        double r1257825 = sqrt(r1257824);
        double r1257826 = r1257819 ? r1257825 : r1257817;
        double r1257827 = r1257800 ? r1257817 : r1257826;
        return r1257827;
}

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 < -9.813313662631737e-06 or 1.5780242412218974e-06 < x

    1. Initial program 0.3

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

      \[\leadsto \sqrt{\frac{e^{2 \cdot x} - \color{blue}{\sqrt{1} \cdot \sqrt{1}}}{e^{x} - 1}}\]
    4. Applied add-sqr-sqrt0.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-squares0.1

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

      \[\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 add-log-exp0.1

      \[\leadsto \sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{e^{x} - 1}{\sqrt{e^{\color{blue}{\log \left(e^{2}\right)} \cdot x}} - \sqrt{1}}}}\]
    9. Applied exp-to-pow0.1

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

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

    if -9.813313662631737e-06 < x < 1.5780242412218974e-06

    1. Initial program 41.1

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

      \[\leadsto \sqrt{\color{blue}{1 \cdot x + \left(0.5 \cdot {x}^{2} + 2\right)}}\]
    3. Simplified0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -9.813313662631737005199832057922293415686 \cdot 10^{-6}:\\ \;\;\;\;\sqrt{\frac{\sqrt{1} + \sqrt{e^{2 \cdot x}}}{\frac{e^{x} - 1}{{\left(e^{2}\right)}^{\left(\frac{x}{2}\right)} - \sqrt{1}}}}\\ \mathbf{elif}\;x \le 1.578024241221897350305036072937170388286 \cdot 10^{-6}:\\ \;\;\;\;\sqrt{2 + x \cdot \left(x \cdot 0.5 + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{\sqrt{1} + \sqrt{e^{2 \cdot x}}}{\frac{e^{x} - 1}{{\left(e^{2}\right)}^{\left(\frac{x}{2}\right)} - \sqrt{1}}}}\\ \end{array}\]

Reproduce

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