Strange issue with floating point accuracy on ARM64
Strange issue with floating point accuracy on ARM64 I'm running into a really strange issue with floating point accuracy on ARM64. I have a very simple piece of C++ code that looks something like this: float sx = some_float_number_1; float sy = some_float_number_2; float ex = some_float_number_3; float ey = some_float_number_4; float px = ex; float py = ey; float d1 = (ex - sx) * (py - sy); float d2 = (px - sx) * (ey - sy); float d = d1 - d2; float t = (ex - sx) * (py - sy) - (px - sx) * (ey - sy); //32-bit output: d == t == 0 //64-bit output: d == 0, t != 0 In theory, d is supposed to be equal to t and equal to 0, and that's exactly what happened on 32-bit ARM. But for some odd reason, the output of t is not equal to 0 on 64-bit ARM while d is still correct. I have never seen any bug like this, so I have no idea what could've caused this kind of problem. EDIT: Some more info EDIT2: Here's the disassembly 4c: 52933348 mov w8, #0x999a // #39322 50: 72a...