Skip to content

Commit 642f300

Browse files
committed
Resolve #136
1 parent 75f6fd2 commit 642f300

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/floating_point_numbers/conversion_to_integers.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,21 @@ IO.println(z);
4848
~}
4949
```
5050

51+
Negative numbers will also have their decimal part dropped. So numbers like `-7.2`, `-7.6`, and `-7.9` will
52+
all be converted into `-7`.
53+
54+
```java
55+
~void main() {
56+
int x = (int) -7.2;
57+
int y = (int) -7.6;
58+
int z = (int) -7.9;
59+
60+
IO.println(x);
61+
IO.println(y);
62+
IO.println(z);
63+
~}
64+
```
65+
5166
Any number that is too big to store in an `int` will be converted to the biggest possible `int`, 2<sup>31</sup> - 1.
5267

5368
```java

0 commit comments

Comments
 (0)