From ab70523b39eacac818efb8f8bacaf4d515eb98de Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Wed, 30 Apr 2025 15:22:01 +0200 Subject: [INTERP] Improve NAN handling on SQRTPS opcode --- src/emu/x64run660f.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/emu/x64run660f.c b/src/emu/x64run660f.c index a55a7328..7232c0c5 100644 --- a/src/emu/x64run660f.c +++ b/src/emu/x64run660f.c @@ -1287,8 +1287,10 @@ uintptr_t Run660F(x64emu_t *emu, rex_t rex, uintptr_t addr) GETEX(0); GETGX; for (int i=0; i<2; ++i) { - if(EX->d[i]<0.0) // on x86, default nan are negative - GX->d[i] = -NAN; // but input NAN are not touched (so sqrt(+nan) -> +nan) + if(EX->d[i]<0.0) // on x86, default nan are negative + GX->d[i] = -NAN; // but input NAN are not touched (so sqrt(+nan) -> +nan) + else if(isnan(EX->d[i])) + GX->d[i] = EX->d[i]; else GX->d[i] = sqrt(EX->d[i]); } -- cgit 1.4.1