I think the answer "depends" on what your specific application and its performance profile are.
Suppose you have a low latency environment in market data, then using strings is frankly stupid. If the information you transmit is the price, then double (and their binary representation) is really difficult to work with. Where, how, if you really don't care about performance, and what you need is visibility (storage, transfer), then strings are an ideal candidate.
I would choose the integral representation of the mantissa / exponential representation of floats / doubles - that is, at the first opportunity I converted float / double to a pair of integers, and then passed that. You then only need to worry about portability of integers and, well, various subroutines (such as the hton() subroutines for conversion processing for you). Also save everything in your most common endianess platform (for example, if you use only linux, then what's the point of storing things in a large endianess?)
Nim Jan 19 '11 at 9:45 2011-01-19 09:45
source share