Average Error: 0.1 → 0.0
Time: 1.0m
Precision: 64
$\left(\left(\left(\left(\left(a - n\right) + \left(b - n\right)\right) + \left(c - n\right)\right) + \left(d - n\right)\right) + \left(e - n\right)\right) + \left(f - n\right)$
$\left(\left(\left(\left(a - n\right) + \left(b - n\right)\right) + c\right) - \left(n - d\right)\right) - \left(\left(n - \left(e - n\right)\right) - \left(f - n\right)\right)$
\left(\left(\left(\left(\left(a - n\right) + \left(b - n\right)\right) + \left(c - n\right)\right) + \left(d - n\right)\right) + \left(e - n\right)\right) + \left(f - n\right)
\left(\left(\left(\left(a - n\right) + \left(b - n\right)\right) + c\right) - \left(n - d\right)\right) - \left(\left(n - \left(e - n\right)\right) - \left(f - n\right)\right)
double f(double a, double n, double b, double c, double d, double e, double f) {
double r3437403 = a;
double r3437404 = n;
double r3437405 = r3437403 - r3437404;
double r3437406 = b;
double r3437407 = r3437406 - r3437404;
double r3437408 = r3437405 + r3437407;
double r3437409 = c;
double r3437410 = r3437409 - r3437404;
double r3437411 = r3437408 + r3437410;
double r3437412 = d;
double r3437413 = r3437412 - r3437404;
double r3437414 = r3437411 + r3437413;
double r3437415 = e;
double r3437416 = r3437415 - r3437404;
double r3437417 = r3437414 + r3437416;
double r3437418 = f;
double r3437419 = r3437418 - r3437404;
double r3437420 = r3437417 + r3437419;
return r3437420;
}


double f(double a, double n, double b, double c, double d, double e, double f) {
double r3437421 = a;
double r3437422 = n;
double r3437423 = r3437421 - r3437422;
double r3437424 = b;
double r3437425 = r3437424 - r3437422;
double r3437426 = r3437423 + r3437425;
double r3437427 = c;
double r3437428 = r3437426 + r3437427;
double r3437429 = d;
double r3437430 = r3437422 - r3437429;
double r3437431 = r3437428 - r3437430;
double r3437432 = e;
double r3437433 = r3437432 - r3437422;
double r3437434 = r3437422 - r3437433;
double r3437435 = f;
double r3437436 = r3437435 - r3437422;
double r3437437 = r3437434 - r3437436;
double r3437438 = r3437431 - r3437437;
return r3437438;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.1

$\left(\left(\left(\left(\left(a - n\right) + \left(b - n\right)\right) + \left(c - n\right)\right) + \left(d - n\right)\right) + \left(e - n\right)\right) + \left(f - n\right)$
2. Using strategy rm
3. Applied associate-+r-0.1

$\leadsto \left(\left(\color{blue}{\left(\left(\left(\left(a - n\right) + \left(b - n\right)\right) + c\right) - n\right)} + \left(d - n\right)\right) + \left(e - n\right)\right) + \left(f - n\right)$
4. Applied associate-+l-0.1

$\leadsto \left(\color{blue}{\left(\left(\left(\left(a - n\right) + \left(b - n\right)\right) + c\right) - \left(n - \left(d - n\right)\right)\right)} + \left(e - n\right)\right) + \left(f - n\right)$
5. Applied associate-+l-0.1

$\leadsto \color{blue}{\left(\left(\left(\left(a - n\right) + \left(b - n\right)\right) + c\right) - \left(\left(n - \left(d - n\right)\right) - \left(e - n\right)\right)\right)} + \left(f - n\right)$
6. Applied associate-+l-0.0

$\leadsto \color{blue}{\left(\left(\left(a - n\right) + \left(b - n\right)\right) + c\right) - \left(\left(\left(n - \left(d - n\right)\right) - \left(e - n\right)\right) - \left(f - n\right)\right)}$
7. Using strategy rm
8. Applied associate--r-0.0

$\leadsto \left(\left(\left(a - n\right) + \left(b - n\right)\right) + c\right) - \left(\left(\color{blue}{\left(\left(n - d\right) + n\right)} - \left(e - n\right)\right) - \left(f - n\right)\right)$
9. Applied associate--l+0.0

$\leadsto \left(\left(\left(a - n\right) + \left(b - n\right)\right) + c\right) - \left(\color{blue}{\left(\left(n - d\right) + \left(n - \left(e - n\right)\right)\right)} - \left(f - n\right)\right)$
10. Applied associate--l+0.0

$\leadsto \left(\left(\left(a - n\right) + \left(b - n\right)\right) + c\right) - \color{blue}{\left(\left(n - d\right) + \left(\left(n - \left(e - n\right)\right) - \left(f - n\right)\right)\right)}$
11. Applied associate--r+0.0

$\leadsto \color{blue}{\left(\left(\left(\left(a - n\right) + \left(b - n\right)\right) + c\right) - \left(n - d\right)\right) - \left(\left(n - \left(e - n\right)\right) - \left(f - n\right)\right)}$
12. Final simplification0.0

$\leadsto \left(\left(\left(\left(a - n\right) + \left(b - n\right)\right) + c\right) - \left(n - d\right)\right) - \left(\left(n - \left(e - n\right)\right) - \left(f - n\right)\right)$

# Reproduce

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