Posts

Showing posts with the label arm

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...

ARM64 Instruction Conversion for DCFS

ARM64 Instruction Conversion for DCFS As far as I understand, DCSF is a single-precision floating-point literal. I have this instruction, DCFS 0.00001 converting to AC C5 27 37. I am trying to convert DCFS 30 but cannot find any converter that can perform it. Can anyone convert it for me, and preferably, show me how it was done? Thank you! It is not clear to me what you are asking. The only mention of DCFS I can find in relation to ARM64 is your question. How was the 0.00001 value "converted"? Perhaps you need to specify the value as 30.0 to avoid it being interpreted as an integer. – Clifford Jul 1 at 12:54 I'm simply modifying a game via hex edit. I am trying to change it from DCFS 0.0001 to DCFS 30.0. – Ja Guz Jul 1 at 13:02 ...