add some more overflow treatment and make sure to set errno properly

(0) -1000 -300 -100 -30 -10 -1 +1 +10 tip

mercurial