Subject: Re: [linux-audio-dev] Denormalisation considered harmful?
From: Paul Barton-Davis (pbd_AT_Op.Net)
Date: Wed Nov 29 2000 - 15:31:23 EET
>PS For those who don't know, there is a problem when you try to do maths
> with floats that are very small on some chips. The FPU generates an
> interrupt, and normalises the bits of one float so that that maths
> won't loose precision. It's the best way to meet IEEE precision
> requirements aparentnly. Anyway, the interrupt is very expensive, so to
> aviod it people do nasty things like adding a DC offset (erk) or noise
> (Erk!) to the signal, or disabling interrups. There is a better hack
> that fixes it:
I have an even better way that involves basically no CPU cycles. This
is from snd:
-----------------------------------------------------------------------
#ifdef HAVE_FPU_CONTROL_H
#include <fpu_control.h>
#endif
#ifdef HAVE_FPU_CONTROL_H
#if __GLIBC_MINOR__ < 1
/* in linux there's <fpu_control.h> with __setfpucw which Clisp calls as __setfpucw(_FPU_IEEE); */
/* this appears to be useful in getting rid of idiotic NaN's */
__setfpucw(_FPU_IEEE);
#else
#ifndef __alpha__
int __fpu_ieee = _FPU_IEEE;
_FPU_SETCW(__fpu_ieee);
/* this bugfix thanks to Paul Barton-Davis */
#else
int __fpu_ieee = 0;
#endif
#endif
#endif
-----------------------------------------------------------------------
this turns off the interrupt for denormals.
--p
--p
This archive was generated by hypermail 2b28 : Wed Nov 29 2000 - 17:18:09 EET