docs: function convertBase( str, baseOut, baseIn, sign ) {
              var d, e, k, r, x, xc, y,
                  i = str.indexOf( '.' ),
                  dp = DECIMAL_PLACES,
                  rm = ROUNDING_MODE;
  
              if ( baseIn < 37 ) str = str.toLowerCase();
  
              // Non-integer.
              if ( i >= 0 ) {
                  k = POW_PRECISION;
  
                  // Unlimited precision.
                  POW_PRECISION = 0;
                  str = str.replace( '.', '' );
                  y = new BigNumber(baseIn);
                  x = y.pow( str.length - i );
                  POW_PRECISION = k;
  
                  // Convert str as if an integer, then restore the fraction part by dividing the
                  // result by its base raised to a power.
                  y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );
                  y.e = y.c.length;
              }
  
              // Convert the number as integer.
              xc = toBaseOut( str, baseIn, baseOut );
              e = k = xc.length;
  
              // Remove trailing zeros.
              for ( ; xc[--k] == 0; xc.pop() );
              if ( !xc[0] ) return '0';
  
              if ( i < 0 ) {
                  --e;
              } else {
                  x.c = xc;
                  x.e = e;
  
                  // sign is needed for correct rounding.
                  x.s = sign;
                  x = div( x, y, dp, rm, baseOut );
                  xc = x.c;
                  r = x.r;
                  e = x.e;
              }
  
              d = e + dp + 1;
  
              // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.
              i = xc[d];
              k = baseOut / 2;
              r = r || d < 0 || xc[d + 1] != null;
  
              r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )
                         : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||
                           rm == ( x.s < 0 ? 8 : 7 ) );
  
              if ( d < 1 || !xc[0] ) {
  
                  // 1^-dp or 0.
                  str = r ? toFixedPoint( '1', -dp ) : '0';
              } else {
                  xc.length = d;
  
                  if (r) {
  
                      // Rounding up may mean the previous digit has to be rounded up and so on.
                      for ( --baseOut; ++xc[--d] > baseOut; ) {
                          xc[d] = 0;
  
                          if ( !d ) {
                              ++e;
                              xc = [1].concat(xc);
                          }
                      }
                  }
  
                  // Determine trailing zeros.
                  for ( k = xc.length; !xc[--k]; );
  
                  // E.g. [4, 11, 15] becomes 4bf.
                  for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );
                  str = toFixedPoint( str, e );
              }
  
              // The caller will add the sign.
              return str;
          }