NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Serialization of binary floating point numbers



On Sat, 18 May 2019 17:23:57 +0200
Martin Husemann <martin%duskware.de@localhost> wrote:

> On Sat, May 18, 2019 at 08:58:35AM +0100, Sad Clouds wrote:
> > what I can see most of the modern hardware use 2's complement
> > integer arithmetic and IEEE 754 floating point, but not sure if
> > there are any specific exceptions I'm not aware of.
> 
> There are variations in the ieee 754 formats though, and all details
> depend on your use case and the "portability" you are trying to
> achive.
> 
> Martin

So when you say there are variations, are you referring to IEEE
754-2008 decimal floating point numbers, or something else? There are
only a few platforms that support this in hardware.

The use cases are around storing floating point numbers on disk, or
transmitting them across a network. For example, if you have different
platforms with different FPU hardware, provided that you stick to IEEE
754, they all should be able to load floating point number and perform
calculations with it, without any compatibility issues. Another example
is SQLite REAL data type, which is 8-byte IEEE floating point number.
Their databases are portable, so I assume you can read/write the same
database across different architectures.


Home | Main Index | Thread Index | Old Index