Average Error: 42.9 → 0.2
Time: 35.9s
Precision: 64
Ground Truth: 128
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.9334737818330797 \cdot 10^{-15}:\\ \;\;\;\;\sqrt{\frac{\left(\sqrt{e^{2 \cdot x}} + 1\right) \cdot \left(\sqrt{e^{2 \cdot x}} - 1\right)}{e^{x} - 1}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{x \cdot \frac{1}{2}}{\sqrt{2}} + \sqrt{2}\right) + \left(\frac{1}{4} - \frac{\frac{1}{8}}{2}\right) \cdot \frac{{x}^2}{\sqrt{2}}\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes.
  2. if x < -2.9334737818330797e-15

    1. Initial program 0.7

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

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

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

    if -2.9334737818330797e-15 < x

    1. Initial program 60.8

      \[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
    2. Applied taylor 12.3

      \[\leadsto \sqrt{\frac{1}{2} \cdot {x}^2 + \left(2 + x\right)}\]
    3. Taylor expanded around 0 12.3

      \[\leadsto \sqrt{\color{blue}{\frac{1}{2} \cdot {x}^2 + \left(2 + x\right)}}\]
    4. Applied taylor 0.1

      \[\leadsto \left(\frac{1}{2} \cdot \frac{x}{\sqrt{2}} + \left(\frac{1}{4} \cdot \frac{{x}^2}{\sqrt{2}} + \sqrt{2}\right)\right) - \frac{1}{8} \cdot \frac{{x}^2}{{\left(\sqrt{2}\right)}^{3}}\]
    5. Taylor expanded around 0 0.1

      \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \frac{x}{\sqrt{2}} + \left(\frac{1}{4} \cdot \frac{{x}^2}{\sqrt{2}} + \sqrt{2}\right)\right) - \frac{1}{8} \cdot \frac{{x}^2}{{\left(\sqrt{2}\right)}^{3}}}\]
    6. Applied simplify 0.1

      \[\leadsto \color{blue}{\left(\frac{x \cdot \frac{1}{2}}{\sqrt{2}} + \sqrt{2}\right) + \left(\frac{1}{4} - \frac{\frac{1}{8}}{2}\right) \cdot \frac{{x}^2}{\sqrt{2}}}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions

Runtime

Total time: 35.9s Debug log

Please include this information when filing a bug report:

herbie --seed '#(2721477869 3365922910 3119324189 3329655893 655799541 65625004)'
(FPCore (x)
  :name "NMSE problem 3.4.4"
  (sqrt (/ (- (exp (* 2 x)) 1) (- (exp x) 1))))