i8087: fix fpu here too

This commit is contained in:
cracyc 2023-01-09 16:22:26 -06:00
parent 1287b114de
commit af4fb2a5ef

View File

@ -2265,10 +2265,8 @@ void i8087_device::f2xm1(u8 modrm)
}
else
{
// TODO: Inaccurate
double x = fx80_to_double(ST(0));
double res = pow(2.0, x) - 1;
result = double_to_fx80(res);
extern floatx80 f2xm1(floatx80 a);
result = f2xm1(ST(0));
}
if (check_exceptions())
@ -2291,7 +2289,6 @@ void i8087_device::fyl2x(u8 modrm)
else
{
floatx80 x = ST(0);
floatx80 y = ST(1);
if (x.high & 0x8000)
{
@ -2300,10 +2297,8 @@ void i8087_device::fyl2x(u8 modrm)
}
else
{
// TODO: Inaccurate
double d64 = fx80_to_double(x);
double l2x = log(d64)/log(2.0);
result = floatx80_mul(double_to_fx80(l2x), y);
extern floatx80 fyl2x(floatx80 a, floatx80 b);
result = fyl2x(ST(0), ST(1));
}
}
@ -2327,13 +2322,8 @@ void i8087_device::fyl2xp1(u8 modrm)
}
else
{
floatx80 x = ST(0);
floatx80 y = ST(1);
// TODO: Inaccurate
double d64 = fx80_to_double(x);
double l2x1 = log(d64 + 1.0)/log(2.0);
result = floatx80_mul(double_to_fx80(l2x1), y);
extern floatx80 fyl2xp1(floatx80 a, floatx80 b);
result = fyl2xp1(ST(0), ST(1));
}
if (check_exceptions())
@ -2394,16 +2384,14 @@ void i8087_device::fpatan(u8 modrm)
{
floatx80 result;
if (X87_IS_ST_EMPTY(0))
if (X87_IS_ST_EMPTY(0) || X87_IS_ST_EMPTY(1))
{
set_stack_underflow();
result = fx80_inan;
}
else
{
// TODO: Inaccurate
double val = atan2(fx80_to_double(ST(1)) , fx80_to_double(ST(0)));
result = double_to_fx80(val);
result = floatx80_fpatan(ST(0), ST(1));
}
if (check_exceptions())
@ -2461,7 +2449,7 @@ void i8087_device::fcos(u8 modrm)
{
result = ST(0);
#if 0 // TODO: Function produces bad values
#if 1 // TODO: Function produces bad values
if (floatx80_fcos(result) != -1)
m_sw &= ~X87_SW_C2;
else
@ -2501,7 +2489,7 @@ void i8087_device::fsincos(u8 modrm)
s_result = c_result = ST(0);
#if 0 // TODO: Function produces bad values
#if 1 // TODO: Function produces bad values
if (sf_fsincos(s_result, &s_result, &c_result) != -1)
m_sw &= ~X87_SW_C2;
else