Hi. Vincent. The hard part of Banker's Rounding function is to determine if the fractional part is *exactly* 0.5. Thus, to use ceil and floor , one way (for the positive case) is adding 0.5 to a double value, then judge whether the floor of result number equals to the ceil of result number. And equaty comparison could not avoid incurring inaccuracy, which is not what I want .Dealing with the bit pattern may looks odd, but it is correct. --
Regards, Zhan Jianyu Sent from cell phone. 在 2013-4-21 上午1:30,"Vincent Povirk" <madewokh...@gmail.com>写道: > Dealing with the bits of a floating point number directly is a bit > odd, and it makes it hard to review the code. Is there a reason you > don't want to use things like modf, floor, and ceil? > > >