# Researching 8-bit floating point.

Recently, I ran in to a situation where a floating point value (represent current) was being converted to a byte value before being sent off in a status message. Thus, any calculations on the other side were being done with whole values (1, 2, 42, etc.). I was asked if the precision could be increased (adding a decimal place) and realized “you can’t get there from here.”

This made me wonder how much could be done with an 8-bit floating point representation. A quick web search led me to this article:

http://www.toves.org/books/float/

I also found a few others discussion other methods of representing a floating point value with only 8-bits.

Now I kinda want to code up such a routine in C and do some tests to see if it would be better than our round-to-whole-number approach.

But it doesn’t seem very useful.

## 6 thoughts on “Researching 8-bit floating point.”

1. Scott

IEEE754 is the floating point representation standard. I see they do a 16 bit variant. Perhaps you can extend downwards using the same methods?
https://en.wikipedia.org/wiki/IEEE_754

1. Allen Huffman Post author

That’s a good starting point. The article I linked to must be similar. I see it has a sign bit, four exponent bits and three mantissa bits. That looks very similar to IEEEE in a small package.

2. wb8nbs

Just multiply the value by ten, send it, and divide it by ten at the other end.

1. Allen Huffman Post author

That’s a real straightforward idea. Is that Fixed Point? That would only allow 0-21.9 for a range. I’ll have to see what the current range is.

3. MiaM

As a side track, in addition to the fixed point that wb8ns already suggested, it might be worth investigating a non-linear scale where the steps are course in the areas that less precision is needed and fine in the areas where more precision is needed.

Also if the values are mostly used to calculate some form of average value and the transmission rate really is a bit faster than required you could add a dither noise which would make each sample itself less accurate but an average over a few samples would be more accurate.

1. Allen Huffman Post author

In this case, I think they represent amps. There are multiple devices reporting amps, and the host PC program collects that data and adds them up for the total amperage being used. Depending on how rounding works in the conversion from float to uint8, it could be losing .9 amps X 22 devices.

This site uses Akismet to reduce spam. Learn how your comment data is processed.