Average Error: 42.7 → 0.1
Time: 21.6s
Precision: 64
Ground Truth: 128
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.043772507835201 \cdot 10^{-13}:\\ \;\;\;\;\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(\sqrt{2} + \frac{\frac{1}{2} \cdot x}{\sqrt{2}}\right) - \frac{{x}^2}{\sqrt{2}} \cdot \left(\frac{\frac{1}{8}}{2} - \frac{1}{4}\right)\\ \end{array}\]

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes.
  2. if x < -3.043772507835201e-13

    1. Initial program 0.5

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

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

      \[\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 -3.043772507835201e-13 < x

    1. Initial program 60.7

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

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

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

      \[\leadsto \left(\frac{1}{4} \cdot \frac{{x}^2}{\sqrt{2}} + \left(\frac{1}{2} \cdot \frac{x}{\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}{4} \cdot \frac{{x}^2}{\sqrt{2}} + \left(\frac{1}{2} \cdot \frac{x}{\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(\sqrt{2} + \frac{\frac{1}{2} \cdot x}{\sqrt{2}}\right) - \frac{{x}^2}{\sqrt{2}} \cdot \left(\frac{\frac{1}{8}}{2} - \frac{1}{4}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions

Runtime

Total time: 21.6s Debug log

Please report a bug with the following info:

herbie --seed '#(4265329430 1989260471 3087424653 3325920772 2532063104 2513603245)'
(FPCore (x)
  :name "NMSE problem 3.4.4"
  (sqrt (/ (- (exp (* 2 x)) 1) (- (exp x) 1))))