diff options
Diffstat (limited to 'include/dspi/DSPI.h')
-rw-r--r-- | include/dspi/DSPI.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/dspi/DSPI.h b/include/dspi/DSPI.h new file mode 100644 index 0000000..d9e2acf --- /dev/null +++ b/include/dspi/DSPI.h @@ -0,0 +1,16 @@ +#ifndef DSPI_h +#define DSPI_h + +#define DSPImin(x,y) (((x)<(y)) ? (x) : (y)) +#define DSPImax(x,y) (((x)>(y)) ? (x) : (y)) +#define DSPIclip(min, x, max) (DSPImin(DSPImax((min), (x)), max)) + + +// test if floating point number is denormal +#define DSPI_IS_DENORMAL(f) (((*(unsigned int *)&(f))&0x7f800000) == 0) + +// test if almost denormal, choose whichever is fastest +#define DSPI_IS_ALMOST_DENORMAL(f) (((*(unsigned int *)&(f))&0x7f800000) < 0x08000000) +//#define DSPI_IS_ALMOST_DENORMAL(f) (fabs(f) < 3.e-34) + +#endif |