ReactOS 0.4.15-dev-8219-ge8b88cf
math_helpers.h File Reference
#include <math.h>
#include <float.h>
#include <apitest.h>
Include dependency graph for math_helpers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _TESTENTRY_DBL
 
struct  _TESTENTRY_FLT
 

Macros

#define _USE_MATH_DEFINES
 
#define ok_eq_dbl_exact_(file, line, func, ullx, z, ullexp)
 
#define ok_eq_dbl_exact(func, ullx, z, ullexp)   ok_eq_dbl_exact_(__FILE__, __LINE__, func, ullx, z, ullexp)
 
#define ok_eq_flt_exact_(file, line, func, ux, z, uexp)
 
#define ok_eq_flt_exact(func, ux, z, uexp)   ok_eq_flt_exact_(__FILE__, __LINE__, func, ux, z, uexp)
 

Typedefs

typedef struct _TESTENTRY_DBL TESTENTRY_DBL
 
typedef struct _TESTENTRY_FLT TESTENTRY_FLT
 

Functions

static __inline double u64_to_dbl (UINT64 x)
 
static __inline UINT64 dbl_to_u64 (double x)
 
static __inline float u32_to_flt (UINT32 x)
 
static __inline UINT32 flt_to_u32 (float x)
 

Macro Definition Documentation

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

Definition at line 10 of file math_helpers.h.

◆ ok_eq_dbl_exact

#define ok_eq_dbl_exact (   func,
  ullx,
  z,
  ullexp 
)    ok_eq_dbl_exact_(__FILE__, __LINE__, func, ullx, z, ullexp)

Definition at line 67 of file math_helpers.h.

◆ ok_eq_dbl_exact_

#define ok_eq_dbl_exact_ (   file,
  line,
  func,
  ullx,
  z,
  ullexp 
)
Value:
{ \
double x = u64_to_dbl(ullx); \
unsigned long long ullz = dbl_to_u64(z); \
double exp = u64_to_dbl(ullexp); \
ok_(file, line)(ullz == ullexp, "Wrong value for '%s(%f)' [0x%016llx], expected: %f [0x%016llx], got: %f [0x%016llx]\n", \
func, x, ullx, exp, ullexp, z, ullz); \
}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLenum func
Definition: glext.h:6028
GLdouble GLdouble z
Definition: glext.h:5874
static __inline double u64_to_dbl(UINT64 x)
Definition: math_helpers.h:18
static __inline UINT64 dbl_to_u64(double x)
Definition: math_helpers.h:26
DWORD exp
Definition: msg.c:16058
Definition: fci.c:127
Definition: parser.c:49

Definition at line 59 of file math_helpers.h.

◆ ok_eq_flt_exact

#define ok_eq_flt_exact (   func,
  ux,
  z,
  uexp 
)    ok_eq_flt_exact_(__FILE__, __LINE__, func, ux, z, uexp)

Definition at line 77 of file math_helpers.h.

◆ ok_eq_flt_exact_

#define ok_eq_flt_exact_ (   file,
  line,
  func,
  ux,
  z,
  uexp 
)
Value:
{ \
float x = u32_to_flt(ux); \
unsigned int uz = flt_to_u32(z); \
float exp = u32_to_flt(uexp); \
ok_(file, line)(uz == uexp, "Wrong value for '%s(%f)' [0x%08x], expected: %f [0x%08x], got: %f [0x%08x]\n", \
func, x, ux, exp, uexp, z, uz); \
}
static __inline float u32_to_flt(UINT32 x)
Definition: math_helpers.h:34
static __inline UINT32 flt_to_u32(float x)
Definition: math_helpers.h:42

Definition at line 69 of file math_helpers.h.

Typedef Documentation

◆ TESTENTRY_DBL

◆ TESTENTRY_FLT

Function Documentation

◆ dbl_to_u64()

static __inline UINT64 dbl_to_u64 ( double  x)
static

Definition at line 26 of file math_helpers.h.

27{
28 return *(UINT64*)(&x);
29}
unsigned long long UINT64

◆ flt_to_u32()

static __inline UINT32 flt_to_u32 ( float  x)
static

Definition at line 42 of file math_helpers.h.

43{
44 return *(UINT32*)(&x);
45}
unsigned int UINT32

◆ u32_to_flt()

static __inline float u32_to_flt ( UINT32  x)
static

Definition at line 34 of file math_helpers.h.

35{
36 return *(float*)(&x);
37}

Referenced by Test_ceilf(), Test_fabsf(), and Test_floorf().

◆ u64_to_dbl()

static __inline double u64_to_dbl ( UINT64  x)
static

Definition at line 18 of file math_helpers.h.

19{
20 return *(double*)(&x);
21}

Referenced by Test_ceil(), Test_fabs(), and Test_floor().