code: def ceilpow2(n):
      
      signif,exponent = frexp(n)
      if (signif < 0):
          return 1;
      if (signif == 0.5):
          exponent -= 1;
      return (1) << exponent;
docs: convenience function to determine a power-of-2 upper frequency limit