Average Error: 41.0 → 0.0
Time: 54.6s
Precision: binary64
Cost: 12992
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}\]
\[\sqrt{e^{x} + 1}\]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
\sqrt{e^{x} + 1}
(FPCore (x)
 :precision binary64
 (sqrt (/ (- (exp (* 2.0 x)) 1.0) (- (exp x) 1.0))))
(FPCore (x) :precision binary64 (sqrt (+ (exp x) 1.0)))
double code(double x) {
	return sqrt((exp(2.0 * x) - 1.0) / (exp(x) - 1.0));
}
double code(double x) {
	return sqrt(exp(x) + 1.0);
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error0.7
Cost6913
\[\begin{array}{l} \mathbf{if}\;x \leq -1.014316485804236:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 2}\\ \end{array}\]
Alternative 2
Error1.1
Cost6785
\[\begin{array}{l} \mathbf{if}\;x \leq -0.7863054766764821:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2}\\ \end{array}\]
Alternative 3
Error34.0
Cost64
\[1\]

Error

Time

Derivation

  1. Initial program 41.0

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

    \[\leadsto \color{blue}{\sqrt{1 + e^{x}}}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity_binary640.0

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

    \[\leadsto \color{blue}{\sqrt{1} \cdot \sqrt{1 + e^{x}}}\]
  6. Simplified0.0

    \[\leadsto \color{blue}{1} \cdot \sqrt{1 + e^{x}}\]
  7. Simplified0.0

    \[\leadsto \color{blue}{\sqrt{e^{x} + 1}}\]
  8. Final simplification0.0

    \[\leadsto \sqrt{e^{x} + 1}\]

Reproduce

herbie shell --seed 2021040 
(FPCore (x)
  :name "sqrtexp (problem 3.4.4)"
  :precision binary64
  (sqrt (/ (- (exp (* 2.0 x)) 1.0) (- (exp x) 1.0))))