msvcrt: Add hyperbolic functions NAN tests.
Signed-off-by: Martin Storsjo <martin@martin.st> Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
07ec052e54
commit
868c9ee7c9
|
@ -491,8 +491,35 @@ static void test_qsort_s(void)
|
|||
ok(tab[i] == i, "data sorted incorrectly on position %d: %d\n", i, tab[i]);
|
||||
}
|
||||
|
||||
static int eq_nan(UINT64 ai, double b)
|
||||
{
|
||||
UINT64 bi = *(UINT64*)&b;
|
||||
UINT64 mask;
|
||||
|
||||
#if defined(__i386__)
|
||||
mask = 0xFFFFFFFF00000000ULL;
|
||||
#else
|
||||
mask = ~0;
|
||||
#endif
|
||||
|
||||
ok((ai & mask) == (bi & mask), "comparing %s and %s\n",
|
||||
wine_dbgstr_longlong(ai), wine_dbgstr_longlong(bi));
|
||||
return (ai & mask) == (bi & mask);
|
||||
}
|
||||
|
||||
static int eq_nanf(DWORD ai, float b)
|
||||
{
|
||||
DWORD bi = *(DWORD*)&b;
|
||||
ok(ai == bi, "comparing %08x and %08x\n", ai, bi);
|
||||
return ai == bi;
|
||||
}
|
||||
|
||||
static void test_math_functions(void)
|
||||
{
|
||||
static const UINT64 test_nan_i = 0xFFF0000123456780ULL;
|
||||
static const DWORD test_nanf_i = 0xFF801234;
|
||||
double test_nan = *(double*)&test_nan_i;
|
||||
float test_nanf = *(float*)&test_nanf_i;
|
||||
double ret;
|
||||
|
||||
errno = 0xdeadbeef;
|
||||
|
@ -525,6 +552,13 @@ static void test_math_functions(void)
|
|||
errno = 0xdeadbeef;
|
||||
p_exp(INFINITY);
|
||||
ok(errno == 0xdeadbeef, "errno = %d\n", errno);
|
||||
|
||||
ok(eq_nan(test_nan_i | (1ULL << 51), cosh(test_nan)), "cosh not preserving nan\n");
|
||||
ok(eq_nan(test_nan_i | (1ULL << 51), sinh(test_nan)), "sinh not preserving nan\n");
|
||||
ok(eq_nan(test_nan_i | (1ULL << 51), tanh(test_nan)), "tanh not preserving nan\n");
|
||||
ok(eq_nanf(test_nanf_i | (1 << 22), coshf(test_nanf)), "coshf not preserving nan\n");
|
||||
ok(eq_nanf(test_nanf_i | (1 << 22), sinhf(test_nanf)), "sinhf not preserving nan\n");
|
||||
ok(eq_nanf(test_nanf_i | (1 << 22), tanhf(test_nanf)), "tanhf not preserving nan\n");
|
||||
}
|
||||
|
||||
static void __cdecl test_thread_func(void *end_thread_type)
|
||||
|
|
Loading…
Reference in New Issue