# ?

Average Error: 58.6 → 0.0
Time: 11.4s
Precision: binary64
Cost: 6848

# ?

$-1 \leq x \land x \leq 1$
$\sqrt{1 + x} - 1$
$\frac{x}{1 + \sqrt{x + 1}}$
(FPCore (x) :precision binary64 (- (sqrt (+ 1.0 x)) 1.0))
(FPCore (x) :precision binary64 (/ x (+ 1.0 (sqrt (+ x 1.0)))))
double code(double x) {
return sqrt((1.0 + x)) - 1.0;
}

double code(double x) {
return x / (1.0 + sqrt((x + 1.0)));
}

real(8) function code(x)
real(8), intent (in) :: x
code = sqrt((1.0d0 + x)) - 1.0d0
end function

real(8) function code(x)
real(8), intent (in) :: x
code = x / (1.0d0 + sqrt((x + 1.0d0)))
end function

public static double code(double x) {
return Math.sqrt((1.0 + x)) - 1.0;
}

public static double code(double x) {
return x / (1.0 + Math.sqrt((x + 1.0)));
}

def code(x):
return math.sqrt((1.0 + x)) - 1.0

def code(x):
return x / (1.0 + math.sqrt((x + 1.0)))

function code(x)
return Float64(sqrt(Float64(1.0 + x)) - 1.0)
end

function code(x)
return Float64(x / Float64(1.0 + sqrt(Float64(x + 1.0))))
end

function tmp = code(x)
tmp = sqrt((1.0 + x)) - 1.0;
end

function tmp = code(x)
tmp = x / (1.0 + sqrt((x + 1.0)));
end

code[x_] := N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]],$MachinePrecision] - 1.0), $MachinePrecision]  code[x_] := N[(x / N[(1.0 + N[Sqrt[N[(x + 1.0),$MachinePrecision]], $MachinePrecision]),$MachinePrecision]), \$MachinePrecision]

\sqrt{1 + x} - 1

\frac{x}{1 + \sqrt{x + 1}}


# Try it out?

Results

 In Out
Enter valid numbers for all inputs

# Derivation?

1. Initial program 58.6

$\sqrt{1 + x} - 1$
2. Applied egg-rr0.0

$\leadsto \color{blue}{\frac{x}{\sqrt{1 + x} - -1}}$
3. Final simplification0.0

$\leadsto \frac{x}{1 + \sqrt{x + 1}}$

# Alternatives

Alternative 1
Error0.5
Cost832
$\frac{1}{x \cdot -0.125 + \left(0.5 + 2 \cdot \frac{1}{x}\right)}$
Alternative 2
Error0.6
Cost448
$x \cdot \left(x \cdot -0.125 + 0.5\right)$
Alternative 3
Error0.6
Cost448
$\frac{x}{2 + x \cdot 0.5}$
Alternative 4
Error1.3
Cost192
$x \cdot 0.5$

# Reproduce?

herbie shell --seed 1
(FPCore (x)
:name "sqrt(1+x)-1"
:precision binary64
:pre (and (<= -1.0 x) (<= x 1.0))
(- (sqrt (+ 1.0 x)) 1.0))