|
|
@@ -2199,7 +2199,9 @@ hashrate_pick_unit(float hashrate, unsigned char*unit)
|
|
|
unsigned char i;
|
|
|
for (i = 0; i <= *unit; ++i)
|
|
|
hashrate /= 1e3;
|
|
|
- while (hashrate >= 1000)
|
|
|
+
|
|
|
+ // 1000 but with tolerance for floating-point rounding, avoid showing "1000.0"
|
|
|
+ while (hashrate >= 999.95)
|
|
|
{
|
|
|
hashrate /= 1e3;
|
|
|
if (likely(_unitchar[*unit] != '?'))
|
|
|
@@ -2239,10 +2241,12 @@ hashrate_to_bufstr(char*buf, float hashrate, signed char unitin, enum h2bs_fmt f
|
|
|
|
|
|
for (i = 0; i <= unit; ++i)
|
|
|
hashrate /= 1000;
|
|
|
- if (hashrate >= 100 || unit < 2)
|
|
|
+ // 100 but with tolerance for floating-point rounding, max "99.99" then "100.0"
|
|
|
+ if (hashrate >= 99.995 || unit < 2)
|
|
|
prec = 1;
|
|
|
else
|
|
|
- if (hashrate >= 10)
|
|
|
+ // 10 but with tolerance for floating-point rounding, max "9.999" then "10.00"
|
|
|
+ if (hashrate >= 9.9995)
|
|
|
prec = 2;
|
|
|
else
|
|
|
prec = 3;
|