# ?

Average Error: 0.0 → 0.0
Time: 3.0s
Precision: binary64
Cost: 576

# ?

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

double code(double x) {
return (1.0 - x) / (1.0 - (x * x));
}

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

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

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

public static double code(double x) {
return (1.0 - x) / (1.0 - (x * x));
}

def code(x):
return 1.0 / (1.0 + x)

def code(x):
return (1.0 - x) / (1.0 - (x * x))

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

function code(x)
return Float64(Float64(1.0 - x) / Float64(1.0 - Float64(x * x)))
end

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

function tmp = code(x)
tmp = (1.0 - x) / (1.0 - (x * x));
end

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

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

\frac{1}{1 + x}

\frac{1 - x}{1 - x \cdot x}


# Try it out?

Results

 In Out
Enter valid numbers for all inputs

# Derivation?

1. Initial program 0.0

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

$\leadsto \color{blue}{\frac{1}{1 - x \cdot x} \cdot \left(1 - x\right)}$
3. Simplified0.0

$\leadsto \color{blue}{\frac{1 - x}{1 - x \cdot x}}$
Proof
[Start]0.0 $\frac{1}{1 - x \cdot x} \cdot \left(1 - x\right)$ $\color{blue}{\frac{1 \cdot \left(1 - x\right)}{1 - x \cdot x}}$ $\frac{\color{blue}{1 - x}}{1 - x \cdot x}$
4. Final simplification0.0

$\leadsto \frac{1 - x}{1 - x \cdot x}$

# Alternatives

Alternative 1
Error0.0
Cost320
$\frac{1}{1 + x}$
Alternative 2
Error1.4
Cost192
$1 - x$
Alternative 3
Error1.9
Cost64
$1$

# Reproduce?

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