diff --git a/src/interpret.cpp b/src/interpret.cpp index 2ada7d129e..b8704bbb9e 100644 --- a/src/interpret.cpp +++ b/src/interpret.cpp @@ -1253,14 +1253,30 @@ interpret(Thread* t) float b = popFloat(t); float a = popFloat(t); - pushInt(t, (a > b ? 1 : 0)); + if (a < b) { + pushInt(t, static_cast(-1)); + } else if (a > b) { + pushInt(t, 1); + } else if (a == b) { + pushInt(t, 0); + } else { + pushInt(t, 1); + } } goto loop; case fcmpl: { float b = popFloat(t); float a = popFloat(t); - pushInt(t, (a < b ? 1 : 0)); + if (a < b) { + pushInt(t, static_cast(-1)); + } else if (a > b) { + pushInt(t, 1); + } else if (a == b) { + pushInt(t, 0); + } else { + pushInt(t, static_cast(-1)); + } } goto loop; case fconst_0: {