def format_p_value_for_num_iters(p, num_iters):
 if (num_iters < 10):
  return ('Too few iters to compute p-value (num_iters=%d)' % num_iters)
 decimal_places = int(log10((num_iters + 1)))
 result = (('%1.' + ('%df' % decimal_places)) % p)
 return result

def format_p_value_for_num_iters ( p , num_iters ) : if ( num_iters < 10 ) : return ( 'Too few iters to compute p-value (num_iters=%d)' % num_iters ) decimal_places = int ( log10 ( ( num_iters + 1 ) ) ) result = ( ( '%1.' + ( '%df' % decimal_places ) ) % p ) return result
adjust p to str w correct num of decimals for num monte carlo iters .