x86-16 machine code, 21 bytes
00000000: 8bd0 2bc3 740e 7902 f7d8 3d05 0074 0503 ..+.t.y...=..t..
00000010: d383 fa05 c3 .....
8B D0 MOV DX, AX ; Save AX to DX
2B C3 SUB AX, BX ; AX = AX - BX
74 0E JZ DONE ; if 0, they are equal (ZF=1)
79 02 JNS IS_POS ; if positive, check if result is 5
F7 D8 NEG AX ; is negative, negate the result to get abs value
3D 0005 CMP AX, 5 ; is result 5?
74 05 JZ DONE ; if so, exit with ZF=1
03 D3 ADD DX, BX ; DX = DX + BX
83 FA 05 CMP DX, 5 ; ZF = ( DX == 5 )
C3 RET ; return to caller
Input numbers in
BX and returns Zero Flag (
ZF) if result is truthy.
If the difference between the numbers is 0, we know they are equal. Otherwise if result is negative, then first negate it and then check for 5. If still not true, then add and check for 5.
If desired, you can also determine which condition was true with the following:
5 ; sum is 5
5 ; diff is 5
0 ; equal
0 ; falsey