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

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] Traps in floating point code
From: Steve Harris (S.W.Harris_AT_ecs.soton.ac.uk)
Date: Tue Jun 29 2004 - 18:15:27 EEST


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


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Tue Jun 29 2004 - 18:07:17 EEST