Skip to main content
5 events
when toggle format what by license comment
Aug 27, 2020 at 16:25 comment added Bobby Dividing two integers yields an integer, dividing an integer by a float or the other way round yields a float, same for double. So if you'd happen to have a float/double instead of an integer, you'd get a float/double as result. Just something to be aware of. While we're at it, n /= 10 is shorthand for n = (T)(n / 10), with "T" being that type of n. So if we'd assume n to be an int, and you'd divide by a long n /= 10l the result would be silently truncated to int. Another small detail to be aware of.
Aug 26, 2020 at 17:01 comment added superb rain What do you mean with "relying on how integer division works in Java"?
Aug 26, 2020 at 16:06 history edited Bobby CC BY-SA 4.0
added 22 characters in body
Aug 24, 2020 at 4:04 vote accept coderfromhell
Aug 23, 2020 at 6:53 history answered Bobby CC BY-SA 4.0