round up/down float to 2 decimals
<p>I would like to design a function <code>f(x : float, up : bool)</code> with these input/output:</p>

<pre><code># 2 decimals part rounded up (up = True)
f(142.452, True) = 142.46
f(142.449, True) = 142.45
# 2 decimals part rounded down (up = False)
f(142.452, False) = 142.45
f(142.449, False) = 142.44
</code></pre>

<p>Now, I know about Python's <code>round</code> built-in function but it will always round <code>142.449</code> up, which is not what I want.</p>

<p>Is there a way to do this in a nicer pythonic way than to do a bunch of float comparisons with epsilons (prone to errors)?</p>