Average Error: 52.0 → 0
Time: 4.2s
Precision: 64
$\left(0.1000000000000000055511151231257827021182 + 0.2000000000000000111022302462515654042363\right) - 0.2999999999999999888977697537484345957637$
$0.1000000000000000055511151231257827021182 + \left(0.2000000000000000111022302462515654042363 - 0.2999999999999999888977697537484345957637\right)$
\left(0.1000000000000000055511151231257827021182 + 0.2000000000000000111022302462515654042363\right) - 0.2999999999999999888977697537484345957637
0.1000000000000000055511151231257827021182 + \left(0.2000000000000000111022302462515654042363 - 0.2999999999999999888977697537484345957637\right)
double f() {
double r2212708 = 0.1;
double r2212709 = 0.2;
double r2212710 = r2212708 + r2212709;
double r2212711 = 0.3;
double r2212712 = r2212710 - r2212711;
return r2212712;
}


double f() {
double r2212713 = 0.1;
double r2212714 = 0.2;
double r2212715 = 0.3;
double r2212716 = r2212714 - r2212715;
double r2212717 = r2212713 + r2212716;
return r2212717;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 52.0

$\left(0.1000000000000000055511151231257827021182 + 0.2000000000000000111022302462515654042363\right) - 0.2999999999999999888977697537484345957637$
2. Using strategy rm
3. Applied associate--l+0

$\leadsto \color{blue}{0.1000000000000000055511151231257827021182 + \left(0.2000000000000000111022302462515654042363 - 0.2999999999999999888977697537484345957637\right)}$
4. Final simplification0

$\leadsto 0.1000000000000000055511151231257827021182 + \left(0.2000000000000000111022302462515654042363 - 0.2999999999999999888977697537484345957637\right)$

# Reproduce

herbie shell --seed 1
(FPCore ()
:name "0.1+0.2-0.3"
:precision binary64
(- (+ 0.10000000000000001 0.20000000000000001) 0.299999999999999989))