Addressed @mrdewitt's comments from #222

Also fixed a few small bugs:
 * the algo was stopping if the type was undefined
 * there is no need to check for -Infinity or -0, just for less than
+0.