Average Error: 39.3 → 0.5
Time: 3.1m
Precision: 64
Internal Precision: 1344
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
\[\begin{array}{l} \mathbf{if}\;\sqrt{\frac{e^{x \cdot 2} - 1}{e^{x} - 1}} \le 1.1014398386837931:\\ \;\;\;\;\sqrt{\frac{e^{x \cdot 2} - 1}{\frac{e^{x} \cdot e^{x} - 1}{1 + e^{x}}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{1}{2} \cdot {x}^{2} + \left(x + 2\right)}\\ \end{array}\]

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 (sqrt (/ (- (exp (* 2 x)) 1) (- (exp x) 1))) < 1.1014398386837931

    1. Initial program 0.0

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

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

    if 1.1014398386837931 < (sqrt (/ (- (exp (* 2 x)) 1) (- (exp x) 1)))

    1. Initial program 59.5

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

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

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

Runtime

Time bar (total: 3.1m)Debug logProfile

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