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

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error0.5
Cost7297
\[\begin{array}{l} \mathbf{if}\;x \leq -1.3542965432784868:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + \left(2 + 0.5 \cdot \left(x \cdot x\right)\right)}\\ \end{array}\]
Alternative 2
Error0.7
Cost6913
\[\begin{array}{l} \mathbf{if}\;x \leq -0.993101058871446:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{x + 2}\\ \end{array}\]
Alternative 3
Error1.1
Cost6785
\[\begin{array}{l} \mathbf{if}\;x \leq -0.7827613871368203:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2}\\ \end{array}\]
Alternative 4
Error33.7
Cost64
\[1\]

Error

Derivation

  1. Initial program 40.6

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

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

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

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

Reproduce

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