Formula difficulty

I receive data via the serial UART for uploading to the web via ethernet, which works great, except I cannot resolve the datastream to the required format. The datastream arrives in a variable defined as; float sd8=0.0; and a example value is 6183 I need to divide this figure by 100 and minus 50 to give me the required format as 11.83 (it is in fact degrees celsius). and am trying to achieve this by including formula in the ethernet send statement; stash.println((word) sd8); something like; stash.println((word) (sd8 / 100) - 50); but I get 11 (the 2 decimal places are missing!!) Can anyone help please, I've spent hours trying to get this to work without avail. This is the full sketch http://pastebin.com/vqJeqKL8

stash.println((word) (sd8 / 100) - 50);

You should investigate two things. First, what exactly is a word, and what happens when you cast a value as a word.

The second is what happens when you perform mixed mode arithmetic. If sd8 is a float, the other values should be floats, too.

stash.println((sd8 / 100.0) - 50.0);

might produce better results.

PaulS: stash.println((word) (sd8 / 100) - 50);

You should investigate two things. First, what exactly is a word, and what happens when you cast a value as a word.

The second is what happens when you perform mixed mode arithmetic. If sd8 is a float, the other values should be floats, too.

stash.println((sd8 / 100.0) - 50.0);

might produce better results.

As always Paul you are right, and your example delivers the correct format - currently displaying 11.63 deg C on my Pachube site https://pachube.com/feeds/34843

Thank you.