How to round up to 32 using the math module (Python 3,)
Question: Is it possible to round upwords using the built-in math module? I know that
you can use math.floor() to round down, but is there a way to round up?
Currently, I use this to round:

    
    
    def roundTo32(x, base=32):
        return int(base * round(float(x) / base))
    

but that doesn't always round up.


Answer: Use [`math.ceil()`](http://docs.python.org/2/library/math.html#math.ceil) to
round float values up:

    
    
    import math
    
    def roundTo32(x, base=32):
        return int(base * math.ceil(float(x) / base))
    

Demo:

    
    
    >>> import math
    >>> def roundTo32(x, base=32):
    ...     return int(base * math.ceil(float(x) / base))
    ... 
    >>> roundTo32(15)
    32
    >>> roundTo32(33)
    64
    

