> This has been bugging me for a while, so hoping some of the PIC > collective can help. > > Basically a host system is sending a non-standard 8 bit floating point > value to my PIC, and I have to test whether it's greater than an > arbitrary number. The format is as follows: > > 7654 3210 > MMMM EEEE > > Where: > > M is the 4 bit Mantissa, a value between 0/16 and 15/16 > E is the 4 bit Exponent, a value between 10^-15 and 10^0 > > This gives a range of 6.25E-17 to 0.9375. > That IS an interesting format! Floating point that I'm used to has the exponent represent a power of two and the mantissa has an assumed msb of one (with some provision for a value of zero with the negative extreme exponent). Here, the mantissa is "binary" using all four bits. But an overflow of the mantissa does not directly affect the exponent since the exponent is base 10. If it were base 2, a mantissa overflow would result in a shift right of the mantissa and an increment of the exponent. I really don't know what would happen here! If you swap the nybbles so the exponent is in the high half, do you end up anywhere near a steadily increasing order? Good luck! Harold -- FCC Rules Updated Daily at http://www.hallikainen.com - Advertising opportunities available! -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist