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: Ruben van Royen (rvroyen_AT_guidedbees.com)
Date: Thu Jul 01 2004 - 11:37:33 EEST


The problem is that the rounding mode affects all floating point operations,
such as multiply and divide. And normally you must do rounding and not
truncation. Thus changing the mode will change the results, and a compiler is
not allowed to do that.
Only in very specific cases, such as a loop that converts an array float
values to integers, where the truncation is the only floating point operation
in the loop, is the compiler allowed to do the mode settings outside the
loop. But I'm not sure if gcc does this.

Ruben

On Thursday 01 July 2004 10:14, Steve Harris wrote:
> On Wed, Jun 30, 2004 at 11:09:28 +0200, Tim Goetze wrote:
> > so if you want quick fractional sample lookups, the best option on x86
> > i see is to manually "fldcw" before and after your sample loop, and
> > use lrintf() or "fistpl" directly to obtain integer indices inside
> > the loop.
>
> I wonder why gcc doenst spot that?
>
> - Steve


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

This archive was generated by hypermail 2b28 : Thu Jul 01 2004 - 11:29:57 EEST