This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Round-to-even without modifying rounding mode?


The rint() family of functions with the rounding mode set to
FE_TONEAREST is the only libc function I can find that will do
round-to-even. round() rounds half away from zero.

By setting various rounding modes rint() can do floor/ceil/trunc, but
there doesn't seem to be function that simply does round-to-even. Is
there one I've missed?

Alternatively, the reservations I have about setting the rounding mode
come from vague ideas about high costs involved with doing so and
potential problems from changing the rounding mode in a library. Are
either of these concerns valid, or should I simply save and restore
the rounding mode around a call to rint() to get round-to-even
behavior?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]