Fix a copy paste error and an error on numbers of the form "X."

We were using integralPart instead of fractionalPart. We also didn't check for empty strings.

I added a several test cases to this effect.