A bit of a random question/thought - what is a good and portable method of storing/transmitting binary floating point numbers? Anyone aware of any conversion functions in NetBSD that I can look at?
Searching the Internet, there are various opinions and references on how to do it, but there doesn't seem to be a definitive answer. I'd like to avoid converting binary to text and then back to binary. So I'm thinking the following procedure should work: 1. Make sure software always built to use IEEE 754 format. 2. Convert number to network byte order. 3. Transmit binary data. 4. On the other end, convert from network to host byte order. I assume this should work for IEEE 754 32-bit, 64-bit and 128-bit floating point types. Can anyone think of any reasons where this could fail? I think most modern hardware now can cope with IEEE 754. Some embedded systems may not have floating point hardware, but then system software libraries should handle it.