Dual in different processor architectures?

Is it possible to send double floating point values ​​(adjusted for the correct byte order) over the network and use them interchangeably on different processor architectures, in particular i386, mips (a couple of different cores), powerpc (e300, e500). No extremely old equipment.

Using gcc 4.2.1 as a compiler with -O for all architectures.

Presumably, this is the IEEE-754 standard everywhere (is it?), But as Wikipedia says:

IEEE 754-1985 allows many changes to implementations (for example, coding some values ​​and detecting certain exceptions). IEEE 754-2008 dragged on many of them, but several options remained (especially for binary formats).

I was not going to go through NaNs or other special things, just real decimal numbers.

+4
source share
2 answers

If you want to send images of normalized numbers, you are absolutely safe in any modern architecture. If in doubt, check out the architecture guide. For denormalized rooms you will need to check.

Of course, you should be able to understand bytes and collect on the other end using the correct byte order, but it looks like you know how to do it.

As already noted, you cannot expect different CPUs to implement each individual part of the standard equally, but this is not necessary.

IEEE to ASCII floating point conversion is fraught with an error; Guy Steele and Will Clinger were good documents in the 1990s. After that, Burger and Dybvig will follow up to do it faster .

+2
source

Basically you ask: "Can I transfer binary data between systems without problems." The answer is Yes, if the two systems agree to the same format. If you know which processor you expect, then check their IEEE standards and you should be in the business.

+1
source

All Articles