No, I stand by my code.  If the final loop ends with a negative result, it
is necessarily MIN_VALUE, since otherwise there was overflow.
 But -MIN_VALUE == MIN_VALUE, so no harm is done!  Compile it and see...

--
Eric Blake, Elixent, Castlemead, Lwr Castle St., Bristol BS1 3AG, UK
[EMAIL PROTECTED]   tel:+44(0)117 917 5611


> -----Original Message-----
> From: C. Scott Ananian [mailto:[EMAIL PROTECTED]]
> Sent: 27 July 2001 16:59
> To: Eric Blake
> Cc: [EMAIL PROTECTED]; classpath
> Subject: Re: [Classpath] RE: Informative throws
>
>
> On Fri, 27 Jul 2001, Eric Blake wrote:
>
> >     if (negative)
> >       return -result;
> >     return result;
> >   }
>
> you actually have to do this the other way 'round (maintain the number
> negative as you build it, then negate it if the number was really
> positive) because the negative range of the integer types is larger than
> the positive range.  Try parsing Integer.MIN_VALUE, for example: your code
> will break.
>  --s


_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to