Average Error: 0.0 → 0.0
Time: 8.9s
Precision: 64
$\left(0 \le x \land x \le 1\right) \land \left(0.125 \le k \land k \le 0.5\right)$
$\frac{x}{x \cdot \left(1 - k\right) + k}$
$\frac{x}{k + \left(x - k \cdot x\right)}$
\frac{x}{x \cdot \left(1 - k\right) + k}
\frac{x}{k + \left(x - k \cdot x\right)}
double f(double x, double k) {
double r16248781 = x;
double r16248782 = 1.0;
double r16248783 = k;
double r16248784 = r16248782 - r16248783;
double r16248785 = r16248781 * r16248784;
double r16248786 = r16248785 + r16248783;
double r16248787 = r16248781 / r16248786;
return r16248787;
}


double f(double x, double k) {
double r16248788 = x;
double r16248789 = k;
double r16248790 = r16248789 * r16248788;
double r16248791 = r16248788 - r16248790;
double r16248792 = r16248789 + r16248791;
double r16248793 = r16248788 / r16248792;
return r16248793;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.0

$\frac{x}{x \cdot \left(1 - k\right) + k}$
2. Taylor expanded around 0 0.0

$\leadsto \frac{x}{\color{blue}{\left(x - x \cdot k\right)} + k}$
3. Final simplification0.0

$\leadsto \frac{x}{k + \left(x - k \cdot x\right)}$

# Reproduce

herbie shell --seed 1
(FPCore (x k)
:name "x/(x*(1-k)+k)"
:pre (and (and (<= 0 x) (<= x 1)) (and (<= 0.125 k) (<= k 0.5)))
(/ x (+ (* x (- 1 k)) k)))