Skip to content

Commit 630b54c

Browse files
authored
Merge pull request #8 from Its-Just-Nans/ceil-func
add link to ceil function
2 parents b770a3f + 3249f5a commit 630b54c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

content/til/2023-09-23-python-int-rounding.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ Here's the relevant excerpt from the [official docs][`int`]:
88
99
{% figure(caption="Example") %}
1010
```python
11-
from math import floor
11+
from math import floor, ceil
12+
1213
assert(int(-0.8) == 0)
1314
assert(floor(-0.8) == -1)
15+
assert(ceil(-0.8) == 0)
1416
```
1517
{% end %}
1618

1719
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`].
1821

1922
[`int`]: https://docs.python.org/3/library/functions.html#int
2023
[`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

Comments
 (0)