1. implicit cast to double
2. lose precision here due to double subtraction.
3. Use int64_t from <cctype> to correctly process big double values. For example, double can hold 1234567890123.1234 but int can't store 1234567890123.