The C standard library provides the round, lround, and llround family of functions in C99. However, these functions are not IEEE-754 compliant, because they do not implement the "banker's rounding" of half-to-even as mandated by IEEE...
It doesn't make sense to talk about whether or not an individual function is "IEEE-754 compliant". IEEE-754 compliance requires that a set of data types operations with defined semantics be available. It does not require that those types or operations have specific names, nor does it require that only those operations be available. An implementation can provide whatever additional functions it wants and still be compliant. If an implementation wants to provide round-to-odd, round-random, round-away-from-zero, and trap-if-inexact, it can do so.
What IEEE-754 actually requires for rounding is that the following six operations are provided:
convertToIntegerTiesToEven(x)
convertToIntegerTowardZero(x)
convertToIntegerTowardPositive(x)
convertToIntegerTowardNegative(x)
convertToIntegerTiesToAway(x)
convertToIntegerExact(x)
In C and C++, the last five of these operations are bound to the trunc, ceil, floor, round, and rint functions, respectively. C11 and C++14 do not have a binding for the first, but future revisions will use roundeven. As you can see, round actually is one of the required operations.
However, roundeven is not available in current implementations, which brings us to the next part of your question:
The usual ad-hoc way to implement rounding in C is the expression (int)(x + 0.5f) which, despite being incorrect in strict IEEE-754 math, is usually translated by compilers into the correct cvtss2si instruction. However, this is certainly not a portable assumption.
The problems with that expression extend well-beyond "strict IEEE-754 math". It's totally incorrect for negative x, gives the wrong answer for nextDown(0.5), and turns all odd integers in the 2**23 binade into even integers. Any compiler that translates it into cvtss2si is horribly, horribly broken. If you have an example of that happening, I would love to see it.
How can I implement a function that will round any floating point value with half-to-even semantics?
As njuffa noted in a comment, you can ensure that the default rounding mode is set and use rint (or lrint, as it sounds like you actually want an integer result), or you can implement your own rounding function by calling round and then fixing up halfway cases like gnasher729 suggests. Once the n1778 bindings for C are adopted, you'll be able to use the roundeven or fromfp functions to do this operation without needing to control the rounding mode.
An implementation of this standard shall provide roundTiesToEven and the three directed rounding attributes. A decimal format implementation of this standard shall provide roundTiesToAway as a userselectable rounding-direction attribute. The rounding attribute roundTiesToAway is not required for a binary format implementation.Rounding of ties to even is the only portable (and sensible) mode. - 68ejxfcj5669round()look atrint()used with a default rounding mode of "round to nearest or even". - njuffarint(extremely unintuitive name). I had to double check the C standard, but it appears to indeed do the right thing when__STDC_IEC_559__is set. The real mystery is whyrounddoes something different fromrintandFE_TONEAREST. - 68ejxfcj5669