Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
6629 Discussions

IPP's Rounding Off Results is Not Consistent

OKohl
Beginner
131 Views
Hello,

I'm puzzled by an apparently inconsistencyin IPP's rounding off results:
In the first example the real result is 2.5 and IPP rounds it off to 2.
In the second example the real result is 93.5 and IPP rounds it off to 94.
Why is the 0.5 result sometimes rounded up and sometimes down?

e.g.

I'm using multiply by constant function with scaling 7 , in two cases:
(I'm giving an example for a single pixel result)

ippiMulC_16s_C1RSfs(Coeficient, ImagePtr, ImageBytesStep, RoiWork, 7);

A) Coeficient = 2, Image Pixel = 160

Result pixel is : 2 x 160 Scaled by 2^7 => 2.5 => IPP rounds the result to 2

B) Coeficient = 44, Image Pixel = 272

Result pixel is :44 x272 Scaled by 2^7 =>93.5 => IPP rounds the result to94


Thanks in advance
Offir
0 Kudos
2 Replies
igorastakhov
New Contributor II
131 Views
Hi Offir,

IPP provides the same behavior as HW provides by default - and it's mentioned in ippsmanual - all IPP functions by default round FP result to the nearest-even in order to provide more uniform distribution of results. So called "accounting" rounding (when 0.5 is always rounded up) is not uniform as results are always slightly shifted up.

Regards,
Igor
OKohl
Beginner
131 Views
Many thanks Igor
Reply