Dear Ilija,
Am Mittwoch, den 01.02.2012, 17:07 -0500 schrieb Ilija Hadzic:
[…]
+#define I2F_MAX_BITS 15 +#define I2F_MAX_INPUT ((2 << I2F_MAX_BITS) - 1) +#define I2F_SHIFT (24 - I2F_MAX_BITS)
+/*
- converts unsigned integer into 32-bit IEEE floating point representation;
- conversion is not universal and only works for the range from 0
- to 2^^I2F_MAX_BITS-1; currently we only use it with inputs between
- 0 and 16384 (inclusive), so I2F_MAX_BITS=15 is enough; if necessary
- I2F_MAX_BITS can be increased, but that will add to loop iterations
should that be t*w*o?
- and slow us down; conversion is done by shifting the input and counting
- down until the first 1 reaches bit position 23; the resulting counter
- and the shifted input are the exponent and the fraction; the sign is
- always zero
- */
I like sentences with capital starting letter and full stop at the end better. But I do not know if there are any guidelines for that.
[…]
Thanks,
Paul