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: Maarten de Boer (mdeboer_AT_iua.upf.es)
Date: Mon Jun 28 2004 - 13:23:37 EEST


Hi Erik,

Depending on the ranges of your increment, and the accuracy you
want to obtain, you might consider doing this with integers only.

Maarten

> The fix in this case was this:
>
> for (;;)
> {
> /* Bunch of other code. */
>
> fractional += increment ;
> rem = fmod (fractional, 1.0); /* floating point modulus */
> integer += lrint (round (fractional - rem));
> fractional = rem;
> }


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

This archive was generated by hypermail 2b28 : Mon Jun 28 2004 - 13:17:13 EEST