Benno wrote:
> nope, Intel manuals specify this rounding behaviour explicitly,
> (they have chosen it because it delivers the best results on a large chain of
> operations)
>
> and 1.5 can for example be represended exactly in floating point
> because it's mantisse is 1.100000000 .....
Ooops. My mistake.
> The second method won't work without the last if() due to to the rounding
> behaviour described above.
> So even with this final if() , do you still believe that method 2 will be
> faster ?
> At least in the second case the if is executed very seldom, thus the CPU
> should achieve a high amount of hits when doing branch prediction.
> does this make sense ?
Absolutely. The if() branch will almost never be taken, so the processor can
predict it correctly almost every time, so there will be negligible penalty.
Karl.