On Sun, 4 Dec 2022 at 22:53, Dean Rasheed <dean.a.rash...@gmail.com> wrote: > Ah, I see that you changed the overflow test, and I realise that I > forgot to answer your question about why I wrote that as 1 - INT_MIN / > 10 over on the other thread. > > The reason is that we need to detect whether tmp * base will exceed > -INT_MIN, not INT_MAX, since we're accumulating the absolute value of > a signed integer.
I think I'd been too focused on the simplicity of that expression and also the base 10 part. I saw that everything worked in base 10 and failed to give enough forward thought to other bases. I now see that it was wrong-headed to code it the way I had it. Thanks for pointing this out. I've just pushed a fix. David