On Thu, Nov 22, 2018 at 06:57:15PM +0100, Hermann Meyer wrote: > Am 22.11.18 um 18:30 schrieb Will Godfrey: > > While testing some mixed floating point and integer calculations I found a > > quite surprising difference when this compiler option was set (gcc 6.x). It > > was > > clearly different at only 100 iterations and got dramatically worse with > > larger counts. > > > > ...
> In the guitarix project we've disabled -ffast-math several years ago, when > I remember right it was at gcc3, as it could lead to different > un-reproduciable calculations. Last option I've disabled on gcc8 now, is > -ffinite-math-only, this one leads to nan's and inf's in several cases, > which been as well not reproducible. -ffast-math should be perfectly OK for any normal audio DSP code. The only use case where I'd consider not using it is for precision measurement applications. If using it leads to unexpected results that means that the algorithm used is itself numerically unstable. A classic example of this is the 'biquad' and similar structures when used for filters that operate mainly on low frequencies. Unfortunately, that sort of code is everywhere, cut and pasted from one bad example to the next. Strange that this turns up right now. Earlier today I was implementing an IIR filter originally designed in MatLab which uses doubles for everything. When the coefficients were truncated to 32-bit floats, the filter became unstable. This doesn't mean that such a filter needs double precision. It just indicates bad design. Ciao, -- FA _______________________________________________ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org https://lists.linuxaudio.org/listinfo/linux-audio-dev