Average Error: 41.2 → 0.1
Time: 8.3s
Precision: binary64
Cost: 19520
\[\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}} \]
\[{\left({\left(1 + e^{x}\right)}^{1.5}\right)}^{0.3333333333333333} \]
(FPCore (x)
 :precision binary64
 (sqrt (/ (- (exp (* 2.0 x)) 1.0) (- (exp x) 1.0))))
(FPCore (x)
 :precision binary64
 (pow (pow (+ 1.0 (exp x)) 1.5) 0.3333333333333333))
double code(double x) {
	return sqrt(((exp((2.0 * x)) - 1.0) / (exp(x) - 1.0)));
}
double code(double x) {
	return pow(pow((1.0 + exp(x)), 1.5), 0.3333333333333333);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = sqrt(((exp((2.0d0 * x)) - 1.0d0) / (exp(x) - 1.0d0)))
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((1.0d0 + exp(x)) ** 1.5d0) ** 0.3333333333333333d0
end function
public static double code(double x) {
	return Math.sqrt(((Math.exp((2.0 * x)) - 1.0) / (Math.exp(x) - 1.0)));
}
public static double code(double x) {
	return Math.pow(Math.pow((1.0 + Math.exp(x)), 1.5), 0.3333333333333333);
}
def code(x):
	return math.sqrt(((math.exp((2.0 * x)) - 1.0) / (math.exp(x) - 1.0)))
def code(x):
	return math.pow(math.pow((1.0 + math.exp(x)), 1.5), 0.3333333333333333)
function code(x)
	return sqrt(Float64(Float64(exp(Float64(2.0 * x)) - 1.0) / Float64(exp(x) - 1.0)))
end
function code(x)
	return (Float64(1.0 + exp(x)) ^ 1.5) ^ 0.3333333333333333
end
function tmp = code(x)
	tmp = sqrt(((exp((2.0 * x)) - 1.0) / (exp(x) - 1.0)));
end
function tmp = code(x)
	tmp = ((1.0 + exp(x)) ^ 1.5) ^ 0.3333333333333333;
end
code[x_] := N[Sqrt[N[(N[(N[Exp[N[(2.0 * x), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(N[Exp[x], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := N[Power[N[Power[N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 0.3333333333333333], $MachinePrecision]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
{\left({\left(1 + e^{x}\right)}^{1.5}\right)}^{0.3333333333333333}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 41.2

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

    \[\leadsto \color{blue}{\sqrt{1 + e^{x}}} \]
    Proof
    (sqrt.f64 (+.f64 1 (exp.f64 x))): 0 points increase in error, 0 points decrease in error
    (sqrt.f64 (Rewrite<= +-commutative_binary64 (+.f64 (exp.f64 x) 1))): 0 points increase in error, 0 points decrease in error
    (sqrt.f64 (Rewrite<= /-rgt-identity_binary64 (/.f64 (+.f64 (exp.f64 x) 1) 1))): 0 points increase in error, 0 points decrease in error
    (sqrt.f64 (/.f64 (+.f64 (exp.f64 x) 1) (Rewrite<= *-inverses_binary64 (/.f64 (-.f64 (exp.f64 x) 1) (-.f64 (exp.f64 x) 1))))): 153 points increase in error, 0 points decrease in error
    (sqrt.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (+.f64 (exp.f64 x) 1) (-.f64 (exp.f64 x) 1)) (-.f64 (exp.f64 x) 1)))): 0 points increase in error, 1 points decrease in error
    (sqrt.f64 (/.f64 (Rewrite<= difference-of-sqr-1_binary64 (-.f64 (*.f64 (exp.f64 x) (exp.f64 x)) 1)) (-.f64 (exp.f64 x) 1))): 18 points increase in error, 0 points decrease in error
    (sqrt.f64 (/.f64 (-.f64 (Rewrite<= exp-lft-sqr_binary64 (exp.f64 (*.f64 x 2))) 1) (-.f64 (exp.f64 x) 1))): 8 points increase in error, 0 points decrease in error
    (sqrt.f64 (/.f64 (-.f64 (exp.f64 (Rewrite<= *-commutative_binary64 (*.f64 2 x))) 1) (-.f64 (exp.f64 x) 1))): 0 points increase in error, 0 points decrease in error
  3. Applied egg-rr0.1

    \[\leadsto \color{blue}{{\left({\left(1 + e^{x}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
  4. Final simplification0.1

    \[\leadsto {\left({\left(1 + e^{x}\right)}^{1.5}\right)}^{0.3333333333333333} \]

Alternatives

Alternative 1
Error0.0
Cost12992
\[\sqrt{2 + \mathsf{expm1}\left(x\right)} \]
Alternative 2
Error17.7
Cost6464
\[\sqrt{2} \]

Error

Reproduce

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