next up previous contents
Next: I can't run X Up: FAQ Previous: The program segfaults with   Contents


What about these float754 and double754 types?

IEEE 754 is an international standard for representing floating point numbers. Many of today's computers follow the norm, but not always exactly. You know that standards are so good that you should have many of them.

In short, if your computer either follows IEEE 754 or you have someway to convert a 754 to your internal type, you can exchange floating point numbers without loss of precision. Unfortunatedly the only OS that I know that has float754.h is Linux, so if you are running another OS you may have to do your own tweaking. Let me know if you manage to use these types in some platform other than Linux/x86.

Floatint point exchange has been a problem since it was first implemented, but things have been improving lately. I hope someday people will agree that exchanging floats is important, and that everybody should follow the standard.

The usual solution for this problem is to 'printf' the number and send as a string. This ensures 100% portability, at the cost of precision and bandwidth. DICElib supports this solution, using a special encoding to cut bandwidth. The float type has 6 digits of precision, and the double has 16, which should be enough for anybody sane. The issue is that float754 takes 4 bytes against 6 of float, and double754 uses 8 against 12.

I did one million transfers using random numbers. The maximum error was for the float type, and less than for the double. So, unless you really need the bandwidth, you'll be fine with the non-754 types.


next up previous contents
Next: I can't run X Up: FAQ Previous: The program segfaults with   Contents
2001-12-09