Skip to content

Commit

Permalink
FSCALE should always return 0.0 if ST(0) input is 0.0, regardless of
Browse files Browse the repository at this point in the history
value of ST(1); this might otherwise return infinity or NaN if not
trapped. Fixes fade-in on MDK2.
  • Loading branch information
sarah-walker-pcem committed Jun 2, 2021
1 parent 0ad51dd commit 2e037b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/x87_ops_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,8 @@ static int opFSCALE(uint32_t fetchdat)
cpu_state.pc++;
if (fplog) pclog("FSCALE\n");
temp64 = (int64_t)ST(1);
ST(0) = ST(0) * pow(2.0, (double)temp64);
if (ST(0) != 0.0)
ST(0) = ST(0) * pow(2.0, (double)temp64);
cpu_state.tag[cpu_state.TOP&7] = TAG_VALID;
CLOCK_CYCLES(x87_timings.fscale);
return 0;
Expand Down

0 comments on commit 2e037b5

Please sign in to comment.