Average Error: 0.0 → 0.0
Time: 9.8s
Precision: 64
$\left(1 - Alpha\right) \cdot A + Alpha \cdot B$
$1 \cdot A + Alpha \cdot \left(B - A\right)$
\left(1 - Alpha\right) \cdot A + Alpha \cdot B
1 \cdot A + Alpha \cdot \left(B - A\right)
double f(double Alpha, double A, double B) {
double r1731013 = 1.0;
double r1731014 = Alpha;
double r1731015 = r1731013 - r1731014;
double r1731016 = A;
double r1731017 = r1731015 * r1731016;
double r1731018 = B;
double r1731019 = r1731014 * r1731018;
double r1731020 = r1731017 + r1731019;
return r1731020;
}


double f(double Alpha, double A, double B) {
double r1731021 = 1.0;
double r1731022 = A;
double r1731023 = r1731021 * r1731022;
double r1731024 = Alpha;
double r1731025 = B;
double r1731026 = r1731025 - r1731022;
double r1731027 = r1731024 * r1731026;
double r1731028 = r1731023 + r1731027;
return r1731028;
}



# Try it out

Your Program's Arguments

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.0

$\left(1 - Alpha\right) \cdot A + Alpha \cdot B$
2. Using strategy rm
3. Applied flip-+29.7

$\leadsto \color{blue}{\frac{\left(\left(1 - Alpha\right) \cdot A\right) \cdot \left(\left(1 - Alpha\right) \cdot A\right) - \left(Alpha \cdot B\right) \cdot \left(Alpha \cdot B\right)}{\left(1 - Alpha\right) \cdot A - Alpha \cdot B}}$
4. Taylor expanded around inf 0.0

$\leadsto \color{blue}{\left(1 \cdot A + B \cdot Alpha\right) - A \cdot Alpha}$
5. Simplified0.0

$\leadsto \color{blue}{1 \cdot A + Alpha \cdot \left(B - A\right)}$
6. Final simplification0.0

$\leadsto 1 \cdot A + Alpha \cdot \left(B - A\right)$

# Reproduce

herbie shell --seed 1
(FPCore (Alpha A B)
:name "((1 - Alpha) * A) + (Alpha * B)"
:precision binary64
(+ (* (- 1 Alpha) A) (* Alpha B)))