[PlanetCCRMA] Pentium-4 and denormal numbers on planetccrma

Fernando Lopez-Lezcano nando@ccrma.Stanford.EDU
Fri Jan 28 15:20:02 2005


On Fri, 2005-01-28 at 14:51, Fernando Lopez-Lezcano wrote:
> On Wed, 2005-01-12 at 03:40, Steve Harris wrote:
> > On Mon, Jan 10, 2005 at 11:07:55 +0100, andersvi@extern.uio.no wrote:
> > NB, using the SSE instruction set uses a more efficient denormal handler
> > (about 40x slower than processing a normal number), but it still doesnt
> > zero them, if you also call this function I hacked up when the program
> > starts:
> 
> Hi Steve, I'm trying to use this to see if I can get freeverb back from 
> denormal hell, but I can't compile it as position independent code as in
> that mode the compiler uses the bx register (I did some searches but
> could not find a solution that both compiled and did not segfault :-)

I tried adding noise to the inputs (from
http://www.musicdsp.org/files/denormal.pdf):

unsigned int rand_state = 1;

inline add_white_noise (float &val) {
  rand_state = rand_state * 1234567UL + 890123UL;
  int mantissa = rand_state & 0x807F0000;
  int flt_rnd = mantissa | 0x1e999999;
  val += *reinterpret_cast <const flat*> (&flt_rnd);
}

And while it is a hack it did work, surprisingly. 
Perhaps not the best solution.....

-- Fernando