Fixed point int min value

I am reading about positive and negative infinity in c++ and i am trying to implement them in a fixed point math arthimethic implementation

i can see that max of a int will be equal to std::numeric_limits<int>::max();
and min value of the int will be equal to std::numeric_limits<int>::min();
in c++

Here as i am defining the int max and int min manually in my fixed point math implemenation, my doubt is int min = -int max; or int min = -int max -1; ?

can someone clear it?




Last edited on
It depends on what representation is being used but in two's complement:
std::numeric_limits<int>::max() == -(std::numeric_limits<int>::min() + 1)
Topic archived. No new replies allowed.