v2.1: Full points, optimalzed code, all test passed.
v1.2 - Better calculate for floating point number.
v0.1