Here's a Linux program to print the x87 FPU control word:
#include <stdio.h>
#include <fpu_control.h>
int main(int argc, char** argv) {
fpu_control_t cw;
_FPU_GETCW(cw);
printf("0x%x\n", cw);
}
On WSL it prints 0x27f. On real Linux it prints 0x37f. The difference is in the precision control field (bits 8-9): on Windows it's set to 0x2 = 64-bit double precision mode, and on Linux it's set to 0x3 = 80 bit extended precision mode.
This is not a very surprising bug; these are the standard settings for the control word in the Windows and Linux ABIs, respectively. But WSL should match the Linux ABI, not the Windows ABI :-). The effect is that Linux programs that use long double will produce incorrect results under WSL (and it'll cause small rounding differences in floating point code in general).
Originally discovered due to incorrect results when using numpy's longdouble type under WSL:
numpy/numpy#8726