[linux-audio-dev] Traps in floating point code

Steve Harris S.W.Harris at ecs.soton.ac.uk
Tue Jun 29 15:15:27 UTC 2004


On Tue, Jun 29, 2004 at 10:19:32AM +0200, Benno Senoner wrote:
>  for (;;)
>  {
>    /* Bunch of other code. */
> 
>    fullindex += increment;
>    integer = lrintf(fullindex);
>    fractional = fullindex - integer;

I dont think this is right, fractional will be [-0.5, 0.5], rather than
[0,1] which is more noirmal as lrintf() rounds to the nearest.

I think you should be using lrintf(floor(x)) or (int)x.

- Steve



More information about the Linux-audio-dev mailing list