Browse Source

Merge pull request #267 from Krellan/master

Changed comparison constants to allow for floating-point rounding
Luke-Jr 12 years ago
parent
commit
581d25d606
1 changed files with 2 additions and 2 deletions
  1. 2 2
      miner.c

+ 2 - 2
miner.c

@@ -2617,10 +2617,10 @@ int percentf3(char * const buf, size_t sz, double p, const double t)
 	{
 	{
 
 
 	p /= t;
 	p /= t;
-	if (p < 0.01)
+	if (p < 0.00995)  // 0.01 but with tolerance for floating-point rounding, max ".99%"
 		_SNP(".%02.0f%%", p * 10000);  // ".01%"
 		_SNP(".%02.0f%%", p * 10000);  // ".01%"
 	else
 	else
-	if (p < 0.1)
+	if (p < 0.0995)  // 0.1 but with tolerance for floating-point rounding, max "9.9%"
 		_SNP("%.1f%%", p * 100);  // "9.1%"
 		_SNP("%.1f%%", p * 100);  // "9.1%"
 	else
 	else
 		_SNP("%3.0f%%", p * 100);  // " 99%"
 		_SNP("%3.0f%%", p * 100);  // " 99%"