Average Error: 0.0 → 0.0
Time: 9.5s
Precision: 64
$\left(1 - x\right) \cdot a + x \cdot b$
$1 \cdot a + x \cdot \left(b - a\right)$
\left(1 - x\right) \cdot a + x \cdot b
1 \cdot a + x \cdot \left(b - a\right)
double f(double x, double a, double b) {
double r2161328 = 1.0;
double r2161329 = x;
double r2161330 = r2161328 - r2161329;
double r2161331 = a;
double r2161332 = r2161330 * r2161331;
double r2161333 = b;
double r2161334 = r2161329 * r2161333;
double r2161335 = r2161332 + r2161334;
return r2161335;
}


double f(double x, double a, double b) {
double r2161336 = 1.0;
double r2161337 = a;
double r2161338 = r2161336 * r2161337;
double r2161339 = x;
double r2161340 = b;
double r2161341 = r2161340 - r2161337;
double r2161342 = r2161339 * r2161341;
double r2161343 = r2161338 + r2161342;
return r2161343;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.0

$\left(1 - x\right) \cdot a + x \cdot b$
2. Using strategy rm
3. Applied flip-+29.7

$\leadsto \color{blue}{\frac{\left(\left(1 - x\right) \cdot a\right) \cdot \left(\left(1 - x\right) \cdot a\right) - \left(x \cdot b\right) \cdot \left(x \cdot b\right)}{\left(1 - x\right) \cdot a - x \cdot b}}$
4. Taylor expanded around inf 0.0

$\leadsto \color{blue}{\left(1 \cdot a + x \cdot b\right) - a \cdot x}$
5. Simplified0.0

$\leadsto \color{blue}{1 \cdot a + x \cdot \left(b - a\right)}$
6. Final simplification0.0

$\leadsto 1 \cdot a + x \cdot \left(b - a\right)$

# Reproduce

herbie shell --seed 1
(FPCore (x a b)
:name "((1 - x) * a) + (x * b)"
:precision binary64
(+ (* (- 1 x) a) (* x b)))