Average Error: 4.7 → 0.1
Time: 5.2s
Precision: 64
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
\[e^{\log \left(\sqrt{1 \cdot \mathsf{fma}\left(\sqrt{e^{x}}, \sqrt{e^{x}}, 1\right)}\right)}\]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
e^{\log \left(\sqrt{1 \cdot \mathsf{fma}\left(\sqrt{e^{x}}, \sqrt{e^{x}}, 1\right)}\right)}
double code(double x) {
	return sqrt(((exp((2.0 * x)) - 1.0) / (exp(x) - 1.0)));
}
double code(double x) {
	return exp(log(sqrt((1.0 * fma(sqrt(exp(x)), sqrt(exp(x)), 1.0)))));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 4.7

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

    \[\leadsto \sqrt{\frac{e^{2 \cdot x} - 1}{\color{blue}{\frac{e^{x} \cdot e^{x} - 1 \cdot 1}{e^{x} + 1}}}}\]
  4. Applied associate-/r/4.2

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

    \[\leadsto \sqrt{\color{blue}{\frac{e^{2 \cdot x} - 1}{\mathsf{fma}\left(-1, 1, e^{x + x}\right)}} \cdot \left(e^{x} + 1\right)}\]
  6. Taylor expanded around 0 0.0

    \[\leadsto \sqrt{\color{blue}{1} \cdot \left(e^{x} + 1\right)}\]
  7. Using strategy rm
  8. Applied add-sqr-sqrt0.1

    \[\leadsto \sqrt{1 \cdot \left(\color{blue}{\sqrt{e^{x}} \cdot \sqrt{e^{x}}} + 1\right)}\]
  9. Applied fma-def0.0

    \[\leadsto \sqrt{1 \cdot \color{blue}{\mathsf{fma}\left(\sqrt{e^{x}}, \sqrt{e^{x}}, 1\right)}}\]
  10. Using strategy rm
  11. Applied add-exp-log0.1

    \[\leadsto \color{blue}{e^{\log \left(\sqrt{1 \cdot \mathsf{fma}\left(\sqrt{e^{x}}, \sqrt{e^{x}}, 1\right)}\right)}}\]
  12. Final simplification0.1

    \[\leadsto e^{\log \left(\sqrt{1 \cdot \mathsf{fma}\left(\sqrt{e^{x}}, \sqrt{e^{x}}, 1\right)}\right)}\]

Reproduce

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