function toEngineering(value, precision) {
  // find nearest lower multiple of 3 for exponent
  var e = value.e;
  var newExp = e % 3 === 0 ? e : e < 0 ? e - 3 - e % 3 : e - e % 3; // find difference in exponents, and calculate the value without exponent

  var valueWithoutExp = value.mul(Math.pow(10, -newExp));
  var valueStr = valueWithoutExp.toPrecision(precision);

  if (valueStr.indexOf('e') !== -1) {
    valueStr = valueWithoutExp.toString();
  }

  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 | string} value
 * @param {number} [precision]        Optional number of significant figures to return.
 */
Format a BigNumber in engineering notation.
Format a BigNumber in engineering notation .
function toEngineering(value, precision) {
  var e = value.e;
  var newExp = e % 3 === 0 ? e : e < 0 ? e - 3 - e % 3 : e - e % 3; 
  var valueWithoutExp = value.mul(Math.pow(10, -newExp));
  var valueStr = valueWithoutExp.toPrecision(precision);
  if (valueStr.indexOf('e') !== -1) {
    valueStr = valueWithoutExp.toString();
  }
  return valueStr + 'e' + (e >= 0 ? '+' : '') + newExp.toString();
}
function toEngineering ( value , precision ) { var e = value . e ; var newExp = e % 3 === 0 ? e : e < 0 ? e - 3 - e % 3 : e - e % 3 ; var valueWithoutExp = value . mul ( Math . pow ( 10 , - newExp ) ) ; var valueStr = valueWithoutExp . toPrecision ( precision ) ; if ( valueStr . indexOf ( 'e' ) !== - 1 ) { valueStr = valueWithoutExp . toString ( ) ; } return valueStr + 'e' + ( e >= 0 ? '+' : '' ) + newExp . toString ( ) ; }
Format a BigNumber in engineering notation.
Format a BigNumber in engineering notation .
// find nearest lower multiple of 3 for exponent // find difference in exponents, and calculate the value without exponent