[linux-audio-dev] branch-free denormal killer

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

Subject: [linux-audio-dev] branch-free denormal killer
From: Simon Jenkins (sjenkins_AT_blueyonder.co.uk)
Date: Sun Feb 01 2004 - 19:19:23 EET


Had the idea that you could kill denormals without branching
if you didn't mind "injuring" nearby numbers that weren't
quite denormal:

/* branch-free denormal killer */

inline float FlushToZero( volatile float f )
{
    f += 9.8607615E-32f;
    return f - 9.8607615E-32f;
}

/* end */

This function leaves anything higher than 9.8607615E-32
(ie 2 ** -103) completely unchanged. Numbers below this
value lose one bit of precision for each binary order of
magnitude they are below it. This has the effect that
denormal numbers lose *all* their precision, ie they
become zero.

Simon Jenkins
(Bristol, UK)


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

This archive was generated by hypermail 2b28 : Sun Feb 01 2004 - 18:14:51 EET