private int decimalDigits ( double d, boolean expo ) {
    if( d == 0.0 ) return 0;
    d = Math.abs( d );
    int e = intDigits( d );
    if( expo ) {
      d /= Math.pow(10, e-1);
      e = 1;
    }
    if( e >= digits ) return 0;
    int iD = Math.max(1, e);  
    int dD = digits - e;
    if( !trailing && dD > 0 ) {  // to get rid of trailing zeros
      FloatingPointFormat f = new 
	FloatingPointFormat( iD + 1 + dD, dD, true);
      String dString = f.format( d );
      while( dD > 0 ) {
	if( dString.charAt(iD+1+dD-1) == '0' ) {
	  dD--;
	}
	else break;
      }
    }
    return dD;
  }