Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

ippiScale_32f8u - rounding incorrect?

rkuo
初学者
710 次查看

I noticed when attempting to match the behavior of ippiScale_32f8u that I was getting unexpected results from the intel function.

Specifically, scaling the following float rounds down to 0 instead of up to 1.

float a = 0.00196078443;

Since the float range is 0.0 to 1.0 and the 8u range is inherently 0 to 255, a * 255 = 0.50000002965. And thus the function should round up I believe, but the scaling function outputs 0 for this.  Am I misunderstanding how this should work?

 

0 项奖励
2 回复数
Ruqiu_C_Intel
主持人
692 次查看

Hello,

Thank you for contacting us!

Could you help provide out the information: IPP version, CPU platform, OS, etc? As well as a simple reproducer.

 

Have a nice day.

 

Regards,

Ruqiu

0 项奖励
rkuo
初学者
670 次查看

I literally just gave you the code to try.

I think I figured it out ... this is due to the use of "bankers rounding" aka "round to nearest, ties to even".  This makes sense, but should be documented in the function behavior.

0 项奖励
回复