------- Comment #17 from paolo dot carlini at oracle dot com 2009-10-22 17:46 ------- Is something known about the actual size of a, b, and c? Also, I don't know which is the required precision for the result: must be exact if representable? I suppose not, otherwise the suggestiong of using double would not make sense. Depending on the answer to the above, there are various options, maybe checking for a * b overflowing (if the quantities are all positive, then checking for wraparound is easy) and then taking the appropriate actions.
Anyway, barring more sophisticated solutions, using long double seems a better idea to me, because on most widespread targets a long double is at least 80 bits, with a mantissa of at least 64 bits, thus able to exactly represent any long long integer. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40852