Reduce the range error behavior

Use mutiplication instead of multiple subtraction to reduce float point error.