https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61876
--- Comment #6 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- On Tue, 22 Jul 2014, ktkachov at gcc dot gnu.org wrote: > From what I understand lround can potentially set errno on a domain error > whereas round is valid everywhere and the cast to long int could be undefined > behaviour if the double is not valid, but undefined behaviour is not the same > as setting errno... Under Annex F the cast isn't undefined behavior but raising the "invalid" exception and returning an unspecified value (which must be a valid value of type long, i.e. the program must behave as if each execution of the cast in the abstract machine has some particular value of type long it returns).