
John Maddock wrote:
In late breaking news, I also hear from Matt that GCC and IBM both "cheat" by using (mutually incompatible) non-IEEE binary encodings.
Are these documented anywhere? It would be interesting to look at them for inspiration.
I wish. They docs just say BID format. Here is what IEEE 754 specifies: https://github.com/cppalliance/decimal/blob/develop/include/boost/decimal/de... Here is what I gathered from trying to wrap the builtin libstdc++ (IBM) types: https://github.com/cppalliance/decimal/pull/823/files#diff-dacda7fd3b3e5817b... I kept dumping the bits of powers of two etc to figure it out: https://github.com/cppalliance/decimal/pull/823/files?file-filters%5B%5D=.cpp&file-filters%5B%5D=No+extension&show-viewed-files=true#diff-b439f27c2dfc48ec83a0f53ee47db4b27c21f2edf8ff6245931c09b06477a80dR59 Basically, it's laid out like a binary float most of the time. In Intel's case for implementation of mathematical functions they convert the Decimal32 to a float, perform an operation, and then convert back. Makes things pretty quick when your conversion operation is NOP, and then you can offload computations to presumably the MKL. Matt