Fix an error in the previous pull request #46

I made a silly mistake in #46 that I chose the wrong side of truncation. Fix it and add a test