samedi 27 juin 2015

_mm_cvt_ss2si gives different results than simple rounding

In the code below, method A differs from method B. Can someone explain why _mm_cvt_ss2si rounds to even number when decimal part is exactly 0.5 ?

float f;

// rounding method  A
_mm_cvt_ss2si(_mm_load_ss(&f));

// rounding method B
(long)((f>0.0f) ? (f + 0.5f):(f -0.5f));

Aucun commentaire:

Enregistrer un commentaire