function toEngineering (value, precision) {
  // find nearest lower multiple of 3 for exponent
  const e = value.e
  const newExp = e % 3 === 0 ? e : (e < 0 ? (e - 3) - (e % 3) : e - (e % 3))

  // find difference in exponents, and calculate the value without exponent
  const valueWithoutExp = value.mul(Math.pow(10, -newExp))

  let valueStr = valueWithoutExp.toPrecision(precision)
  if (valueStr.includes('e')) {
    const BigNumber = value.constructor
    valueStr = new BigNumber(valueStr).toFixed()
  }

  return valueStr + 'e' + (e >= 0 ? '+' : '') + newExp.toString()
}
Format a BigNumber in engineering notation. Like '1.23e+6', '2.3e+0', '3.500e-3'
@param {BigNumber} value
@param {number} [precision]        Optional number of significant figures to return.