3 ms·
That is one hell of a war story - I didn't realize that kind of failure was even possible, but it is truly terrifying.
by klysm 4y ago
That is one hell of a war story - I didn't realize that kind of failure was even possible, but it is truly terrifying.
- pavlov 4y agoDirect3D used to flip the x87 FPU to single precision mode by default. This produced some amazing bugs when your other C libraries reasonably assumed that a double would be at least 64 bits. (The FPU mode settings affected the thread that called Direct3D, and most programs used to be single-threaded.) It seems they changed this behavior in Direct3D 10: https://microsoft.public.win32.programmer.directx.graphics.narkive.com/WBTT4fr3/d3dcreate-fpu-preserve-effects https://microsoft.public.win32.programmer.directx.graphics.n...
- speeder 4y agoI stumbled into this bug in a rather spetacular manner. I was making a game using D3D, Lua and Chipmunk physics, and some of the behaviour of the game was being odd. So I started to try printing random stuff with Lua, eventually I just tried: print(5+5), and to my surprise my console outputted "11". I went into Lua's irc channel to talk about this, and everyone said I was nuts, that the number was too small to trigger precision issues, that I was a troll and so on. After a lot of searching I found out about this D3D bug, so I switched the game to use OpenGL instead there it was, 5+5 = 10 again! Now why fiddling with the FPU could make 5+5 become 11, I have no idea.
- jcelerier 4y agoIf it ends up as 10+epsilon after the loss of precision and for some reason the fp round mode is set to FE_UPWARD ... And some part of the Lua stack recognizes that 5+5 is an integer-yielding expression and casts it as one for the display...