type cast 'double' is used to avoid overflow.