We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b770a3f + 3249f5a commit 630b54cCopy full SHA for 630b54c
content/til/2023-09-23-python-int-rounding.md
@@ -8,13 +8,17 @@ Here's the relevant excerpt from the [official docs][`int`]:
8
9
{% figure(caption="Example") %}
10
```python
11
-from math import floor
+from math import floor, ceil
12
+
13
assert(int(-0.8) == 0)
14
assert(floor(-0.8) == -1)
15
+assert(ceil(-0.8) == 0)
16
```
17
{% end %}
18
19
If you want the floored result, you need to use [`math.floor`].
20
+If you want the ceilling result, you need to use [`math.ceil`].
21
22
[`int`]: https://docs.python.org/3/library/functions.html#int
23
[`math.floor`]: https://docs.python.org/3/library/math.html#math.floor
24
+[`math.ceil`]: https://docs.python.org/3/library/math.html#math.ceil
0 commit comments