eina: fix a rounding issue in eina_f32p32_{cos,sin} when getting close to 1.0.
Bug only showed up if above 0.999 . SVN revision: 70831
This commit is contained in:
parent
59a132264f
commit
7d400fb5d9
|
@ -266,3 +266,7 @@
|
|||
2012-04-30 Jérôme Pinot
|
||||
|
||||
* Add missing files in the tarballs.
|
||||
|
||||
2012-05-06 Cedric Bail
|
||||
|
||||
* Fix a rounding issue near 1.0 for eina_f32p32_cos and eina_f32p32_sin.
|
||||
|
|
|
@ -8,6 +8,7 @@ Additions:
|
|||
|
||||
Fixes:
|
||||
* Add missing files in the tarball.
|
||||
* Rounding issue with eina_f32p32_cos and eina_f32p32_sin when getting close to 1.0.
|
||||
|
||||
Eina 1.2.0
|
||||
|
||||
|
|
|
@ -449,7 +449,7 @@ eina_f32p32_cos(Eina_F32p32 a)
|
|||
/* Find which case from 0 to 2 * PI */
|
||||
remainder_2PI = a - (a / F32P32_2PI) * F32P32_2PI;
|
||||
|
||||
interpol = eina_f32p32_div(eina_f32p32_scale(remainder_PI, MAX_PREC * 2),
|
||||
interpol = eina_f32p32_div(eina_f32p32_scale(remainder_PI, (MAX_PREC - 1) * 2),
|
||||
EINA_F32P32_PI);
|
||||
idx = eina_f32p32_int_to(interpol);
|
||||
if (idx >= MAX_PREC)
|
||||
|
@ -504,15 +504,15 @@ eina_f32p32_sin(Eina_F32p32 a)
|
|||
/* Find which case from 0 to 2 * PI */
|
||||
remainder_2PI = a - (a / F32P32_2PI) * F32P32_2PI;
|
||||
|
||||
interpol = eina_f32p32_div(eina_f32p32_scale(remainder_PI, MAX_PREC * 2),
|
||||
interpol = eina_f32p32_div(eina_f32p32_scale(remainder_PI, (MAX_PREC - 1) * 2),
|
||||
EINA_F32P32_PI);
|
||||
idx = eina_f32p32_int_to(interpol);
|
||||
if (idx >= MAX_PREC)
|
||||
idx = 2 * MAX_PREC - (idx + 1);
|
||||
idx = 2 * MAX_PREC - (idx + 1);
|
||||
|
||||
index2 = idx + 1;
|
||||
if (index2 == MAX_PREC)
|
||||
index2 = idx - 1;
|
||||
index2 = idx - 1;
|
||||
|
||||
result = eina_f32p32_add(eina_trigo[idx],
|
||||
eina_f32p32_mul(eina_f32p32_sub(eina_trigo[idx],
|
||||
|
|
Loading…
Reference in New Issue