Fix bug in bounded int/float logic.

See discussion here: https://github.com/ipython/ipython/commit/3644592c60fbed29855ccf37cef250ee053c5c5d#commitcomment-7665004