Average Error: 0.0 → 0.0
Time: 3.5s
Precision: 64
$\left(a - n\right) + \left(b - n\right)$
$a + \left(b - 2 \cdot n\right)$
\left(a - n\right) + \left(b - n\right)
a + \left(b - 2 \cdot n\right)
double f(double a, double n, double b) {
double r3416358 = a;
double r3416359 = n;
double r3416360 = r3416358 - r3416359;
double r3416361 = b;
double r3416362 = r3416361 - r3416359;
double r3416363 = r3416360 + r3416362;
return r3416363;
}


double f(double a, double n, double b) {
double r3416364 = a;
double r3416365 = b;
double r3416366 = 2.0;
double r3416367 = n;
double r3416368 = r3416366 * r3416367;
double r3416369 = r3416365 - r3416368;
double r3416370 = r3416364 + r3416369;
return r3416370;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.0

$\left(a - n\right) + \left(b - n\right)$
2. Using strategy rm
3. Applied sub-neg0.0

$\leadsto \color{blue}{\left(a + \left(-n\right)\right)} + \left(b - n\right)$
4. Applied associate-+l+0.0

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

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

$\leadsto a + \left(b - 2 \cdot n\right)$

# Reproduce

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