There are some corner cases where the C++ number promotion rules can hurt us badly. Devised a type selection logic to pick a suitable common numeric type explicitly, using `std::common_type<T1,T2>` in most cases, yet handling explicitly the case when the computation would wrap into unsigned; in such a mixed sign integral case, we either use int64_t (when its precision suffices), or long double, which can hold 64bit of mantissa without precision loss.
13 MiB
13 MiB
| The file is too large to be shown. |