<p dir="ltr"></p>
<p dir="ltr">Hi.  Vincent.</p>
<p dir="ltr">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 <br>

inaccuracy, which is not what I want .Dealing with the bit pattern may looks odd, but it is correct.<br>
--</p>
<p dir="ltr">Regards,<br>
Zhan Jianyu</p>
<p dir="ltr">Sent from cell phone.</p>
<div class="gmail_quote">在 2013-4-21 上午1:30,"Vincent Povirk" <<a href="mailto:madewokherd@gmail.com">madewokherd@gmail.com</a>>写道:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dealing with the bits of a floating point number directly is a bit<br>
odd, and it makes it hard to review the code. Is there a reason you<br>
don't want to use things like modf, floor, and ceil?<br>
<br>
<br>
</blockquote></div>