From: Amitha P. <ami...@us...> - 2009-01-17 14:34:07
|
Tom Vercauteren wrote: > Such a solution would be OK for me. I would however use > "vnl_math_rnd_halfintup" rather than "vnl_math_rnd_nearest" > and > "vnl_math_rnd_halfinttoeven" rather than "vnl_math_rnd_even" Fine with me. > Also some users might find it confusing to have 3 different > implementations of vnl_math_rnd that only differ in how half integers > are rounded. Well, this cannot be avoided in a general sense, since the implementations are there because there is already an issue about what rounding should mean. I think the only solution is good documentation about which function does what, and what the tradeoffs are, and perhaps a "if you don't know of the issue, use this" type of recommendation. > One alternative would be to drop > "vnl_math_rnd_halfinttoeven" as it can be made redundant with the > current "vnl_math_rnd". That would imply that vnl_math_rnd must always round to even. This is not guaranteed, even with the assembler/SSE implementation, because it is dependent on the rounding mode. (You said the same thing in your message.) Keeping the three means that the semantics of vnl_math_rnd is less well defined (e.g., it could be either to even or to nearest), but is guaranteed to be the fastest possible on the platform. If the semantics matter more than the speed, then use the appropriately named function. Amitha. |