I would be delighted, actually, to learn that I'm wrong and haveQuote:>mantissa = comp_t & 0x1FFF

>exponent = comp_t & 0xE000

>double ticks = ldexp( (double)mantissa, 3*exponent)

TryQuote:>someone provide a more sensible explanation.

ticks = (double)((comp_t & 0x1fff) << 3 * (comp_t & 0xe000));

The reason your ldexp call is correct is that it is

mantissa times (8 to the power exponent)

or more literally

mantissa times (2 to the power (3 times exponent))

This can be done quicker with a left shift. As K&R2 says,

The value of E1<<E2 is E1 (interpreted as a bit pattern)

left-shifted E2 bits; in the absence of overflow, this

E2

is equivalent to multiplication by 2 .

Chris