# ?

Average Error: 0.0 → 0.0
Time: 7.0s
Precision: binary64
Cost: 448

# ?

$\left(-1000000000 \leq a \land a \leq 1000000000\right) \land \left(-1000000000 \leq b \land b \leq 1000000000\right)$
$a + \frac{1}{a - b}$
$a + \frac{1}{a - b}$
(FPCore (a b) :precision binary64 (+ a (/ 1.0 (- a b))))
(FPCore (a b) :precision binary64 (+ a (/ 1.0 (- a b))))
double code(double a, double b) {
return a + (1.0 / (a - b));
}

double code(double a, double b) {
return a + (1.0 / (a - b));
}

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

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

public static double code(double a, double b) {
return a + (1.0 / (a - b));
}

public static double code(double a, double b) {
return a + (1.0 / (a - b));
}

def code(a, b):
return a + (1.0 / (a - b))

def code(a, b):
return a + (1.0 / (a - b))

function code(a, b)
return Float64(a + Float64(1.0 / Float64(a - b)))
end

function code(a, b)
return Float64(a + Float64(1.0 / Float64(a - b)))
end

function tmp = code(a, b)
tmp = a + (1.0 / (a - b));
end

function tmp = code(a, b)
tmp = a + (1.0 / (a - b));
end

code[a_, b_] := N[(a + N[(1.0 / N[(a - b), $MachinePrecision]),$MachinePrecision]), $MachinePrecision]  code[a_, b_] := N[(a + N[(1.0 / N[(a - b),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]

a + \frac{1}{a - b}

a + \frac{1}{a - b}


# Try it out?

Results

 In Out
Enter valid numbers for all inputs

# Derivation?

1. Initial program 0.0

$a + \frac{1}{a - b}$
2. Final simplification0.0

$\leadsto a + \frac{1}{a - b}$

# Alternatives

Alternative 1
Error16.7
Cost584
$\begin{array}{l} \mathbf{if}\;b \leq -3 \cdot 10^{-184}:\\ \;\;\;\;\frac{-1}{b}\\ \mathbf{elif}\;b \leq 2.1 \cdot 10^{-153}:\\ \;\;\;\;a - \frac{-1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{b}\\ \end{array}$
Alternative 2
Error16.7
Cost584
$\begin{array}{l} \mathbf{if}\;b \leq -4.4 \cdot 10^{-185}:\\ \;\;\;\;a + \frac{-1}{b}\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{-153}:\\ \;\;\;\;a - \frac{-1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{b}\\ \end{array}$
Alternative 3
Error17.6
Cost456
$\begin{array}{l} \mathbf{if}\;b \leq -3.9 \cdot 10^{-184}:\\ \;\;\;\;\frac{-1}{b}\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{-154}:\\ \;\;\;\;\frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{b}\\ \end{array}$
Alternative 4
Error31.9
Cost324
$\begin{array}{l} \mathbf{if}\;a \leq -2.75 \cdot 10^{-33}:\\ \;\;\;\;a\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{b}\\ \end{array}$
Alternative 5
Error60.5
Cost64
$a$

# Reproduce?

herbie shell --seed 1
(FPCore (a b)
:name "a + 1/(a - b)"
:precision binary64
:pre (and (and (<= -1000000000.0 a) (<= a 1000000000.0)) (and (<= -1000000000.0 b) (<= b 1000000000.0)))
(+ a (/ 1.0 (- a b))))