However, this has generated questions about how to do such a thing from folks that are just starting out using an Arduino hooked to an XBee because it isn't obvious. Yes, there are a bazillion examples out there, but not specifically related to passing data between XBees. Additionally, there are operators in other languages that take care of this kind of thing totally behind the scenes and programmers don't have to worry about it.
Adding insult to injury, the Stream data type in the Arduino IDE has problems when running for a very long time: it will run your board out of memory and cause it to fail. This isn't a complaint about the Arduino development environment, just a simple fact. The little Arduino only has 2K of memory to play with and you simply run out if you try to do too much. It's not like a laptop with 8Gb of memory to play around with, you have to control yourself and your code. So, doing things with as little memory usage as possible using simple tools is the way to make a device that can run for a week without failing.
So, here's a sketch that illustrates the some of the data types including the float. The integer and long datatypes are relatively easy, but the float confuses some people. The float has generated probably a hundred questions and even more misunderstandings. This code is waaay over commented and will compile and run on an Arduino. It basically takes a float, long and integer, converts them into ascii in a string with other stuff, and then gets it back out into variables to be used further. The middle part where the string is sent between two devices can be found in other places on this blog. This will compile and run on an Arduino under IDE version 1.0 and up.
Yes, I eat up substantial code memory using sprintf(), but it's worth it. You can reuse the buffer over and over and you only pay the price for sprintf() once, not over and over again like you do with the String datatype. Notice I didn't get into a long discussion of how floats are stored in memory and how operations on them work. That's documented in about a million places and I don't want to add confusion by getting into that discussion. If you need to know, go look it up.
There are three c library routines that are used here: atoi(), atol(), and atof(). These are documented on the web, so take a look at what they do. One of the keys to understanding this stuff is to do a LOT of looking around for various solutions. Anything you want to do has been done in some part before and someone probably wrote about it somewhere.
Keep in mind that there are as many ways to do this as there are programmers doing it. So this is just one way. I chose this to illustrate it as completely and simply as I could so folks would leave with a few less questions than they came with.
Now, when these questions come up, I can simply point to this page and let folks play with the code until they get the idea. When people first start out using an Arduino to try and control things, it's a tough enough hurdle just getting the first code to work; I hope this helps some of them.