When to use `.Math.decrementExact(int x)` instead of `x--`

I read through the Oracle: class Math and was curious, why it even exists, when ive only seen -- yet.
7 Replies
JavaBot
JavaBot3w ago
This post has been reserved for your question.
Hey @Darknesslion5|Christian! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
ayylmao123xdd
ayylmao123xdd3w ago
i think the only big difference is that you get an artihmetic exception when the number would overflow so its safe when it comes to that what i mean is with if x is -2147483647 and you do x--
Darknesslion5|Christian
i know like int(2^32)-1
ayylmao123xdd
ayylmao123xdd3w ago
its 2147483647 yea
Darknesslion5|Christian
and it overflows thanks makes sense
JavaBot
JavaBot3w ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
JavaBot
JavaBot3w ago
Post Closed
This post has been closed by <@245536392308981760>.

Did you find this page helpful?