The test program below uses both printf and cout to display what I thought should be the same thing, and they are identical when run on a Mac using Xcode. However, when run on Windows using VS2019 the precision of the hex floating point result is different. I realize I can probably adjust the precision to make them match but is this actually a compiler problem or just a legal implementation dependent issue?
Output with VS2019:
9.223377e+12 0x1.0c6f83e89c600p+43
9.223377e+12 0x1.0c6f84p+43
Output with Xcode on a Mac:
9.223377e+12 0x1.0c6f83e89c600p+43
9.223377e+12 0x1.0c6f83e89c600p+43
#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
long double x = 9223377208547.0L;
printf("%Le %La\n", x, x);
cout << scientific << x << ' ' << hexfloat << x << '\n';
}