atches what we expect.
      let sumOfMiddles = 0;
      let sumOfBinLengths = 0;
      for (const bin of values.bins) {
        sumOfMiddles += bin.count * (bin.min + bin.max) / 2;
        sumOfBinLengths += bin.count * (bin.max - bin.min);
      }

      const shift = (values.sum - sumOfMiddles) / sumOfBinLengths;
      // Note: for linear bins, if shift is less than -0.5, it means that even
      // if we put all samples at the lowest value of their bins their sum will
      // be less than the sum we re