On Sun, Apr 21, 2019 at 8:37 PM Pat Farrell <pat22...@gmail.com> wrote:

> I have a logic error in my calculation. I am getting -2147483648 in an
> int32
> This sure looks a lot like MinInt32, but I can't seem to be able to tell,
> all my calculators want to blow up on -1 << 31
>
>
> I'm willing to bet that my value is +/- one from whatever MinInt32 is in
> decimal form.
>

A 2s-complement 32-bit int by definition can represent the range
[-2147483648, 2147483647]. The definition of MinInt32 as `-1 << 31`
presumes a 2s-complement representation. Also, given your problem statement
why didn't you just compare the value you're getting from your calculation
for equality to MinInt32 to confirm they are equal?

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to