code: public static boolean almostEqual(float a, float b, float absoluteDiff, float relativeDiff) {
          float diff = Math.abs(a - b);
          if (diff <= absoluteDiff) {
              return true;
          }
  
          a = Math.abs(a);
          b = Math.abs(b);
          float largest = (a > b) ? a : b;
  
          if (diff <= largest * relativeDiff) {
              return true;
          }
  
          return false;
      }
docs: Method checks if two float numbers are similar.