Avoid floating point precision errors in -p option

This commit is contained in:
Andrea Mazzoleni 2026-05-21 10:38:54 +02:00
parent ecce8b136c
commit e17bb92f69

View file

@ -1103,7 +1103,8 @@ int snapraid_main(int argc, char* argv[])
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
plan100 = plan_double * 100;
/* +0.5 avoids floating point precision error of strtod, like "0.7" -> 0.6999... -> 0.6 */
plan100 = plan_double * 100 + 0.5;
}
break;
case 'o' :