Tao Xu <tao3...@intel.com> writes: > On 11/25/2019 2:56 PM, Markus Armbruster wrote: >> Tao Xu <tao3...@intel.com> writes: >> >>> Support full 64bit precision, modify related test cases. >> >> That's not true in general: long double need not be any wider than >> double. >> >> It might be true on the host machines we support, but I don't know. If >> we decide to rely on it, we better make the build fail when the host >> machine doesn't meet our expectations, preferably in configure. >> > [...] >>> - if ((val * mul >= 0xfffffffffffffc00) || val < 0) { >>> + /* Values > UINT64_MAX overflow uint64_t */ >>> + if ((val * mul > UINT64_MAX) || val < 0) { >>> retval = -ERANGE; >>> goto out; >>> } >> >> Not portable. If it was, we'd have made this changd long ago :) >> > > OK. So the suitable solution is what you suggested in v14? > > "A possible alternative is to parse the numeric part both as a double > and as a 64 bit unsigned integer, then use whatever consumes more > characters. This enables providing full 64 bits unless you actually > use > a fraction."
Yes, that bypasses the portability issue. > I will try this way. Go ahead.