What you are trying is impossible for 2 reasons.
First, INT_MAX + INT_MAX
cannot be represented by an int
, which is logical since the maximum value of an int
is INT_MAX
. This leads to an overflow.
Second, even if you try to do (3 / (3 + 3))
you will get 0 since you are working with integers and not fractional numbers. Do do what you want to do you can try:
static_cast<double>(INT_MAX) / (static_cast<double>(INT_MAX) + static_cast<double>(INT_MAX))
though this has no interest.
9
solved INT_MAX divided by twice of itself (INT_MAX * 2)