function decCoefficientToBinaryString(x) {
  // Convert to string
  var a = x.d; // array with digits

  var r = a[0] + '';

  for (var i = 1; i < a.length; ++i) {
    var s = a[i] + '';

    for (var z = 7 - s.length; z--;) {
      s = '0' + s;
    }

    r += s;
  }

  var j = r.length;

  while (r.charAt(j) === '0') {
    j--;
  }

  var xe = x.e;
  var str = r.slice(0, j + 1 || 1);
  var strL = str.length;

  if (xe > 0) {
    if (++xe > strL) {
      // Append zeros.
      xe -= strL;

      while (xe--) {
        str += '0';
      }
    } else if (xe < strL) {
      str = str.slice(0, xe) + '.' + str.slice(xe);
    }
  } // Convert from base 10 (decimal) to base 2


  var arr = [0];

  for (var _i2 = 0; _i2 < str.length;) {
    var arrL = arr.length;

    while (arrL--) {
      arr[arrL] *= 10;
    }

    arr[0] += parseInt(str.charAt(_i2++)); // convert to int

    for (var _j = 0; _j < arr.length; ++_j) {
      if (arr[_j] > 1) {
        if (arr[_j + 1] === null || arr[_j + 1] === undefined) {
          arr[_j + 1] = 0;
        }

        arr[_j + 1] += arr[_j] >> 1;
        arr[_j] &= 1;
      }
    }
  }

  return arr.reverse();
}
Applies bitwise function to numbers
@param {BigNumber} x
@param {BigNumber} y
@param {function (a, b)} func
@return {BigNumber}