Average Error: 4.3 → 0.0
Time: 23.3s
Precision: 64
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
\[\mathsf{hypot}\left(1, e^{x \cdot \frac{1}{2}}\right)\]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
\mathsf{hypot}\left(1, e^{x \cdot \frac{1}{2}}\right)
double f(double x) {
        double r1065769 = 2.0;
        double r1065770 = x;
        double r1065771 = r1065769 * r1065770;
        double r1065772 = exp(r1065771);
        double r1065773 = 1.0;
        double r1065774 = r1065772 - r1065773;
        double r1065775 = exp(r1065770);
        double r1065776 = r1065775 - r1065773;
        double r1065777 = r1065774 / r1065776;
        double r1065778 = sqrt(r1065777);
        return r1065778;
}

double f(double x) {
        double r1065779 = 1.0;
        double r1065780 = x;
        double r1065781 = 0.5;
        double r1065782 = r1065780 * r1065781;
        double r1065783 = exp(r1065782);
        double r1065784 = hypot(r1065779, r1065783);
        return r1065784;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 4.3

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

    \[\leadsto \color{blue}{\sqrt{1 + e^{x}}}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt0.1

    \[\leadsto \sqrt{1 + \color{blue}{\sqrt{e^{x}} \cdot \sqrt{e^{x}}}}\]
  5. Applied *-un-lft-identity0.1

    \[\leadsto \sqrt{\color{blue}{1 \cdot 1} + \sqrt{e^{x}} \cdot \sqrt{e^{x}}}\]
  6. Applied hypot-def0.1

    \[\leadsto \color{blue}{\mathsf{hypot}\left(1, \sqrt{e^{x}}\right)}\]
  7. Using strategy rm
  8. Applied *-un-lft-identity0.1

    \[\leadsto \mathsf{hypot}\left(1, \sqrt{e^{\color{blue}{1 \cdot x}}}\right)\]
  9. Applied exp-prod0.1

    \[\leadsto \mathsf{hypot}\left(1, \sqrt{\color{blue}{{\left(e^{1}\right)}^{x}}}\right)\]
  10. Applied sqrt-pow10.0

    \[\leadsto \mathsf{hypot}\left(1, \color{blue}{{\left(e^{1}\right)}^{\left(\frac{x}{2}\right)}}\right)\]
  11. Using strategy rm
  12. Applied pow-exp0.0

    \[\leadsto \mathsf{hypot}\left(1, \color{blue}{e^{1 \cdot \frac{x}{2}}}\right)\]
  13. Simplified0.0

    \[\leadsto \mathsf{hypot}\left(1, e^{\color{blue}{\frac{1}{2} \cdot x}}\right)\]
  14. Final simplification0.0

    \[\leadsto \mathsf{hypot}\left(1, e^{x \cdot \frac{1}{2}}\right)\]

Reproduce

herbie shell --seed 2019162 +o rules:numerics
(FPCore (x)
  :name "sqrtexp (problem 3.4.4)"
  (sqrt (/ (- (exp (* 2 x)) 1) (- (exp x) 1))))