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: Tim Goetze (tim_AT_quitte.de)
Date: Thu Jul 01 2004 - 15:21:38 EEST


[Ruben van Royen]

>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.

yes, and it is wise to check if the results you obtain under the
manually changed rounding rule fit your spec.

>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.

i don't think it does, but the latest gcc i keep around is 3.0, and i
only use it to compare assembly output to 2.95 compilates.

afaik, the rounding mode handling is a peculiarity of the x86 arch,
and with gcc being a multi-arch compiler i can very well imagine the
gcc dev team omitting this special case.

tim


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 - 15:17:59 EEST