News for hackers. Stuff that matters.
Re:Formatting floating point numbers by fluffything on Friday June 14, 2019 @07:36AM (#20182116)
> that could be addressed with a simple 4 or 8 byte memcpy.

This won't account for endianness.

Re:Formatting floating point numbers by pedrocr on Friday June 14, 2019 @08:33AM (#20182424)
In a serialization format you should explicitly define the endianness to be used and then convert to and from it explicitly in the serialize/deserialize code. So memcpy is wrong but the grandparent point still stands. Defining a serialization format for float/double that's just 4/8 bytes in little-endian might be a better idea than the mess we sometimes have right now because IEE-754 is more of a standard than anything else in the space.
Re:Formatting floating point numbers by jgtrosh on Friday June 14, 2019 @08:04AM (#20182265)
Floating point formatting deals only with the default endianness of the hardware though. Afaik if you need to deal with that you have to do it yourself regardless (with bswap functions or similar).
Re:Formatting floating point numbers by userbinator on Friday June 14, 2019 @07:33PM (#20187514)
Fortunately much of the world has already settled on an endianness, and the one that happens to be most logical to process (byte offset n has weight 256^n, much like bit x has weight 2^x.)

In the future, hopefully big-endian machines will be as uncommon as bytes that are not 8 bits, and the only protocols still using it are the ones which were designed long ago.