From 8108aaca394062fb2c9b52332ae514e62474d8bc Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Fri, 23 Jul 2021 00:42:33 +0200 Subject: [PATCH] UserspaceEmulator: Correct FSCALES rounding We were rounding the wrong way, FSCALE is supposed to trunc internally, while we were flooring. Now LibM exponentials and related tests work :^) --- Userland/DevTools/UserspaceEmulator/SoftFPU.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp b/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp index c22c03d357..2daf44bd7d 100644 --- a/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp +++ b/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp @@ -797,7 +797,7 @@ void SoftFPU::FRNDINT(const X86::Instruction&) void SoftFPU::FSCALE(const X86::Instruction&) { // FIXME: set C1 upon stack overflow or if result was rounded - fpu_set(0, fpu_get(0) * powl(2, floorl(fpu_get(1)))); + fpu_set(0, fpu_get(0) * powl(2, truncl(fpu_get(1)))); } void SoftFPU::FSQRT(const X86::Instruction&)