Browse Source

Require exact multiple match to be more exact.

Graham Booker 6 years ago
parent
commit
8505327a56
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/display/DisplayManager.cpp

+ 3 - 2
src/display/DisplayManager.cpp

@@ -85,11 +85,12 @@ bool DisplayManager::isRateMultipleOf(float refresh, float multiple, bool exact)
   if (roundedRefresh == 0)
       return false;
 
-  float newRate = roundedMultiple / roundedRefresh * refresh;
+  long factor = roundedMultiple / roundedRefresh;
+  float newRate = factor * refresh;
   if (newRate < 1)
     return false;
 
-  float tolerance = exact ? 0.1 : 1;
+  float tolerance = exact ? 0.01 * factor : 1;
 
   return fabs(newRate - multiple) < tolerance;
 }